Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

Merged
merged 11 commits into from
Sep 30, 2022

Conversation

jsjoeio
Copy link
Contributor

@jsjoeio jsjoeio commented Sep 28, 2022

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

This modifies the `style-lint-typescript` and `test-js` jobs to only run
when there are changes in `site`.
@jsjoeio jsjoeio marked this pull request as ready for review September 28, 2022 16:25
@jsjoeio jsjoeio marked this pull request as draft September 28, 2022 16:25
@jsjoeio jsjoeio self-assigned this Sep 28, 2022
@jsjoeio jsjoeio added the chore label Sep 28, 2022
@jsjoeio jsjoeio changed the title refactor(ci): only run ts jobs on ts changes refactor(ci): conditionally run jobs based on file changes Sep 28, 2022
@@ -288,30 +305,36 @@ jobs:
- windows-2022
steps:
- uses: actions/checkout@v3
if: needs.changes.outputs.go == 'true'
Copy link
Contributor Author

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.

@jsjoeio jsjoeio marked this pull request as ready for review September 28, 2022 18:47
@jsjoeio jsjoeio requested a review from kylecarbs September 28, 2022 18:47
Comment on lines 69 to 74
gen:
- coderd/database/dump.sql
- coderd/database/querier.go
- provisionersdk/proto/provisioner.pb.go
- provisionerd/proto/provisionerd.pb.go
- site/src/api/typesGenerated.ts
Copy link
Member

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.

Copy link
Contributor Author

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?

Copy link
Member

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

Copy link
Contributor Author

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?

@jsjoeio jsjoeio removed the chore label Sep 30, 2022
Comment on lines 69 to 83
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
Copy link
Member

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.

Copy link
Contributor Author

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.

@jsjoeio jsjoeio merged commit f9b7588 into main Sep 30, 2022
@jsjoeio jsjoeio deleted the jsjoeio/conditional-ci branch September 30, 2022 16:34
mafredri added a commit that referenced this pull request Oct 3, 2022
kylecarbs pushed a commit that referenced this pull request Oct 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants