-
-
Notifications
You must be signed in to change notification settings - Fork 248
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
fix: skip unnecessary test runs for bot-generated and non-critical PRs #1339
base: master
Are you sure you want to change the base?
Changes from 1 commit
150c70f
3b869ba
3c929b0
fbe5518
6b99a12
ae3ed1c
745ad20
4a5a876
7a9cd96
da527e7
8166815
45a3500
1fdb0fa
eac63d3
735aefc
72756af
2f7eb4f
804b2c9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -1,13 +1,37 @@ | ||||||
#This workflow runs the tests in the test projects to make sure the generator works as a library where it is a Node dependency along with the template. | ||||||
name: Test using test project | ||||||
|
||||||
on: | ||||||
pull_request: | ||||||
types: [opened, reopened, synchronize, ready_for_review] | ||||||
paths: | ||||||
- 'package.json' | ||||||
- 'package-lock.json' | ||||||
- 'apps/' | ||||||
- 'packages/' | ||||||
- '.github/workflows/' | ||||||
- '!/*.md' | ||||||
- '!docs/**' | ||||||
|
||||||
jobs: | ||||||
should-test: | ||||||
runs-on: ubuntu-latest | ||||||
outputs: | ||||||
run_tests: ${{ steps.check.outputs.run_tests }} | ||||||
steps: | ||||||
- name: Check if tests should run | ||||||
id: check | ||||||
run: | | ||||||
# Skip for bot PRs with specific titles | ||||||
if [[ "${{ github.actor }}" == "asyncapi-bot" && "${{ github.event.pull_request.title }}" =~ ^(ci:\ update|chore\(release\):) ]] || \ | ||||||
[[ "${{ github.actor }}" == "allcontributors[bot]" && "${{ github.event.pull_request.title }}" =~ ^docs: ]]; then | ||||||
echo "run_tests=false" >> $GITHUB_OUTPUT | ||||||
else | ||||||
echo "run_tests=true" >> $GITHUB_OUTPUT | ||||||
fi | ||||||
|
||||||
test: | ||||||
if: github.event.pull_request.draft == false | ||||||
needs: should-test | ||||||
if: needs.should-test.outputs.run_tests == 'true' && github.event.pull_request.draft == false | ||||||
name: Test generator as dependency with Node ${{ matrix.node }} | ||||||
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.
Suggested change
wrapping 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. Alright got it !! i took the assumptions so did such changes but anyway will resolve it . |
||||||
runs-on: ubuntu-latest | ||||||
strategy: | ||||||
|
@@ -16,6 +40,7 @@ jobs: | |||||
steps: | ||||||
- name: Checkout repository | ||||||
uses: actions/checkout@v3 | ||||||
|
||||||
- name: Run test | ||||||
run: NODE_IMAGE_TAG=${{ matrix.node }} docker compose up --abort-on-container-exit --remove-orphans --force-recreate | ||||||
working-directory: ./apps/generator/test/test-project |
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.
Adding a new job on which the actual job to be done is dependent won't increase job setup time?
Instead, how's about adding an if clause just like it is done here
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 did tried adding but thought of optimising it a bit thus made it likewise ,anyway will look into it .