-
Notifications
You must be signed in to change notification settings - Fork 900
refactor(ci): conditionally run jobs based on file changes #4242
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
This modifies the `style-lint-typescript` and `test-js` jobs to only run when there are changes in `site`.
This adds a new item to `changes` for `**.tf` changes. Now it will only run `style-fmt` if PR includes changes to `site/**`, `**.tf`, or `**.ts`.
@@ -288,30 +305,36 @@ jobs: | |||
- windows-2022 | |||
steps: | |||
- uses: actions/checkout@v3 | |||
if: needs.changes.outputs.go == 'true' |
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.
Sadly, because this job is required, we can't use this if
at the top or the PR status will never show Success. Alternative approach linked in PR discussion which involves creating a generic workflow with same name and running it for the opposition condition (i.e. no Go changes). I like this approach better but could be swayed the other way.
.github/workflows/coder.yaml
Outdated
gen: | ||
- coderd/database/dump.sql | ||
- coderd/database/querier.go | ||
- provisionersdk/proto/provisioner.pb.go | ||
- provisionerd/proto/provisionerd.pb.go | ||
- site/src/api/typesGenerated.ts |
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 should have the dependencies for each of these generated files as well.
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.
Good point! I'm not familiar with that part of the codebase. What should those be?
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.
You should be able to see them all in the Makefile
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 cool! Didn't realize that, I think I got them all. How's it look now?
.github/workflows/coder.yaml
Outdated
gen: | ||
- coderd/database/dump.sql | ||
- coderd/database/gen/dump/main.go | ||
- coderd/database/gen/enum/main.go | ||
- coderd/database/generate.sh | ||
- coderd/database/migrations/*.sql | ||
- coderd/database/querier.go | ||
- coderd/database/queries/*.sql | ||
- coderd/database/sqlc.yaml | ||
- provisionersdk/proto/provisioner.pb.go | ||
- provisionersdk/proto/provisioner.proto | ||
- provisionerd/proto/provisionerd.pb.go | ||
- provisionerd/proto/provisionerd.proto | ||
- site/src/api/typesGenerated.ts | ||
- scripts/apitypings/main.go |
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 think we should just leave this out for now, because it's so unlikely to be maintained from my POV.
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.
Makes sense. I'll remove and merge.
This reverts commit d0a5ba1.
Description
This PR refactors some of the jobs in CI to only run when necessary with the hopes of speeding up CI runs.
Resources
Alternative approach: https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/troubleshooting-required-status-checks#handling-skipped-but-required-checks