-
Notifications
You must be signed in to change notification settings - Fork 564
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: CircleCI performance improvements on PRs #9993
Merged
olerichter00
merged 3 commits into
main
from
olerichter00/circleci-test-performance-improvements
May 15, 2024
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/usr/bin/env bash | ||
|
||
UPDATED_GLOBAL_FILES=$(git diff --name-only origin/main...$CIRCLE_SHA1 | grep -E '^.+\.(ts|tsx)$' | grep -v '^src/app/Scenes/' | grep -v '^src/__generated__/') | ||
UPDATED_PACKAGES=$(git diff --name-only origin/main...$CIRCLE_SHA1 | grep -E "package.json|yarn.lock") | ||
UPDATED_SCENES=$(git diff --name-only origin/main...$CIRCLE_SHA1 | grep -E '^.+\.(ts|tsx)$' | sed -n 's#^src/app/Scenes/\([^/]*\)/.*#src/app/Scenes/\1#p' | uniq) | ||
|
||
ALL_UPDATED_FILES=$(git diff --name-only origin/main...$CIRCLE_SHA1 | grep -E '^.+\.(ts|tsx)$' | xargs -n 1 basename) | ||
JEST_OPTIONS="--ci --forceExit --logHeapUsage --runInBand --reporters=default --reporters=jest-junit --shard=$(expr $CIRCLE_NODE_INDEX + 1)/$CIRCLE_NODE_TOTAL" | ||
|
||
|
||
# If only scene files in `src/app/Scenes` have been updated, run only tests for those scenes. | ||
# If global TypeScript files or `package.json` have been updated, run all tests. | ||
# If no `.ts` or `.tsx` files or packages have been updated, don't run any tests. | ||
if [ -n "$UPDATED_GLOBAL_FILES" ] || [ -n "$UPDATED_PACKAGES" ] | ||
then | ||
yarn jest $JEST_OPTIONS | ||
elif [ -n "$UPDATED_SCENES" ] || [ -n "$ALL_UPDATED_FILES" ] | ||
yarn jest $UPDATED_SCENES $ALL_UPDATED_FILES $JEST_OPTIONS | ||
then | ||
echo "No ts|tsx files are updated. Skipping tests." | ||
fi | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 馃檶 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
thought, non-blocking: Always running all tests for main, release and hot fixes makes a lot of sense, for build-me I wonder if forcing a run based on something like a label would be better than having to rename the branch: https://github.com/marketplace/actions/run-circle-ci-on-label
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.
That's a great idea! 馃憤 It might be good to keep both because this is how to force all tests to run in Gravity. I'll try to make this version with the label work as well and then add it here and to Gravity's CircleCI config.
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.
Let's also add the
beta-ios
andbeta-android
branches here 鉂わ笍