Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: move unit tests from Circleci to Github actions #25570

Merged
merged 26 commits into from
Jul 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
d39b4a5
feat: run-unit-tests
itsyoboieltr Jun 27, 2024
f353ab5
fix: add corepack enable
itsyoboieltr Jun 28, 2024
a399875
fix: corepack enable
itsyoboieltr Jun 28, 2024
b678880
fix: remove unit tests from config
itsyoboieltr Jun 28, 2024
9b8917e
fix: add pr action types
itsyoboieltr Jun 28, 2024
ce18831
fix: setup nodejs
itsyoboieltr Jun 28, 2024
766a339
Merge branch 'develop' into move-unit-tests-to-github-actions
itsyoboieltr Jul 1, 2024
335744f
feat: add codecov upload
itsyoboieltr Jul 1, 2024
697f8ec
fix: test
itsyoboieltr Jul 1, 2024
6b03bd3
fix: add token and fail on error
itsyoboieltr Jul 1, 2024
c082f24
Merge branch 'develop' into move-unit-tests-to-github-actions
itsyoboieltr Jul 2, 2024
0cc1a57
Merge branch 'develop' into move-unit-tests-to-github-actions
itsyoboieltr Jul 2, 2024
9711df5
Update config.yml
itsyoboieltr Jul 2, 2024
042fe6f
feat: setup-environment reusable workflow
itsyoboieltr Jul 3, 2024
4b3f0cd
fix: checkout
itsyoboieltr Jul 3, 2024
ce890f9
Update run-unit-tests.yml
itsyoboieltr Jul 3, 2024
97eb64e
fix: composite action
itsyoboieltr Jul 3, 2024
6814ed1
Update action.yml
itsyoboieltr Jul 3, 2024
c6a4933
Update action.yml
itsyoboieltr Jul 3, 2024
6f6fbf6
Update config.yml
itsyoboieltr Jul 3, 2024
32cdf03
Update action.yml
itsyoboieltr Jul 3, 2024
62c2e93
Update action.yml
itsyoboieltr Jul 3, 2024
e63bc82
Update run-unit-tests.yml
itsyoboieltr Jul 3, 2024
0438fc4
Merge branch 'develop' into move-unit-tests-to-github-actions
itsyoboieltr Jul 3, 2024
15797c2
Update run-unit-tests.yml
itsyoboieltr Jul 3, 2024
d1be009
fix: add warning
itsyoboieltr Jul 4, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 0 additions & 64 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -249,16 +249,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
Expand Down Expand Up @@ -302,10 +292,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
Expand Down Expand Up @@ -1596,9 +1583,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
Expand Down Expand Up @@ -1679,54 +1663,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:
Expand Down
17 changes: 17 additions & 0 deletions .github/actions/setup-environment/action.yml
Original file line number Diff line number Diff line change
@@ -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
32 changes: 32 additions & 0 deletions .github/workflows/run-unit-tests.yml
Original file line number Diff line number Diff line change
@@ -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:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to add a trigger for develop and master here as well. These long-running branches will not have PRs associated with them, but it's very important that we know that tests are passing on them.

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