From 2c00603441217eaa3ddf3639797f5b2ec0c0f0b6 Mon Sep 17 00:00:00 2001 From: Gene Hoffman <30377676+hoffmang9@users.noreply.github.com> Date: Mon, 15 Jun 2020 18:28:24 -0700 Subject: [PATCH] Adding node/pip caching to ci - fix passing HAS_SECRET to build_windows (#291) * spell HAVE_SECRET right - remove extra Azure Pipelines env var * Remove debug - cache pip * Add caching to macos and ubuntu * Key cache on setup.py - use pip to get cache dir * Remove macos, ubuntu "os" updates --- .github/workflows/build-macos.yml | 32 +++++++++++++++++++++++--- .github/workflows/build-ubuntu.yml | 27 +++++++++++++++++++++- .github/workflows/build-windows.yml | 35 ++++++++++++++++++++--------- azure-pipelines.yml | 1 - build_scripts/build_windows.ps1 | 5 +---- 5 files changed, 80 insertions(+), 20 deletions(-) diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index aa0a36fe9aab..1a094cc11435 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -27,6 +27,32 @@ jobs: with: python-version: ${{ matrix.python-version }} + - name: Cache node modules + uses: actions/cache@v2 + env: + cache-name: cache-node-modules + with: + # npm cache files are stored in `~/.npm` on Linux/macOS + path: ~/.npm + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + + - name: Get pip cache dir + id: pip-cache + run: | + echo "::set-output name=dir::$(pip cache dir)" + + - name: Cache pip + uses: actions/cache@v2 + with: + path: ${{ steps.pip-cache.outputs.dir }} + key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }} + restore-keys: | + ${{ runner.os }}-pip- + - name: Test for secrets access id: check_secrets shell: bash @@ -44,9 +70,9 @@ jobs: p12-file-base64: ${{ secrets.APPLE_DEV_ID_APP }} p12-password: ${{ secrets.APPLE_DEV_ID_APP_PASS }} - - name: Install MacOS dependencies - run: | - brew update +# - name: Install MacOS dependencies +# run: | +# brew update - name: Run install script env: diff --git a/.github/workflows/build-ubuntu.yml b/.github/workflows/build-ubuntu.yml index 25e95507dc00..ddf1b5f5d15a 100644 --- a/.github/workflows/build-ubuntu.yml +++ b/.github/workflows/build-ubuntu.yml @@ -27,9 +27,34 @@ jobs: with: python-version: ${{ matrix.python-version }} + - name: Cache node modules + uses: actions/cache@v2 + env: + cache-name: cache-node-modules + with: + # npm cache files are stored in `~/.npm` on Linux/macOS + path: ~/.npm + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + + - name: Get pip cache dir + id: pip-cache + run: | + echo "::set-output name=dir::$(pip cache dir)" + + - name: Cache pip + uses: actions/cache@v2 + with: + path: ${{ steps.pip-cache.outputs.dir }} + key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }} + restore-keys: | + ${{ runner.os }}-pip- + - name: Install ubuntu dependencies run: | - sudo apt-get update sudo apt-get install python${{ matrix.python-version }}-venv python${{ matrix.python-version }}-distutils git -y sudo apt-get install nodejs-dev node-gyp diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index 7536509f6c77..3e12588374a3 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -19,17 +19,30 @@ jobs: # we need fetch-depth 0 so setuptools_scm can resolve tags - name: Cache node modules - uses: actions/cache@v2 - env: - cache-name: cache-node-modules - with: - # npm cache files are stored in `~/.npm` on Linux/macOS - path: ~/.npm - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-build-${{ env.cache-name }}- - ${{ runner.os }}-build- - ${{ runner.os }}- + uses: actions/cache@v2 + env: + cache-name: cache-node-modules + with: + # npm cache files are stored in `~/.npm` on Linux/macOS + path: ~/.npm + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + + - name: Get pip cache dir + id: pip-cache + run: | + echo "::set-output name=dir::$(pip cache dir)" + + - name: Cache pip + uses: actions/cache@v2 + with: + path: ${{ steps.pip-cache.outputs.dir }} + key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }} + restore-keys: | + ${{ runner.os }}-pip- - name: Test for secrets access id: check_secrets diff --git a/azure-pipelines.yml b/azure-pipelines.yml index effaf3877d7b..4342812157ab 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -95,7 +95,6 @@ steps: sh build_macos.sh ls -l final_installer displayName: "Build DMG with build_scripts/build_macos.sh" - env: { CHIA_INSTALLER_VERSION: "0.1.6" } - task: PublishPipelineArtifact@1 inputs: diff --git a/build_scripts/build_windows.ps1 b/build_scripts/build_windows.ps1 index ee0da031f824..053663d8d7e8 100644 --- a/build_scripts/build_windows.ps1 +++ b/build_scripts/build_windows.ps1 @@ -94,10 +94,7 @@ Write-Output "node winstaller.js" node winstaller.js Write-Output " ---" -Write-Output "HAS SECRET is:" -Get-Childitem env:HAS_SECRET - -If ($env:HAS_SECRETS -eq "true") { +If ($env:HAS_SECRET) { Write-Output " ---" Write-Output "Add timestamp and verify signature" Write-Output " ---"