Repository navigation
ci: check pushes only on main, cache audit - #20
Merged
Merged
Conversation
A push sends new commits to GitHub. The workspace and security checks run for a push only when it goes to the main branch. Other branches are checked through their pull request, so each update to a pull request is checked once. Each run belongs to a group: the name GitHub uses to decide which runs may cancel each other. When a pull request gets another update, any run that is checking an earlier update of the same pull request is cancelled, so only the latest update is checked. Runs on main, scheduled runs and manual runs each get their own group, so they are never cancelled. The security check runs for a push to main or a pull request update only when the change touches a file in its path filters, the file list that decides whether a check runs. It also runs every Monday and when started by hand.
The security check uses cargo-audit 0.22.2, a program that compares our dependencies, the outside libraries this project uses, with a public list of known security problems. The program has its own cache: a saved copy kept between runs so the program is not rebuilt each time. The cache name covers the program version, the system and processor type, and the exact Rust compiler. After the Rust compiler and tools are set up, the check restores the cache and makes sure the program reports version 0.22.2. If the cache is empty or the program does not match, the check builds cargo-audit and saves it to the cache. On every run, cargo-audit downloads the latest list of known security problems.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A workflow is a set of automatic steps GitHub runs for this project. The
workspaceandsecurityworkflows run for a push, which sends new commits to GitHub, only when it goes to the main branch. Other branches are checked through their pull request, so each pull request update is checked once. When a pull request gets another update, any run that is checking an earlier update of that pull request is cancelled.The audit is the security check that compares our dependencies, the outside libraries this project uses, with a public list of known security problems. Its
cargo-auditprogram uses a cache: a saved copy kept between runs so the program is not rebuilt each time. The audit downloads the latest public list on every run.Closes #17
Closes #18
Approach
~/.cache/cargo-audit-0.22.2, is saved. The~/.cargo/binfolder also holds Rust tools, so it is left out.0.22.2is written once, in the security workflow's settings.Verification
cargo-audit, copied exactly fromsecurity.yml, passed three times in a local test: with an empty program folder, with a filled folder, and with a program that reports a different version. With the empty folder and the wrong version, the step installed version 0.22.2 into its own folder, ready for the cache step to save. With the filled folder, the step used the saved program without building it. The audit then passed with that program.