Skip to content

Commit

Permalink
fix: update the github workflow to work with multiple events (#6005)
Browse files Browse the repository at this point in the history
* Update the github workflow to work with multiple events

* Fix the commit hash

* Add restore build cache failure check

* Remove --no-bail to avoid silent failures
  • Loading branch information
nazarhussain authored Sep 27, 2023
1 parent 6a12f73 commit 4557276
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 18 deletions.
38 changes: 27 additions & 11 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ jobs:
lib/
packages/*/lib
packages/*/.git-data.json
key: ${{ runner.os }}-${{ matrix.node }}-${{ github.event.pull_request.head.sha }}
key: ${{ runner.os }}-node-${{ matrix.node }}-${{ github.sha }}
- name: Install & build
if: steps.cache-build-restore.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile && yarn build
- name: Build
run: yarn build
if: steps.cache-build-restore.outputs.cache-hit == 'true'
run: yarn build
- name: Check Build
run: yarn check-build
- name: Test root binary exists
Expand All @@ -70,17 +70,21 @@ jobs:
lib/
packages/*/lib
packages/*/.git-data.json
key: ${{ runner.os }}-${{ matrix.node }}-${{ github.event.pull_request.head.sha }}
key: ${{ runner.os }}-node-${{ matrix.node }}-${{ github.sha }}

lint:
name: Lint
needs: build
runs-on: 'ubuntu-latest'
strategy:
fail-fast: false
matrix:
node: [20]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 20
node-version: ${{ matrix.node }}
check-latest: true
cache: yarn
- name: Restore build cache
Expand All @@ -93,7 +97,8 @@ jobs:
lib/
packages/*/lib
packages/*/.git-data.json
key: ${{ runner.os }}-20-${{ github.event.pull_request.head.sha }}
key: ${{ runner.os }}-node-${{ matrix.node }}-${{ github.sha }}
fail-on-cache-miss: true
- name: Assert yarn prints no warnings
run: scripts/assert_no_yarn_warnings.sh
- name: Lint Code
Expand All @@ -109,11 +114,15 @@ jobs:
name: Type Checks
needs: build
runs-on: 'ubuntu-latest'
strategy:
fail-fast: false
matrix:
node: [20]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 20
node-version: ${{ matrix.node }}
check-latest: true
cache: yarn
- name: Restore build cache
Expand All @@ -126,7 +135,8 @@ jobs:
lib/
packages/*/lib
packages/*/.git-data.json
key: ${{ runner.os }}-20-${{ github.event.pull_request.head.sha }}
key: ${{ runner.os }}-node-${{ matrix.node }}-${{ github.sha }}
fail-on-cache-miss: true

- name: Check Types
run: yarn check-types
Expand Down Expand Up @@ -159,7 +169,9 @@ jobs:
lib/
packages/*/lib
packages/*/.git-data.json
key: ${{ runner.os }}-${{ matrix.node }}-${{ github.event.pull_request.head.sha }}
key: ${{ runner.os }}-node-${{ matrix.node }}-${{ github.sha }}
fail-on-cache-miss: true

# Cache validator slashing protection data tests
- name: Restore spec tests cache
uses: actions/cache@master
Expand Down Expand Up @@ -198,7 +210,8 @@ jobs:
lib/
packages/*/lib
packages/*/.git-data.json
key: ${{ runner.os }}-${{ matrix.node }}-${{ github.event.pull_request.head.sha }}
key: ${{ runner.os }}-node-${{ matrix.node }}-${{ github.sha }}
fail-on-cache-miss: true

- name: Run the e2e test environment
run: scripts/run_e2e_env.sh start
Expand Down Expand Up @@ -244,7 +257,8 @@ jobs:
lib/
packages/*/lib
packages/*/.git-data.json
key: ${{ runner.os }}-${{ matrix.node }}-${{ github.event.pull_request.head.sha }}
key: ${{ runner.os }}-node-${{ matrix.node }}-${{ github.sha }}
fail-on-cache-miss: true

- name: Browser tests
run: |
Expand Down Expand Up @@ -277,7 +291,9 @@ jobs:
lib/
packages/*/lib
packages/*/.git-data.json
key: ${{ runner.os }}-${{ matrix.node }}-${{ github.event.pull_request.head.sha }}
key: ${{ runner.os }}-node-${{ matrix.node }}-${{ github.sha }}
fail-on-cache-miss: true

# Download spec tests with cache
- name: Restore spec tests cache
uses: actions/cache@master
Expand Down
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@
"lint-dashboards": "scripts/validate-grafana-dashboards.sh",
"check-build": "lerna run check-build",
"check-readme": "lerna run check-readme",
"check-types": "lerna run check-types --no-bail",
"coverage": "lerna run coverage --no-bail",
"test": "lerna run test --no-bail --concurrency 1",
"test:unit": "lerna run test:unit --no-bail --concurrency 1",
"check-types": "lerna run check-types",
"coverage": "lerna run coverage",
"test": "lerna run test --concurrency 1",
"test:unit": "lerna run test:unit --concurrency 1",
"test:browsers": "lerna run test:browsers",
"test:e2e": "lerna run test:e2e --no-bail --concurrency 1",
"test:e2e:sim": "lerna run test:e2e:sim --no-bail",
"test:spec": "lerna run test:spec --no-bail",
"test:e2e": "lerna run test:e2e --concurrency 1",
"test:e2e:sim": "lerna run test:e2e:sim",
"test:spec": "lerna run test:spec",
"test-coverage:unit": "c8 --config .c8rc.json --report-dir coverage/unit/ --all npm run test:unit",
"test-coverage:browsers": "c8 --config .c8rc.json --report-dir coverage/browsers/ --all npm run test:browsers",
"test-coverage:e2e": "c8 --config .c8rc.json --report-dir coverage/e2e/ --all npm run test:e2e",
Expand Down

0 comments on commit 4557276

Please sign in to comment.