diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2023-03-09 10:10:03 +0100 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2023-03-09 10:10:06 +0100 |
commit | 4f2d692433858db7bfbc4a94471649ff0345a50b (patch) | |
tree | c87306b8f2fc75b7f1724a044e80cca321da9e6c | |
parent | 1435419d8ce7695e5b29ab1720e1ef706a196cdd (diff) |
Specify RUSTUP_TOOLCHAIN in workflow
The problem here is that we are not actually using a specific rust
version due to the contents of rust-toolchain.toml file, which we need
for the flake.nix infrastructure.
We are installing a workflow-defined rust version, but the one from the
rust-toolchain file ends up being used anyway. This then conflicts with
dtolnay/rust-toolchain's way to conditionally set
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: it checks if the toolchain being
installed is (e.g.) 1.66 or 1.67 and otherwise sets the flag. This
assumes that if we're installing an old version we're using that old
version, and there the flag will be ignored because not yet implemented.
However we end up actually using rust 1.66 and thus the flag is read and
breaks our CI because it's nightly only.
To fix the actual issue (running rust 1.66 instead of 1.60 for example)
we can either explicitly set the toolchain in the command
(`cargo +${{ matrix.rust }} check` for each command) or set the
RUSTUP_TOOLCHAIN environment variable to ${{ matrix.rust }}. Both will
override out rust-toolchain.toml.
We opt for the latter here, for no particular reason.
Thanks to @SkiFire13, who helped solving this here:
https://users.rust-lang.org/t/sparse-registry-breaking-my-ci-and-i-dont-understand-why/89976/
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
-rw-r--r-- | .github/workflows/ci.yml | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c9006c9..4533c8b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,6 +21,11 @@ jobs: - beta # - nightly + # required because we have a different toolchain than {{ matrix.rust }} in + # rust-toolchain.toml, which we use for the flake.nix + env: + RUSTUP_TOOLCHAIN: ${{ matrix.rust }} + steps: - name: Checkout sources uses: actions/checkout@v3 @@ -56,6 +61,11 @@ jobs: name: format runs-on: ubuntu-latest + # required because we have a different toolchain in + # rust-toolchain.toml, which we use for the flake.nix + env: + RUSTUP_TOOLCHAIN: 1.67.0 + steps: - uses: actions/checkout@v3 - uses: dtolnay/rust-toolchain@master @@ -76,6 +86,12 @@ jobs: - stable - beta # - nightly + + # required because we have a different toolchain than {{ matrix.rust }} in + # rust-toolchain.toml, which we use for the flake.nix + env: + RUSTUP_TOOLCHAIN: ${{ matrix.rust }} + steps: - name: Checkout sources uses: actions/checkout@v3 @@ -90,6 +106,12 @@ jobs: clippy: name: clippy runs-on: ubuntu-latest + + # required because we have a different toolchain in + # rust-toolchain.toml, which we use for the flake.nix + env: + RUSTUP_TOOLCHAIN: 1.67.0 + steps: - uses: actions/checkout@v3 - uses: dtolnay/rust-toolchain@master |