From 820a546f020c0fc52f02f4a5eda1c1e8eb658de1 Mon Sep 17 00:00:00 2001 From: Daniel Sinclair <4412473+DanielSinclair@users.noreply.github.com> Date: Mon, 26 Aug 2024 13:15:39 -0400 Subject: [PATCH] chore: ci upgrade for node v20 (#1674) --- .github/actions/testsSetup/action.yml | 10 +-- .github/workflows/build.yml | 96 +++++++++++----------- .github/workflows/publish-internal.yml | 10 +-- .github/workflows/publish-prod-chrome.yml | 10 +-- .github/workflows/publish-prod-firefox.yml | 10 +-- .github/workflows/rebase.yml | 2 +- .nvmrc | 2 +- README.md | 2 +- README_FIREFOX.md | 6 +- package.json | 3 + src/test/setup.ts | 4 - 11 files changed, 76 insertions(+), 79 deletions(-) diff --git a/.github/actions/testsSetup/action.yml b/.github/actions/testsSetup/action.yml index 9fb418eafd..3669ea171b 100644 --- a/.github/actions/testsSetup/action.yml +++ b/.github/actions/testsSetup/action.yml @@ -8,18 +8,18 @@ inputs: runs: using: 'composite' steps: - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 with: - node-version: "18.18.0" + node-version: "20.16.0" - name: Download deps cache artifacts - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: node_modules.tar.gz - name: Unzip node_modules shell: 'bash' run: tar xzf node_modules.tar.gz - name: Download build artifacts - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: rainbowbx-${{ github.sha }} path: build @@ -33,7 +33,7 @@ runs: uses: foundry-rs/foundry-toolchain@v1 with: version: nightly - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: repository: 'rainbow-me/browser-extension-env' token: ${{ inputs.gh-access-token }} diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7090ea571d..a29bd07192 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,10 +16,10 @@ jobs: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 with: - node-version: "18.18.0" + node-version: "20.16.0" cache: 'yarn' - name: Install deps via Yarn run: yarn setup @@ -28,7 +28,7 @@ jobs: - name: Zip node_modules run: tar czf node_modules.tar.gz node_modules/ - name: Upload deps artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: node_modules.tar.gz path: node_modules.tar.gz @@ -38,17 +38,17 @@ jobs: runs-on: ubuntu-latest needs: [install] steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 with: - node-version: "18.18.0" + node-version: "20.16.0" - name: Download deps cache artifacts - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: node_modules.tar.gz - name: Unzip node_modules run: tar xzf node_modules.tar.gz - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: repository: 'rainbow-me/browser-extension-env' token: ${{ secrets.DOTENV_GITHUB_ACCESS_TOKEN }} @@ -63,7 +63,7 @@ jobs: - name: Build the extension run: yarn build:webpack - name: Upload artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: rainbowbx-${{ github.sha }} path: build/ @@ -78,7 +78,7 @@ jobs: # DISPLAY: :0 # VITEST_SEGFAULT_RETRY: 4 # steps: - # - uses: actions/checkout@v3 + # - uses: actions/checkout@v4 # - uses: ./.github/actions/firefoxTestsSetup # with: # gh-access-token: ${{ secrets.DOTENV_GITHUB_ACCESS_TOKEN }} @@ -93,7 +93,7 @@ jobs: # yarn vitest:parallel # - name: Upload deps artifacts # if: steps.FFE2eParallel.outcome == 'failure' - # uses: actions/upload-artifact@v3 + # uses: actions/upload-artifact@v4 # with: # name: screenshots # path: screenshots/ @@ -108,7 +108,7 @@ jobs: # DISPLAY: :0 # VITEST_SEGFAULT_RETRY: 4 # steps: - # - uses: actions/checkout@v3 + # - uses: actions/checkout@v4 # - uses: ./.github/actions/firefoxTestsSetup # with: # gh-access-token: ${{ secrets.DOTENV_GITHUB_ACCESS_TOKEN }} @@ -123,7 +123,7 @@ jobs: # yarn vitest:swap # - name: Upload deps artifacts # if: steps.FFE2eSwap.outcome == 'failure' - # uses: actions/upload-artifact@v3 + # uses: actions/upload-artifact@v4 # with: # name: screenshots # path: screenshots/ @@ -138,7 +138,7 @@ jobs: # DISPLAY: :0 # VITEST_SEGFAULT_RETRY: 4 # steps: - # - uses: actions/checkout@v3 + # - uses: actions/checkout@v4 # - uses: ./.github/actions/firefoxTestsSetup # with: # gh-access-token: ${{ secrets.DOTENV_GITHUB_ACCESS_TOKEN }} @@ -153,7 +153,7 @@ jobs: # yarn vitest:send # - name: Upload deps artifacts # if: steps.FFE2eSend.outcome == 'failure' - # uses: actions/upload-artifact@v3 + # uses: actions/upload-artifact@v4 # with: # name: screenshots # path: screenshots/ @@ -168,7 +168,7 @@ jobs: # DISPLAY: :0 # VITEST_SEGFAULT_RETRY: 4 # steps: - # - uses: actions/checkout@v3 + # - uses: actions/checkout@v4 # - uses: ./.github/actions/firefoxTestsSetup # with: # gh-access-token: ${{ secrets.DOTENV_GITHUB_ACCESS_TOKEN }} @@ -183,7 +183,7 @@ jobs: # yarn vitest:dappInteractions # - name: Upload deps artifacts # if: steps.FFE2eDappInteractions.outcome == 'failure' - # uses: actions/upload-artifact@v3 + # uses: actions/upload-artifact@v4 # with: # name: screenshots # path: screenshots/ @@ -199,7 +199,7 @@ jobs: DISPLAY: :0 VITEST_SEGFAULT_RETRY: 4 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: ./.github/actions/chromeTestsSetup with: gh-access-token: ${{ secrets.DOTENV_GITHUB_ACCESS_TOKEN }} @@ -213,7 +213,7 @@ jobs: yarn vitest:parallel - name: Upload deps artifacts if: steps.ChromeE2EParallel.outcome == 'failure' - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: screenshots path: screenshots/ @@ -228,7 +228,7 @@ jobs: DISPLAY: :0 VITEST_SEGFAULT_RETRY: 3 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: ./.github/actions/chromeTestsSetup with: gh-access-token: ${{ secrets.DOTENV_GITHUB_ACCESS_TOKEN }} @@ -242,7 +242,7 @@ jobs: yarn vitest:swap - name: Upload deps artifacts if: steps.ChromeE2ESwaps.outcome == 'failure' - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: screenshots path: screenshots/ @@ -257,7 +257,7 @@ jobs: DISPLAY: :0 VITEST_SEGFAULT_RETRY: 3 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: ./.github/actions/chromeTestsSetup with: gh-access-token: ${{ secrets.DOTENV_GITHUB_ACCESS_TOKEN }} @@ -271,7 +271,7 @@ jobs: yarn vitest:send - name: Upload deps artifacts if: steps.ChromeE2ESend.outcome == 'failure' - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: screenshots path: screenshots/ @@ -286,7 +286,7 @@ jobs: DISPLAY: :0 VITEST_SEGFAULT_RETRY: 3 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: ./.github/actions/chromeTestsSetup with: gh-access-token: ${{ secrets.DOTENV_GITHUB_ACCESS_TOKEN }} @@ -300,7 +300,7 @@ jobs: yarn vitest:send:optimism - name: Upload deps artifacts if: steps.ChromeOpE2ESend.outcome == 'failure' - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: screenshots path: screenshots/ @@ -315,7 +315,7 @@ jobs: DISPLAY: :0 VITEST_SEGFAULT_RETRY: 3 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: ./.github/actions/chromeTestsSetup with: gh-access-token: ${{ secrets.DOTENV_GITHUB_ACCESS_TOKEN }} @@ -329,7 +329,7 @@ jobs: yarn vitest:dappInteractions - name: Upload deps artifacts if: steps.ChromeE2EDappInteractions.outcome == 'failure' - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: screenshots path: screenshots/ @@ -345,18 +345,18 @@ jobs: # DISPLAY: :0 # VITEST_SEGFAULT_RETRY: 3 # steps: - # - uses: actions/checkout@v3 - # - uses: actions/setup-node@v3 + # - uses: actions/checkout@v4 + # - uses: actions/setup-node@v4 # with: - # node-version: "18.18.0" + # node-version: "20.16.0" # - name: Download deps cache artifacts - # uses: actions/download-artifact@v3 + # uses: actions/download-artifact@v4 # with: # name: node_modules.tar.gz # - name: Unzip node_modules # run: tar xzvf node_modules.tar.gz # - name: Download build artifacts - # uses: actions/download-artifact@v3 + # uses: actions/download-artifact@v4 # with: # name: rainbowbx-${{ github.sha }} # path: build @@ -376,7 +376,7 @@ jobs: # uses: foundry-rs/foundry-toolchain@v1 # with: # version: nightly - # - uses: actions/checkout@v3 + # - uses: actions/checkout@v4 # with: # repository: 'rainbow-me/browser-extension-env' # token: ${{ secrets.DOTENV_GITHUB_ACCESS_TOKEN }} @@ -394,30 +394,28 @@ jobs: runs-on: ubuntu-latest needs: [install] steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 with: - node-version: "18.18.0" + node-version: "20.16.0" - name: Download deps cache artifacts - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: node_modules.tar.gz - name: Unzip node_modules run: tar xzf node_modules.tar.gz - name: Install rust - uses: actions-rs/toolchain@v1 + uses: moonrepo/setup-rust@v1.2.1 with: - toolchain: stable - target: wasm32-unknown-unknown + channel: stable profile: minimal - override: true - name: Fetch networks run: yarn fetch:networks - name: Install Anvil uses: foundry-rs/foundry-toolchain@v1 with: version: nightly - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: repository: 'rainbow-me/browser-extension-env' token: ${{ secrets.DOTENV_GITHUB_ACCESS_TOKEN }} @@ -435,12 +433,12 @@ jobs: runs-on: ubuntu-latest needs: [install] steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 with: - node-version: "18.18.0" + node-version: "20.16.0" - name: Download deps cache artifacts - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: node_modules.tar.gz - name: Unzip node_modules @@ -459,9 +457,9 @@ jobs: runs-on: ubuntu-latest needs: [chrome-e2e-parallel, chrome-e2e-swap, chrome-e2e-send, chrome-e2e-dappInteractions, chrome-optimism-e2e-send, unit-tests, ci-checks] steps: - - uses: geekyeggo/delete-artifact@v2 + - uses: geekyeggo/delete-artifact@v5 with: name: node_modules.tar.gz - - uses: geekyeggo/delete-artifact@v2 + - uses: geekyeggo/delete-artifact@v5 with: name: screenshots diff --git a/.github/workflows/publish-internal.yml b/.github/workflows/publish-internal.yml index 69fecf61b0..c98852fd61 100644 --- a/.github/workflows/publish-internal.yml +++ b/.github/workflows/publish-internal.yml @@ -12,7 +12,7 @@ jobs: concurrency: group: ${{ github.workflow }}-${{ github.ref }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: repository: ${{ github.event.pull_request.head.repo.full_name }} ref: ${{ github.event.pull_request.head.ref }} @@ -24,13 +24,13 @@ jobs: echo "No new commits. Canceling publish..." exit 1 fi - - uses: actions/setup-node@v2 + - uses: actions/setup-node@v4 with: - node-version: "18.18.0" + node-version: "20.16.0" cache: 'yarn' - name: Install deps via Yarn run: yarn setup - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: repository: 'rainbow-me/browser-extension-env' token: ${{ secrets.DOTENV_GITHUB_ACCESS_TOKEN }} @@ -50,7 +50,7 @@ jobs: - name: Zip it run: yarn zip - name: Archive the build artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: rainbowbx-v${{ env.release_version }} path: build/ diff --git a/.github/workflows/publish-prod-chrome.yml b/.github/workflows/publish-prod-chrome.yml index bc29228155..8b8846c4ca 100644 --- a/.github/workflows/publish-prod-chrome.yml +++ b/.github/workflows/publish-prod-chrome.yml @@ -9,18 +9,18 @@ jobs: concurrency: group: ${{ github.workflow }}-${{ github.ref }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: repository: ${{ github.event.pull_request.head.repo.full_name }} ref: ${{ github.event.pull_request.head.ref }} token: ${{ secrets.REPO_TOKEN }} - - uses: actions/setup-node@v2 + - uses: actions/setup-node@v4 with: - node-version: "18.18.0" + node-version: "20.16.0" cache: 'yarn' - name: Install deps via Yarn run: yarn setup - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: repository: 'rainbow-me/browser-extension-env' token: ${{ secrets.DOTENV_GITHUB_ACCESS_TOKEN }} @@ -34,7 +34,7 @@ jobs: - name: Update the manifest run: yarn update-manifest prod - name: Archive the build artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: rainbowbx-chrome-v${{ env.release_version }} path: build/ diff --git a/.github/workflows/publish-prod-firefox.yml b/.github/workflows/publish-prod-firefox.yml index e0bb93c26c..b876399a17 100644 --- a/.github/workflows/publish-prod-firefox.yml +++ b/.github/workflows/publish-prod-firefox.yml @@ -9,18 +9,18 @@ jobs: concurrency: group: ${{ github.workflow }}-${{ github.ref }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: repository: ${{ github.event.pull_request.head.repo.full_name }} ref: ${{ github.event.pull_request.head.ref }} token: ${{ secrets.REPO_TOKEN }} - - uses: actions/setup-node@v2 + - uses: actions/setup-node@v4 with: - node-version: "18.18.0" + node-version: "20.16.0" cache: 'yarn' - name: Install deps via Yarn run: yarn setup - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: repository: 'rainbow-me/browser-extension-env' token: ${{ secrets.DOTENV_GITHUB_ACCESS_TOKEN }} @@ -34,7 +34,7 @@ jobs: - name: Update the manifest run: yarn update-manifest prod - name: Archive the build artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: rainbowbx-firefox-v${{ env.release_version }} path: build/ diff --git a/.github/workflows/rebase.yml b/.github/workflows/rebase.yml index 80829a3475..12d8ad582f 100644 --- a/.github/workflows/rebase.yml +++ b/.github/workflows/rebase.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout the latest code - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: token: ${{ secrets.GITHUB_TOKEN }} fetch-depth: 0 # otherwise, you will fail to push refs to dest repo diff --git a/.nvmrc b/.nvmrc index b714151ef9..b427e2ae2f 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -v18.18.0 \ No newline at end of file +v20.16.0 \ No newline at end of file diff --git a/README.md b/README.md index ed245f6adb..dc82825506 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,7 @@ Additionally, we're using some well known tools engineered by the MetaMask team: ### 1. Set up Node -Use node v18 or if you use nvm follow the instructions below +Use node v20 or if you use nvm follow the instructions below ```bash nvm install diff --git a/README_FIREFOX.md b/README_FIREFOX.md index 17c8443e55..d1e29fc012 100644 --- a/README_FIREFOX.md +++ b/README_FIREFOX.md @@ -9,12 +9,12 @@ ### 1. Set up Node -Use node v18 (18.18) or if you use nvm follow the instructions below +Use node v20 (20.16.0) or if you use nvm follow the instructions below ```bash -nvm install 18.18 +nvm install 20.16.0 # or -nvm use 18.18 +nvm use 20.16.0 ``` ### 2. Install project dependencies diff --git a/package.json b/package.json index 7044267ca4..d055adf931 100644 --- a/package.json +++ b/package.json @@ -76,6 +76,9 @@ "firefox:lint": "yarn web-ext lint --source-dir ./build", "firefox:run": "yarn web-ext run --source-dir ./build/ -f='/Applications/Firefox Developer Edition.app/Contents/MacOS/firefox'" }, + "engines": { + "node": ">=20.16.0" + }, "dependencies": { "@capsizecss/core": "3.0.0", "@ethereumjs/tx": "5.0.0", diff --git a/src/test/setup.ts b/src/test/setup.ts index 4b96a93985..4c8cff7434 100644 --- a/src/test/setup.ts +++ b/src/test/setup.ts @@ -1,4 +1,3 @@ -import { Crypto } from '@peculiar/webcrypto'; import { rest } from 'msw'; import { setupServer } from 'msw/node'; import { afterAll, afterEach, beforeAll, vi } from 'vitest'; @@ -25,9 +24,6 @@ vi.stubGlobal('window.location', { pathname: 'popup.html', }); -// @ts-ignore -global.crypto = new Crypto(); - const abortFn = vi.fn(); // @ts-ignore