-
Notifications
You must be signed in to change notification settings - Fork 182
ci: release from actions, only test changed files #374
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 commit introduces release automation triggered by button clicks in Github Actions, guarded by a check on whether all the Cargo.toml files contain the same version string. On PRs, changes to documentation no longer trigger code tests. Similarly, changes to code that don't update documentation do not trigger documentation tests. Changes that fail at the `cargo check` stage abort early to prevent lengthy CI builds of the installer and firmware. Commits on the `main` branch always run the full test suite regardless of what changed. Releases also run the full check, test, build and publish suite.
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Check formatting | ||
run: cargo fmt --all --check |
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 is a functionality change: now we enforce that the code has been run through cargo fmt
.
If we accept this we can drop one of the "have you run a linter" PR checklists. I can do that in this PR if we like this.
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.
Yesssss! I love this
- name: Ensure all Cargo.toml files have the same version defined. | ||
run: | | ||
defined_versions=$(find lib bin installer rootshell telcom-parser -name Cargo.toml -exec grep ^version {} \; | uniq | wc -l) | ||
find lib bin installer rootshell telcom-parser -name Cargo.toml -exec grep ^version {} \; |
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 is here to help with debugging actions when this guard fails, the versions will be printed to the actions log.
# https://github.com/EFForg/rayhunter/actions/workflows/release.yml | ||
name: Release rayhunter | ||
on: | ||
workflow_dispatch: |
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.
We could also trigger this on a v*
tag push. My feeling is that starting with one canonical release mechanism is the right way though.
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.
Yeah I think having one release mechanism and documentation on how to trigger a release.
The addition of all the |
For future work, I'd like to:
Each of those should be pretty easy to implement individually. |
Replying to myself:
I will probably do this in a separate PR later, I think it will make the workflows easier to read. If anyone wants to PR against my branch they can. |
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.
Going to go ahead and drop an approval on here so you don't get to a state where you are blocked due to a lack of approvals.
Since this is a pretty major change to the release workflow we should probably wait until a few others chime in with their thoughts
This branch introduces release automation triggered by button clicks in Github Actions, guarded by a check on whether all the Cargo.toml files contain the same version string.
On PRs, changes to documentation no longer trigger code tests. Similarly, changes to code that don't update documentation do not trigger documentation tests. Changes that fail at the
cargo check
stage abort early to prevent lengthy CI builds of the installer and firmware.Commits on the
main
branch always run the full test suite regardless of what changed.Releases also run the full check, test, build and publish suite.
Pull Request Checklist
cargo fmt
Notes
We can iterate on naming, functionality, etc. It's possible to break up the main file into smaller components (e.g., build.yml, mdbook.yml, etc, all triggered by main.yml conditionally). I've tested this a lot in my own repo, but it's always possible I've overlooked something.
Fixes #370