ci: GitHub Actions workflow improvements - #1697
Conversation
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
| # Deliberately no RUSTUP_TOOLCHAIN here, uses rust-toolchain.toml to pin version. | ||
| # trybuild fixtures assert exact rustc diagnostics in committed .stderr files. |
There was a problem hiding this comment.
I'd rather keep things as they are (I think turning off incremental compilation is important, and the color is a nice bonus as well).
There was a problem hiding this comment.
Cool. I've reverted back to dtolnay/rust-toolchain.
There was a problem hiding this comment.
So here's actually my issue with dtolnay/rust-toolchain -- it actually makes implicit a bunch of things that would be better off to be explicitly defined.
Your comment here was incorrect:
dropshot/.github/workflows/rust.yml
Lines 96 to 101 in 8ef467e
See: yesterday's trybuild job run on main

In fact dtolnay/rust-toolchain never respects rust-toolchain.toml. It requires specifying an explicit toolchain in your workflow, but when you pin to dtolnay/rust-toolchain@stable branch it automatically uses stable. If you attempt to pin to a commit hash in main it shows its true colors and says toolchain is required. job link. source link.
Sadly, the way this implemented also prevents you from pinning to explicit stable commits even if you want that behavior. While the v1 tag moves it points to commits in master (which is pretty common for GitHub Actions). But stable is implemented as a divergent branch. Every time there is a release it is rebased to master and any previous commit becomes orphaned and subject to being garbage collected.
And these behaviors are intentional:
Re: rust-toolchain.toml support
I would prefer not to support it in this action. But someone else could maintain a different action that provides that pair of steps as one action.
dtolnay comment
In a workflow that pins the action using a full-length commit SHA (as opposed to something like @nightly or @1.89.0) it is required that you pick a SHA that is within the history of the master branch. Any commit that is not within the history of master will eventually get garbage-collected and your workflows will fail.
dtolnay/rust-toolchain README.md
To me this sort of complexity is not worth it. CARGO_INCREMENTAL: 0 was the only env var we were getting implicitly from dtolnay/rust-toolchain, RUST_BACKTRACE and CARGO_TERM_COLOR were already being explicitly set:
dropshot/.github/workflows/rust.yml
Lines 12 to 15 in 8ef467e
There was a problem hiding this comment.
Hmm, okay, thanks -- makes sense. (Though I think my comment agrees with what you said about precedence?)
# v7.0.0)CARGO_INCREMENTAL=0to match the previous dtolnay/rust-toolchain behavior