Skip to content

Conversation

@acouch
Copy link
Member

@acouch acouch commented Jul 8, 2025

Changes

On grants.gov we recently tested using workers in Github Actions: HHS/simpler-grants-gov#5615 . We've seen test times drop on average by half (~4 mins to ~2 mins).

This is an optimization that helps locally too and has been tested by a couple of devs.

@acouch acouch requested a review from a team as a code owner July 8, 2025 15:55
// Opt out of parallel tests on CI.
workers: process.env.CI ? 1 : undefined,
// Parallelize tests.
workers: 10,
Copy link
Contributor

Choose a reason for hiding this comment

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

Have you tried using nproc to set the workers to the number of processors rather than hardcoding? e.g. when running the playwright command doing something like:

npx playwright test --workers=$(nproc)

Copy link
Contributor

Choose a reason for hiding this comment

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

@doshitan what do you think of this optimization? should we just hardcode it for now? seems reasonable, i think most of our laptops have 8 cores, and a quick google seems to show that github actions runners have 4 cores, so i think hardcoding to 8 seems reasonable. or if we wanted to make it more elegant we can add something to e2e/run-e2e-test to check for the number of cores like:

if [[ "$OSTYPE" == "linux-gnu"* ]]; then
  CORES=$(nproc)
elif [[ "$OSTYPE" == "darwin"* ]]; then
  CORES=$(sysctl -n hw.ncpu)
else
  CORES=1 # Fallback to running without parallelization
fi

npx playwright test --config "${APP_NAME}/playwright.config.js" --workers=$CORES "$@"

Copy link
Contributor

@doshitan doshitan Jul 11, 2025

Choose a reason for hiding this comment

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

It looks like by default Playwright will allocate cpu count / 2 workers. So can we just drop the explicit workers config item and use the default? Possibly set it to "100%" in CI since that environment should be more of a uni-tasker/can dedicate all it's resources to the e2e tests?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants