-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
ci: Only run E2E test apps that are affected on PRs #14254
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
Conversation
size-limit report 📦
|
ae3d63c
to
fcd6b78
Compare
927af9e
to
c7df3bf
Compare
const args: Record<string, string> = {}; | ||
process.argv | ||
.slice(2) | ||
.filter(arg => arg.startsWith('--') && arg.includes('=')) | ||
.forEach(arg => { | ||
const [part1, part2] = arg.split('=') as [string, string]; | ||
const argName = part1.replace('--', ''); | ||
const argValue = part2; | ||
args[argName] = argValue; | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
m: We can pass process.argv
into https://nodejs.org/api/util.html#utilparseargsconfig and use it instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, I was looking for this (remembered that something like this exists, but was not sure anymore how/where) - that's much better!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this also required bumping the node types in the e2e-tests package, but that should be OK i'd say (as we use node 18 anyhow).
...packageJson.dependencies, | ||
}; | ||
|
||
return Object.keys(dependencies).filter(key => key.startsWith('@sentry')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we also filter @sentry-internal
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like if some e2e test has a dependency on some internal package, we should also re-run it in this case? the classic thing would be @sentry-internal/test-utils
, IMHO changes there should trigger all e2e tests that use this (which is all of them 😅 )
This reverts commit e91d64d.
2f61b7f
to
e68dc71
Compare
This PR aims to solve two things: 1. Do not require us to keep a list of test-applications to run on CI. This is prone to be forgotten, and then certain tests do not run on CI and we may not notice (this has happened more than once in the past 😬 ) 2. Do not run E2E test applications that are unrelated to anything that was changed. With this PR, instead of keeping a list of E2E test jobs we want to run manually in the build.yml file, this is now inferred (on CI) by a script based on the nx dependency graph and some config in the test apps package.json. This is how it works: 1. Pick all folders in test-applications, by default all of them should run. --> This will "fix" the problem we had sometimes that we forgot to add test apps to the build.yml so they don't actually run on CI :grimacing: 3. For each test app, look at it's dependencies (and devDependencies), and see if any of them has changed in the current PR (based on nx affected projects). So e.g. if you change something in browser, only E2E test apps that have any dependency that uses browser will run, so e.g. node-express will be skipped. 4. Additionally, you can configure variants in the test apps package.json - instead of defining this in the workflow file, it has to be defined in the test app itself now. 5. Finally, a test app can be marked as optional in the package.json, and can also have optional variants to run. 6. The E2E test builds the required & optional matrix on the fly based on these things. 7. In pushes (=on develop/release branches) we just run everything. 8. If anything inside of the e2e-tests package changed, run everything. --> This could be further optimized to only run changed test apps, but this was the easy solution for now. ## Example test runs * In a PR with no changes related to the E2E tests, nothing is run: https://github.com/getsentry/sentry-javascript/actions/runs/11838604965 * In a CI run for a push, all E2E tests are run: https://github.com/getsentry/sentry-javascript/actions/runs/11835834748 * In a PR with a change in e2e-tests itself, all E2E tests are run: https://github.com/getsentry/sentry-javascript/actions/runs/11836668035 * In a PR with a change in the node package, only related E2E tests are run: https://github.com/getsentry/sentry-javascript/actions/runs/11838274483
Updates readme based on this PR: #14254
This PR aims to solve two things:
With this PR, instead of keeping a list of E2E test jobs we want to run manually in the build.yml file, this is now inferred (on CI) by a script based on the nx dependency graph and some config in the test apps package.json. This is how it works:
Example test runs