Skip to content
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

Running rust-toolchain twice in same workflow can result in unstable errors #12

Closed
neoeinstein opened this issue Feb 15, 2023 · 4 comments · Fixed by #13
Closed

Running rust-toolchain twice in same workflow can result in unstable errors #12

neoeinstein opened this issue Feb 15, 2023 · 4 comments · Fixed by #13

Comments

@neoeinstein
Copy link

neoeinstein commented Feb 15, 2023

Example workflow where we use the nightly for formatting, but stable for linting with Clippy:

    steps:
      - uses: actions/checkout@v3
      - uses: dtolnay/rust-toolchain@nightly
        with:
          components: rustfmt
      - run: cargo +nightly fmt --all -- --check
      - uses: dtolnay/rust-toolchain@stable
        with:
          components: clippy
      - uses: Swatinem/rust-cache@v2
      - run: cargo clippy --all-targets --all-features --locked -- -D warnings

This results in the following error when trying to run the clippy command:

  env:
    CARGO_INCREMENTAL: 0
    CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
  
error: failed to get `axum` as a dependency of package `CRATE v0.1.0 (/runner/_work/PATH)`

Caused by:
  failed to load source for dependency `axum`

Caused by:
  Unable to update registry `crates-io`

Caused by:
  usage of sparse registries requires `-Z sparse-registry`
Error: Process completed with exit code 101.
@neoeinstein
Copy link
Author

Meant to post this over at dtolnay's repository. It's now there as dtolnay/rust-toolchain#73.

@jonasbb
Copy link
Contributor

jonasbb commented Feb 15, 2023

Since I based this on dtolnay's action I was curious about the issue. But I cannot reproduce it. Neither with this action nor with your code snippet. I only get this when running clippy. This seem caused by the trailing -- -D.

error: multiple input filenames provided (first two filenames are `src/main.rs` and `feature="cargo-clippy"`)

Do you have a repository and a link to an actions log where this error occurs?

@neoeinstein
Copy link
Author

neoeinstein commented Feb 15, 2023

See dtolnay/rust-toolchain#74. This has now been fixed in that repository. I fixed the above. it should have been -D warnings, but could have been left off for this.

jonasbb added a commit that referenced this issue Feb 21, 2023
Not all version support the new sparse protocol. While old versions
ignore the value, 1.66 and other fail due to unstable features.

If such a version is detected, always downgrade to the git protocol.

This fixes running the action twice with different toolchains. Even if
the first install uses something which supports "sparse", the second run
can still downgrade it to "git".

Closes #12
@jonasbb
Copy link
Contributor

jonasbb commented Feb 21, 2023

I published a fix for this problem. It ended up quite different from dtolnay/rust-toolchain#74 because that fix is incomplete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants