From 4557276c526c7a9e3c8d9273d5b678c9a6123cd8 Mon Sep 17 00:00:00 2001 From: Nazar Hussain Date: Wed, 27 Sep 2023 18:57:36 +0200 Subject: [PATCH] fix: update the github workflow to work with multiple events (#6005) * 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 --- .github/workflows/test.yml | 38 +++++++++++++++++++++++++++----------- package.json | 14 +++++++------- 2 files changed, 34 insertions(+), 18 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 37b4f6b8e554..5851b23dded4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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: | @@ -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 diff --git a/package.json b/package.json index 191b215c695d..06afdc19bb99 100644 --- a/package.json +++ b/package.json @@ -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",