chore: simplify unit test cache (#2435)

Co-authored-by: Valentin Marchaud <contact@vmarchaud.fr>
This commit is contained in:
Daniel Dyla 2021-08-30 04:01:57 -04:00 committed by GitHub
parent dbfabd2bff
commit facd8c0fb9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 60 deletions

View File

@ -28,31 +28,17 @@ jobs:
with: with:
args: "./**/*.md -i ./CHANGELOG.md" args: "./**/*.md -i ./CHANGELOG.md"
- name: restore lock files - name: restore lerna
uses: actions/cache@master # must use unreleased master to cache multiple paths
id: cache id: cache
uses: actions/cache@v2
with: with:
# must be done before bootstrap to not include node_modules files in the cache paths
path: | path: |
package-lock.json node_modules
packages/*/package-lock.json */*/node_modules
benchmark/*/package-lock.json key: lint-${{ runner.os }}-${{ matrix.node_version }}-${{ hashFiles('**/package.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
# On a cache hit, use ci to speed up the install process # On a cache miss, install dependencies
- name: Bootstrap (cache hit) - name: Bootstrap
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)
if: steps.cache.outputs.cache-hit != 'true' if: steps.cache.outputs.cache-hit != 'true'
run: | run: |
npm install --ignore-scripts npm install --ignore-scripts

View File

@ -22,33 +22,23 @@ jobs:
with: with:
node-version: ${{ matrix.node_version }} node-version: ${{ matrix.node_version }}
- name: restore lock files - name: restore lerna
uses: actions/cache@master # must use unreleased master to cache multiple paths
id: cache id: cache
uses: actions/cache@v2
with: with:
# must be done before bootstrap to not include node_modules files in the cache paths
path: | path: |
package-lock.json node_modules
packages/*/package-lock.json */*/node_modules
benchmark/*/package-lock.json key: unittest-${{ runner.os }}-${{ matrix.node_version }}-${{ hashFiles('**/package.json') }}
backwards-compatability/*/package-lock.json
metapackages/*/package-lock.json - name: Bootstrap
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) 🔧
if: steps.cache.outputs.cache-hit != 'true' if: steps.cache.outputs.cache-hit != 'true'
run: | run: |
npm install --ignore-scripts npm install --ignore-scripts
npx lerna bootstrap --no-ci --hoist --nohoist='zone.js' npx lerna bootstrap --no-ci --hoist --nohoist='zone.js'
npm run compile
- name: Install and Build (cache hit) 🔧 - name: Build 🔧
if: steps.cache.outputs.cache-hit == 'true' run: npm run compile
run: |
npm ci --ignore-scripts
npx lerna bootstrap --hoist --nohoist='zone.js'
npm run compile
- name: Unit tests - name: Unit tests
run: npm run test run: npm run test
@ -66,35 +56,24 @@ jobs:
uses: actions/checkout@v1 uses: actions/checkout@v1
- name: Permission Setup - name: Permission Setup
run: sudo chmod -R 777 /github /__w 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 id: cache
with: with:
# must be done before bootstrap to not include node_modules files in the cache paths
path: | path: |
package-lock.json node_modules
packages/*/package-lock.json */*/node_modules
benchmark/*/package-lock.json key: unittest-${{ runner.os }}-${{ matrix.node_version }}-${{ hashFiles('**/package.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') }}
- name: Install and Build (cache miss) 🔧 - name: Bootstrap
if: steps.cache.outputs.cache-hit != 'true' if: steps.cache.outputs.cache-hit != 'true'
run: | run: |
npm install --ignore-scripts npm install --ignore-scripts
npx lerna bootstrap --no-ci --hoist --nohoist='zone.js' 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 - name: Unit tests
run: npm run test:browser run: npm run test:browser
- name: Report Coverage - name: Report Coverage