From caa71e83ce31fb910c3a734099d6ed41ecdc5199 Mon Sep 17 00:00:00 2001 From: Gene Hoffman <30377676+hoffmang9@users.noreply.github.com> Date: Sat, 23 May 2020 15:47:01 -0700 Subject: [PATCH] Place azure actions in venv - rename Mojave DMG, add npm fix to all (#241) * Build in venv on azure * Add npm audit fix, add venv to most steps on all runners * Clean azure action, add npm fix to install.sh * Rename azure pipeline Mojave DMG, prettify --- .github/workflows/build-ubuntu-mac.yml | 4 ++++ .github/workflows/windows-installer.yml | 4 ++-- azure-pipelines.yml | 21 +++++++++++++++++++-- install-timelord.sh | 4 ++-- install.sh | 1 + 5 files changed, 28 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-ubuntu-mac.yml b/.github/workflows/build-ubuntu-mac.yml index 5a4d63f62382..cff929a5d989 100644 --- a/.github/workflows/build-ubuntu-mac.yml +++ b/.github/workflows/build-ubuntu-mac.yml @@ -43,9 +43,11 @@ jobs: run: | . ./activate sh install-timelord.sh + ./vdf_bench square_asm 400000 - name: Install developer requirements run: | + . ./activate venv/bin/python -m pip install -r requirements-dev.txt - name: Lint source with flake8 @@ -59,11 +61,13 @@ jobs: - name: Build MacOS DMG in Catalina if: startsWith(matrix.os, 'mac') run: | + . ./activate cd build_scripts sh build_macos.sh - name: Test blockchain code with pytest run: | + . ./activate ./venv/bin/py.test tests -s -v - name: Upload MacOS artifacts diff --git a/.github/workflows/windows-installer.yml b/.github/workflows/windows-installer.yml index 7cdd40710378..8f2890a9733c 100644 --- a/.github/workflows/windows-installer.yml +++ b/.github/workflows/windows-installer.yml @@ -18,13 +18,13 @@ jobs: with: python-version: "3.7" - - name: Run build_windows.ps1 + - name: Build Windows installer with build_scripts\build_windows.ps1 working-directory: ${{ github.workspace }}\build_scripts run: | git config --global core.longpaths true ./build_windows.ps1 - - name: Upload Windows exe's + - name: Upload Windows exe's to artifacts uses: actions/upload-artifact@v1 with: name: Windows-Exe diff --git a/azure-pipelines.yml b/azure-pipelines.yml index c61c9e38e9f3..15022f061af5 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -14,7 +14,7 @@ pool: vmImage: "macOS-10.14" strategy: matrix: - Python37: + Moajave DMG: python.version: "3.7" # Python38: # python.version: '3.8' # Disabled 3.8 because artifact names conflict @@ -29,6 +29,12 @@ steps: # since we're installing miniupnpc & setproctitle below, # only cbor2 will end up in wheels/ - script: | + python -m venv venv + ln -s venv/bin/activate . + . ./activate + echo "which python, pip after activate" + which python + which pip python -m pip install --upgrade pip pip install wheel pep517 node -v @@ -38,41 +44,52 @@ steps: pip install -i https://download.chia.net/simple/ miniupnpc==2.1 setproctitle==1.1.10 cbor2==5.1.0 cd ./electron-react npm install + npm audit fix displayName: "Install dependencies" - script: | + . ./activate pip wheel --use-pep517 --only-binary cbor2 --extra-index-url https://download.chia.net/simple/ --wheel-dir=wheels . displayName: "Build wheels" - script: | + . ./activate cd ./electron-react npm install displayName: "Build Electron UI" # Using wheels and release style install so no sh install.sh - script: | + . ./activate pip install . displayName: "Install wheels" # install-timelord.sh usually wants venv, but this clean runner is the "venv" - script: | + . ./activate + echo "which python" + which python brew install boost sh install-timelord.sh + ./vdf_bench square_asm 400000 displayName: "Install timelord" - script: | + . ./activate python -m pip install -r requirements-dev.txt displayName: "Install dev dependencies" - script: | + . ./activate pip install pytest pytest-azurepipelines py.test tests -s -v displayName: "pytest" - script: | + . ./activate cd build_scripts sh build_macos.sh - displayName: "Build DMG" + displayName: "Build DMG with build_scripts/build_macos.sh" - task: PublishPipelineArtifact@1 inputs: diff --git a/install-timelord.sh b/install-timelord.sh index 0fb5d2c9dfdd..d559099da83c 100644 --- a/install-timelord.sh +++ b/install-timelord.sh @@ -64,13 +64,13 @@ else # User needs to provide required packages echo venv/bin/python -m pip install --force --no-binary chiavdf "$CHIAVDF_VERSION" venv/bin/python -m pip install --force --no-binary chiavdf "$CHIAVDF_VERSION" - link_vdf_bench "$PYTHON_VERSION" + symlink_vdf_bench "$PYTHON_VERSION" elif [ -e venv/bin/python ]; then echo "installing chiavdf from source" # User needs to provide required packages echo venv/bin/python -m pip install --force --no-binary chiavdf "$CHIAVDF_VERSION" venv/bin/python -m pip install --force --no-binary chiavdf "$CHIAVDF_VERSION" - link_vdf_bench "$PYTHON_VERSION" + symlink_vdf_bench "$PYTHON_VERSION" else echo "no venv created yet, please run install.sh" fi diff --git a/install.sh b/install.sh index 0f9428fa44a3..435244c48cdd 100644 --- a/install.sh +++ b/install.sh @@ -70,6 +70,7 @@ pip install -e . cd ./electron-react npm install +npm audit fix echo "" echo "Chia blockchain install.sh complete."