From 6a213fb4f48e85d6a8111089d98efae60b20ef0d Mon Sep 17 00:00:00 2001 From: Maarten Zuidhoorn Date: Wed, 26 Mar 2025 13:57:16 +0100 Subject: [PATCH 1/2] Use `MetaMask/action-retry-command` for possible flaky steps --- .github/workflows/build-lint-test.yml | 23 +++++++++++++++++------ .github/workflows/main.yml | 14 -------------- .github/workflows/re-run.yml | 22 ---------------------- 3 files changed, 17 insertions(+), 42 deletions(-) delete mode 100644 .github/workflows/re-run.yml diff --git a/.github/workflows/build-lint-test.yml b/.github/workflows/build-lint-test.yml index 0e8f3ddde2..df8ba89ed5 100644 --- a/.github/workflows/build-lint-test.yml +++ b/.github/workflows/build-lint-test.yml @@ -190,8 +190,13 @@ jobs: name: build-source-${{ runner.os }}-${{ github.sha }} - name: Install Google Chrome if: ${{ matrix.package-name == '@metamask/snaps-controllers' || matrix.package-name == '@metamask/snaps-execution-environments' || matrix.package-name == '@metamask/snaps-utils' }} - run: yarn install-chrome - - run: yarn workspace ${{ matrix.package-name }} run test + uses: MetaMask/action-retry-command@v1 + with: + command: yarn install-chrome + - name: Run tests + uses: MetaMask/action-retry-command@v1 + with: + command: yarn workspace ${{ matrix.package-name }} run test - name: Get coverage folder id: get-coverage-folder run: | @@ -260,8 +265,10 @@ jobs: name: build-source-${{ runner.os }}-${{ github.sha }} - name: Build snap run: yarn workspace ${{ matrix.package-name }} run build - - name: Run E2E test - run: yarn workspace ${{ matrix.package-name }} run test + - name: Run E2E tests + uses: MetaMask/action-retry-command@v1 + with: + command: yarn workspace ${{ matrix.package-name }} run test:e2e - name: Require clean working directory shell: bash run: | @@ -282,5 +289,9 @@ jobs: uses: MetaMask/action-checkout-and-setup@v1 with: is-high-risk-environment: false - - run: yarn build:ci - - run: yarn workspace @metamask/snaps-cli run test + - name: Build dependencies + run: yarn build:ci + - name: Run tests + uses: MetaMask/action-retry-command@v1 + with: + command: yarn workspace @metamask/snaps-cli run test diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 27b711d263..b886bb3788 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -117,17 +117,3 @@ jobs: if [[ $passed != "true" ]]; then exit 1 fi - - re-run: - name: Re-run failed jobs - needs: lint-build-test - if: failure() && fromJSON(github.run_attempt) < 3 && github.event.pull_request.user.login != 'dependabot[bot]' && github.event_name != 'merge_group' - runs-on: ubuntu-latest - permissions: - actions: write - steps: - - env: - GH_REPO: ${{ github.repository }} - GH_TOKEN: ${{ github.token }} - GH_DEBUG: api - run: gh workflow run re-run.yml -F run-id=${{ github.run_id }} diff --git a/.github/workflows/re-run.yml b/.github/workflows/re-run.yml deleted file mode 100644 index fab20184ee..0000000000 --- a/.github/workflows/re-run.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: Re-run failed jobs - -on: - workflow_dispatch: - inputs: - run-id: - required: true - -jobs: - re-run: - name: Re-run failed jobs (${{ inputs.run-id }}) - runs-on: ubuntu-latest - permissions: - actions: write - steps: - - name: Re-run ${{ inputs.run-id }} - env: - GH_REPO: ${{ github.repository }} - GH_TOKEN: ${{ github.token }} - run: | - gh run watch ${{ inputs.run-id }} > /dev/null 2>&1 - gh run rerun ${{ inputs.run-id }} --failed From 260c51a4c44619144b1b33752388869e8bbddc39 Mon Sep 17 00:00:00 2001 From: Maarten Zuidhoorn Date: Wed, 26 Mar 2025 14:04:44 +0100 Subject: [PATCH 2/2] Fix E2E test script --- .github/workflows/build-lint-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-lint-test.yml b/.github/workflows/build-lint-test.yml index df8ba89ed5..eb89dec8e2 100644 --- a/.github/workflows/build-lint-test.yml +++ b/.github/workflows/build-lint-test.yml @@ -268,7 +268,7 @@ jobs: - name: Run E2E tests uses: MetaMask/action-retry-command@v1 with: - command: yarn workspace ${{ matrix.package-name }} run test:e2e + command: yarn workspace ${{ matrix.package-name }} run test - name: Require clean working directory shell: bash run: |