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: Make Jest unit tests run faster in GitHub actions #25726

Merged
merged 15 commits into from
Jul 12, 2024

Conversation

itsyoboieltr
Copy link
Contributor

@itsyoboieltr itsyoboieltr commented Jul 9, 2024

Description

Open in GitHub Codespaces

Based on #25680, by migrating the jest unit tests from CircleCI to GitHub actions the time to run unit tests has increased to 15 minutes from 5 minutes. This PR makes Jest unit tests run faster in Github actions. This is achieved by some improvements to the testing infrastructure.

  1. Sharding: the tests are run on 6 machines in parallel, instead of a single machine. This saves around ~8-9 minutes on average.
  2. Optimized coverage generation: I removed the generation of html reports in CI, as they are only used for local debugging. This should also save some time, as unused files are not being generated on CI.
  3. Merged development tests: The two small tests under build/transforms were merged into the main test configuration. This means that one less machine needs to be started (as the development tests would require their own machine to run, due to the sharding introduced in this PR), saving around approx. 2 minutes of compute time.
  4. Minor fixes: Now the run-unit-tests workflow will also run on push to the develop and master branches.

Related issues

Fixes: #25680,

Manual testing steps

  1. Run CI and see that tests are running fast (between 5-7 mins on average)

Screenshots/Recordings

Not Applicable

Pre-merge author checklist

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.

Copy link
Contributor

github-actions bot commented Jul 9, 2024

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@metamaskbot
Copy link
Collaborator

Builds ready [726823a]
Page Load Metrics (132 ± 142 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint6712393147
domContentLoaded105525115
load481422132296142
domInteractive105525115
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

Copy link

codecov bot commented Jul 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 69.96%. Comparing base (5ee57a6) to head (5dfed06).
Report is 34 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #25726      +/-   ##
===========================================
+ Coverage    69.77%   69.96%   +0.19%     
===========================================
  Files         1376     1390      +14     
  Lines        48403    48895     +492     
  Branches     13348    13451     +103     
===========================================
+ Hits         33773    34207     +434     
- Misses       14630    14688      +58     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@itsyoboieltr itsyoboieltr marked this pull request as ready for review July 10, 2024 15:40
@itsyoboieltr itsyoboieltr requested review from kumavis and a team as code owners July 10, 2024 15:40
jest.config.js Outdated Show resolved Hide resolved
jest.config.js Outdated Show resolved Hide resolved
@metamaskbot
Copy link
Collaborator

Builds ready [0e23cd2]
Page Load Metrics (143 ± 167 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint71238973517
domContentLoaded10402294
load421658143348167
domInteractive10402294
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

Copy link

sonarcloud bot commented Jul 11, 2024

Copy link
Member

@Gudahtt Gudahtt left a comment

Choose a reason for hiding this comment

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

LGTM!

@metamaskbot
Copy link
Collaborator

Builds ready [5dfed06]
Page Load Metrics (72 ± 8 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint69134102157
domContentLoaded96529167
load4510572178
domInteractive96529167
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@itsyoboieltr itsyoboieltr merged commit 24c95db into develop Jul 12, 2024
82 checks passed
@itsyoboieltr itsyoboieltr deleted the make-unit-tests-faster-test branch July 12, 2024 14:01
@github-actions github-actions bot locked and limited conversation to collaborators Jul 12, 2024
@metamaskbot metamaskbot added the release-12.3.0 Issue or pull request that will be included in release 12.3.0 label Jul 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
release-12.3.0 Issue or pull request that will be included in release 12.3.0 team-extension-platform
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Make Jest unit tests run faster in GitHub actions
6 participants