refactor(ci): conditionally run jobs based on file changes#4242
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`.
| - windows-2022 | ||
| steps: | ||
| - uses: actions/checkout@v3 | ||
| if: needs.changes.outputs.go == 'true' |
There was a problem hiding this comment.
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.
| 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.
This should have the dependencies for each of these generated files as well.
There was a problem hiding this comment.
Good point! I'm not familiar with that part of the codebase. What should those be?
There was a problem hiding this comment.
You should be able to see them all in the Makefile
There was a problem hiding this comment.
Ah cool! Didn't realize that, I think I got them all. How's it look now?
| 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.
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.
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