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:
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

View File

@ -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