diff --git a/.circleci/config.yml b/.circleci/config.yml index 418481eb329c..51f62baf50bb 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -252,16 +252,6 @@ workflows: - /^Version-v(\d+)[.](\d+)[.](\d+)/ requires: - prep-build - - test-unit-jest-main: - requires: - - prep-deps - - test-unit-jest-development: - requires: - - prep-deps - - upload-coverage: - requires: - - test-unit-jest-main - - test-unit-jest-development - test-unit-global: requires: - prep-deps @@ -305,10 +295,7 @@ workflows: - test-lint-shellcheck - test-lint-lockfile - test-lint-changelog - - test-unit-jest-main - - test-unit-jest-development - test-unit-global - - upload-coverage - validate-source-maps - validate-source-maps-beta - validate-source-maps-flask @@ -1630,9 +1617,6 @@ jobs: path: builds-test - store_artifacts: path: builds-test-flask - - store_artifacts: - path: coverage - destination: coverage - store_artifacts: path: test-artifacts destination: test-artifacts @@ -1713,54 +1697,6 @@ jobs: git config user.email metamaskbot@users.noreply.github.com yarn ts-migration:dashboard:deploy - test-unit-jest-development: - executor: node-browsers-small - steps: - - run: *shallow-git-clone - - run: sudo corepack enable - - attach_workspace: - at: . - - run: - name: jest development unit tests - command: yarn test:coverage:jest:dev - - persist_to_workspace: - root: . - paths: - - coverage - - store_test_results: - path: test/test-results/junit.xml - - test-unit-jest-main: - executor: node-browsers-medium-plus - parallelism: 8 - steps: - - run: *shallow-git-clone - - run: sudo corepack enable - - attach_workspace: - at: . - - run: - name: test:coverage:jest - command: yarn test:coverage:jest - - persist_to_workspace: - root: . - paths: - - coverage - - store_test_results: - path: test/test-results/junit.xml - - upload-coverage: - executor: node-browsers-small - steps: - - run: *shallow-git-clone - - run: sudo corepack enable - - attach_workspace: - at: . - - codecov/upload - - persist_to_workspace: - root: . - paths: - - coverage - test-unit-global: executor: node-browsers-small steps: diff --git a/.github/actions/setup-environment/action.yml b/.github/actions/setup-environment/action.yml new file mode 100644 index 000000000000..8bdd0ba24c64 --- /dev/null +++ b/.github/actions/setup-environment/action.yml @@ -0,0 +1,17 @@ +name: 'Setup environment' +description: 'Setup environment' +runs: + using: 'composite' + steps: + - run: corepack enable + shell: bash + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version-file: '.nvmrc' + cache: yarn + + - name: Install dependencies + run: yarn --immutable + shell: bash diff --git a/.github/workflows/run-unit-tests.yml b/.github/workflows/run-unit-tests.yml new file mode 100644 index 000000000000..6b0d0958471b --- /dev/null +++ b/.github/workflows/run-unit-tests.yml @@ -0,0 +1,32 @@ +# WARNING! It is currently being investigated how to make this faster +# DO NOT blindly copy this workflow, not noticing the slow down, +# because suddenly our tests will take hours to pass CI. +# Hopefully this comment here will help prevent that. +# https://github.com/MetaMask/metamask-extension/issues/25680 + +name: Run unit tests + +on: + pull_request: + types: [opened,reopened,synchronize] + +jobs: + test-unit-jest: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup environment + uses: ./.github/actions/setup-environment + + - name: test:coverage:jest:dev + run: yarn test:coverage:jest:dev + + - name: test:coverage:jest + run: yarn test:coverage:jest + + - uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 + with: + token: ${{ secrets.CODECOV_TOKEN }} + fail_ci_if_error: true