From edceb8dce309df2195d9be507ea47c5256b3fd83 Mon Sep 17 00:00:00 2001 From: Daniel Dyla Date: Fri, 27 Aug 2021 11:02:32 -0400 Subject: [PATCH] chore: simplify unit test cache --- .github/workflows/lint.yml | 28 ++++------------ .github/workflows/unit-test.yml | 57 +++++++++++---------------------- 2 files changed, 25 insertions(+), 60 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 537010ec850..874aed78225 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -28,31 +28,17 @@ jobs: with: args: "./**/*.md -i ./CHANGELOG.md" - - name: restore lock files - uses: actions/cache@master # must use unreleased master to cache multiple paths + - name: restore lerna id: cache + uses: actions/cache@v2 with: - # must be done before bootstrap to not include node_modules files in the cache paths path: | - package-lock.json - packages/*/package-lock.json - benchmark/*/package-lock.json - backwards-compatability/*/package-lock.json - metapackages/*/package-lock.json - packages/*/package-lock.json - integration-tests/*/package-lock.json - # increment the trailing number to break the cache manually - key: ${{ runner.os }}-lint-${{ hashFiles('**/package.json') }}-0 + node_modules + */*/node_modules + key: lint-${{ runner.os }}-${{ matrix.node_version }}-${{ hashFiles('**/package.json') }} - # On a cache hit, use ci to speed up the install process - - name: Bootstrap (cache hit) - if: steps.cache.outputs.cache-hit == 'true' - run: | - npm ci --ignore-scripts - npx lerna bootstrap --ignore-scripts --hoist --nohoist='zone.js' - - # On a cache miss, fall back to a regular install - - name: Bootstrap (cache miss) + # On a cache miss, install dependencies + - name: Bootstrap if: steps.cache.outputs.cache-hit != 'true' run: | npm install --ignore-scripts diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index 51ed1b5e146..bea64d0cdc7 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -22,33 +22,23 @@ jobs: with: node-version: ${{ matrix.node_version }} - - name: restore lock files - uses: actions/cache@master # must use unreleased master to cache multiple paths + - name: restore lerna id: cache + uses: actions/cache@v2 with: - # must be done before bootstrap to not include node_modules files in the cache paths path: | - package-lock.json - packages/*/package-lock.json - benchmark/*/package-lock.json - backwards-compatability/*/package-lock.json - metapackages/*/package-lock.json - packages/*/package-lock.json - integration-tests/*/package-lock.json - key: ${{ runner.os }}-unit_test-${{ matrix.node_version }}-${{ hashFiles('**/package.json') }} - - name: Install and Build (cache miss) 🔧 + node_modules + */*/node_modules + key: unittest-${{ runner.os }}-${{ matrix.node_version }}-${{ hashFiles('**/package.json') }} + + - name: Bootstrap if: steps.cache.outputs.cache-hit != 'true' run: | npm install --ignore-scripts npx lerna bootstrap --no-ci --hoist --nohoist='zone.js' - npm run compile - - name: Install and Build (cache hit) 🔧 - if: steps.cache.outputs.cache-hit == 'true' - run: | - npm ci --ignore-scripts - npx lerna bootstrap --hoist --nohoist='zone.js' - npm run compile + - name: Build 🔧 + run: npm run compile - name: Unit tests run: npm run test @@ -66,35 +56,24 @@ jobs: uses: actions/checkout@v1 - name: Permission Setup run: sudo chmod -R 777 /github /__w - - name: restore lock files - uses: actions/cache@master # must use unreleased master to cache multiple paths + + - name: restore lerna + uses: actions/cache@v2 id: cache with: - # must be done before bootstrap to not include node_modules files in the cache paths path: | - package-lock.json - packages/*/package-lock.json - benchmark/*/package-lock.json - backwards-compatability/*/package-lock.json - metapackages/*/package-lock.json - packages/*/package-lock.json - integration-tests/*/package-lock.json - key: ${{ runner.os }}-unit_test-${{ matrix.container }}-${{ hashFiles('**/package.json') }} + node_modules + */*/node_modules + key: unittest-${{ runner.os }}-${{ matrix.node_version }}-${{ hashFiles('**/package.json') }} - - name: Install and Build (cache miss) 🔧 + - name: Bootstrap if: steps.cache.outputs.cache-hit != 'true' run: | npm install --ignore-scripts npx lerna bootstrap --no-ci --hoist --nohoist='zone.js' - npm run compile - - - name: Install and Build (cache hit) 🔧 - if: steps.cache.outputs.cache-hit == 'true' - run: | - npm ci --ignore-scripts - npx lerna bootstrap --hoist --nohoist='zone.js' - npm run compile + - name: Build 🔧 + run: npm run compile - name: Unit tests run: npm run test:browser - name: Report Coverage