From 286fc1f3814134414c3354b76474d488c9090a58 Mon Sep 17 00:00:00 2001 From: Nazar Hussain Date: Wed, 27 Sep 2023 17:00:49 +0200 Subject: [PATCH 1/4] Update the github workflow to work with multiple events --- .github/workflows/test.yml | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 37b4f6b8e554..eb31066c1b28 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,7 @@ 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 }} - name: Assert yarn prints no warnings run: scripts/assert_no_yarn_warnings.sh - name: Lint Code @@ -109,11 +113,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 +134,7 @@ 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 }} - name: Check Types run: yarn check-types @@ -159,7 +167,7 @@ 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 }} # Cache validator slashing protection data tests - name: Restore spec tests cache uses: actions/cache@master @@ -198,7 +206,7 @@ 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: Run the e2e test environment run: scripts/run_e2e_env.sh start @@ -244,7 +252,7 @@ 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: Browser tests run: | From 72c505be0e704c9b41be6b9b0eb4911f3dd5e3fe Mon Sep 17 00:00:00 2001 From: Nazar Hussain Date: Wed, 27 Sep 2023 17:16:35 +0200 Subject: [PATCH 2/4] Fix the commit hash --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index eb31066c1b28..e2cda19f2c1f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -285,7 +285,7 @@ jobs: lib/ packages/*/lib packages/*/.git-data.json - key: ${{ runner.os }}-${{ matrix.node }}-${{ github.event.pull_request.head.sha }} + key: ${{ runner.os }}-${{ matrix.node }}-${{ github.sha }} # Download spec tests with cache - name: Restore spec tests cache uses: actions/cache@master From ba981f100963096769fd59b1f8b0ef123e343942 Mon Sep 17 00:00:00 2001 From: Nazar Hussain Date: Wed, 27 Sep 2023 17:39:05 +0200 Subject: [PATCH 3/4] Add restore build cache failure check --- .github/workflows/test.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e2cda19f2c1f..5851b23dded4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -98,6 +98,7 @@ jobs: packages/*/lib packages/*/.git-data.json 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 @@ -135,6 +136,7 @@ jobs: packages/*/lib packages/*/.git-data.json key: ${{ runner.os }}-node-${{ matrix.node }}-${{ github.sha }} + fail-on-cache-miss: true - name: Check Types run: yarn check-types @@ -168,6 +170,8 @@ jobs: packages/*/lib packages/*/.git-data.json 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 @@ -207,6 +211,7 @@ jobs: packages/*/lib packages/*/.git-data.json 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 @@ -253,6 +258,7 @@ jobs: packages/*/lib packages/*/.git-data.json key: ${{ runner.os }}-node-${{ matrix.node }}-${{ github.sha }} + fail-on-cache-miss: true - name: Browser tests run: | @@ -285,7 +291,9 @@ jobs: lib/ packages/*/lib packages/*/.git-data.json - key: ${{ runner.os }}-${{ matrix.node }}-${{ github.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 From 6289a04f97fd3c5fcd42f3ca729fbc4bd6e6c656 Mon Sep 17 00:00:00 2001 From: Nazar Hussain Date: Wed, 27 Sep 2023 17:49:02 +0200 Subject: [PATCH 4/4] Remove --no-bail to avoid silent failures --- package.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) 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",