Skip to content

Commit 2050886

Browse files
authored
feat: move unit tests from Circleci to Github actions (#25570)
<!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** <!-- Write a short description of the changes included in this pull request, also include relevant motivation and context. Have in mind the following questions: 1. What is the reason for the change? 2. What is the improvement/solution? --> [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/25570?quickstart=1) This PR moves unit tests from Circleci to Github actions. This is needed to pass the Jest export to SonarCloud in order finalize the SonarCloud integration. The reason why we want to use Github action rather than Circleci is because Sonarcloud integration happens in a Github action and we cannot pass data (i.e. the artifact) from Circleci to Github action. ## **Related issues** Fixes: MetaMask/MetaMask-planning#2449 ## **Manual testing steps** 1. Seeing unit tests pass in GitHub actions instead of Circleci ## **Screenshots/Recordings** Not applicable ## **Pre-merge author checklist** - [x] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [x] I’ve included tests if applicable - [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.
1 parent f9f0c73 commit 2050886

File tree

3 files changed

+49
-64
lines changed

3 files changed

+49
-64
lines changed

.circleci/config.yml

-64
Original file line numberDiff line numberDiff line change
@@ -252,16 +252,6 @@ workflows:
252252
- /^Version-v(\d+)[.](\d+)[.](\d+)/
253253
requires:
254254
- prep-build
255-
- test-unit-jest-main:
256-
requires:
257-
- prep-deps
258-
- test-unit-jest-development:
259-
requires:
260-
- prep-deps
261-
- upload-coverage:
262-
requires:
263-
- test-unit-jest-main
264-
- test-unit-jest-development
265255
- test-unit-global:
266256
requires:
267257
- prep-deps
@@ -305,10 +295,7 @@ workflows:
305295
- test-lint-shellcheck
306296
- test-lint-lockfile
307297
- test-lint-changelog
308-
- test-unit-jest-main
309-
- test-unit-jest-development
310298
- test-unit-global
311-
- upload-coverage
312299
- validate-source-maps
313300
- validate-source-maps-beta
314301
- validate-source-maps-flask
@@ -1630,9 +1617,6 @@ jobs:
16301617
path: builds-test
16311618
- store_artifacts:
16321619
path: builds-test-flask
1633-
- store_artifacts:
1634-
path: coverage
1635-
destination: coverage
16361620
- store_artifacts:
16371621
path: test-artifacts
16381622
destination: test-artifacts
@@ -1713,54 +1697,6 @@ jobs:
17131697
git config user.email metamaskbot@users.noreply.github.com
17141698
yarn ts-migration:dashboard:deploy
17151699
1716-
test-unit-jest-development:
1717-
executor: node-browsers-small
1718-
steps:
1719-
- run: *shallow-git-clone
1720-
- run: sudo corepack enable
1721-
- attach_workspace:
1722-
at: .
1723-
- run:
1724-
name: jest development unit tests
1725-
command: yarn test:coverage:jest:dev
1726-
- persist_to_workspace:
1727-
root: .
1728-
paths:
1729-
- coverage
1730-
- store_test_results:
1731-
path: test/test-results/junit.xml
1732-
1733-
test-unit-jest-main:
1734-
executor: node-browsers-medium-plus
1735-
parallelism: 8
1736-
steps:
1737-
- run: *shallow-git-clone
1738-
- run: sudo corepack enable
1739-
- attach_workspace:
1740-
at: .
1741-
- run:
1742-
name: test:coverage:jest
1743-
command: yarn test:coverage:jest
1744-
- persist_to_workspace:
1745-
root: .
1746-
paths:
1747-
- coverage
1748-
- store_test_results:
1749-
path: test/test-results/junit.xml
1750-
1751-
upload-coverage:
1752-
executor: node-browsers-small
1753-
steps:
1754-
- run: *shallow-git-clone
1755-
- run: sudo corepack enable
1756-
- attach_workspace:
1757-
at: .
1758-
- codecov/upload
1759-
- persist_to_workspace:
1760-
root: .
1761-
paths:
1762-
- coverage
1763-
17641700
test-unit-global:
17651701
executor: node-browsers-small
17661702
steps:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: 'Setup environment'
2+
description: 'Setup environment'
3+
runs:
4+
using: 'composite'
5+
steps:
6+
- run: corepack enable
7+
shell: bash
8+
9+
- name: Set up Node.js
10+
uses: actions/setup-node@v4
11+
with:
12+
node-version-file: '.nvmrc'
13+
cache: yarn
14+
15+
- name: Install dependencies
16+
run: yarn --immutable
17+
shell: bash

.github/workflows/run-unit-tests.yml

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# WARNING! It is currently being investigated how to make this faster
2+
# DO NOT blindly copy this workflow, not noticing the slow down,
3+
# because suddenly our tests will take hours to pass CI.
4+
# Hopefully this comment here will help prevent that.
5+
# https://github.com/MetaMask/metamask-extension/issues/25680
6+
7+
name: Run unit tests
8+
9+
on:
10+
pull_request:
11+
types: [opened,reopened,synchronize]
12+
13+
jobs:
14+
test-unit-jest:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v4
19+
20+
- name: Setup environment
21+
uses: ./.github/actions/setup-environment
22+
23+
- name: test:coverage:jest:dev
24+
run: yarn test:coverage:jest:dev
25+
26+
- name: test:coverage:jest
27+
run: yarn test:coverage:jest
28+
29+
- uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673
30+
with:
31+
token: ${{ secrets.CODECOV_TOKEN }}
32+
fail_ci_if_error: true

0 commit comments

Comments
 (0)