actions-rs / toolchain

🛠️ GitHub Action for `rustup` commands

Home Page:https://github.com/marketplace/actions/rust-toolchain

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fails to install latest nighly with rustfmt

phil-opp opened this issue · comments

We're using this action to download the latest nightly that has rustfmt available, in order to verify the formatting of our project.

Our workflow looks like this:

check_formatting:
    name: "Check Formatting"
    runs-on: ubuntu-latest
    timeout-minutes: 2
    steps:
    - uses: actions/checkout@v1
    - name: "Use the latest Rust nightly with rustfmt"
      uses: actions-rs/toolchain@v1
      with:
          toolchain: nightly
          profile: minimal
          components: rustfmt
          override: true
    - run: cargo fmt -- --check

Since today, the following error occurs:

Run actions-rs/toolchain@v1
  with:
    toolchain: nightly
    profile: minimal
    components: rustfmt
    override: true
    default: false
/usr/share/rust/.cargo/bin/rustup show
Default host: x86_64-unknown-linux-gnu
rustup home:  /home/runner/.rustup

info: syncing channel updates for 'nightly-x86_64-unknown-linux-gnu'
info: latest update on 2020-02-08, rust version 1.43.0-nightly (a29424a22 2020-02-07)
warning: Force-skipping unavailable component 'clippy-x86_64-unknown-linux-gnu'
warning: Force-skipping unavailable component 'rustfmt-x86_64-unknown-linux-gnu'
info: downloading component 'cargo'
info: downloading component 'rust-docs'
info: downloading component 'rust-std'
info: downloading component 'rustc'
info: installing component 'cargo'
info: installing component 'rust-docs'
info: installing component 'rust-std'
info: installing component 'rustc'
nightly-x86_64-unknown-linux-gnu (overridden by '/home/runner/work/bootloader/bootloader/rust-toolchain')
rustc 1.43.0-nightly (a29424a22 2020-02-07)
/usr/share/rust/.cargo/bin/rustup -V
rustup 1.21.1 (7832b2ebe 2019-12-20)
Installed rustup 1.21.1 support profiles
/usr/share/rust/.cargo/bin/rustup -V
rustup 1.21.1 (7832b2ebe 2019-12-20)
Installed rustup 1.21.1 support components
/usr/share/rust/.cargo/bin/rustup set profile minimal
info: profile set to 'minimal'
/usr/share/rust/.cargo/bin/rustup toolchain install nightly --component rustfmt
info: syncing channel updates for 'nightly-x86_64-unknown-linux-gnu'
info: latest update on 2020-02-08, rust version 1.43.0-nightly (a29424a22 2020-02-07)
info: skipping nightly which is missing installed component 'rustfmt-preview'
error: component 'rustfmt' for target 'x86_64-unknown-linux-gnu' is unavailable for download for channel nightly
Sometimes not all components are available in any given nightly.
##[error]The process '/usr/share/rust/.cargo/bin/rustup' failed with exit code 1
##[error]Node run failed with exit code 1

See https://github.com/rust-osdev/bootloader/runs/433499174 for the full workflow output.

Are we doing anything wrong? Our project has a rust-toolchain file, in case that's relevant to this issue.

Thank you for a bug report! This issue was fixed in v1.0.6 release (also available as v1 tag).

Problem is that rustup needs --allow-downgrade in that case, which is now passed if both of the following conditions apply:

  1. toolchain input is strictly equal to nightly
  2. At least one component requested.

Motivation for this limitation is that if user wants to get latest nightly with, let's say, clippy, we should do our best to find it, but if they want to use some specific version, ex. nightly-2020-03-19 (either via toolchain input or via rust-toolchain file), we should not downgrade at all and better leave that up to user themself.

Fortunately for this issue, today version of nightly misses both clippy and rustfmt, so this behavior can be easily tested:

image

Here is how Action logs looks in that case:

/usr/share/rust/.cargo/bin/rustup toolchain install nightly --component rustfmt --component clippy --allow-downgrade
info: syncing channel updates for 'nightly-x86_64-unknown-linux-gnu'
info: latest update on 2020-03-24, rust version 1.44.0-nightly (1edd389cc 2020-03-23)
info: skipping nightly which is missing installed component 'clippy-preview'
info: syncing channel updates for 'nightly-2020-03-23-x86_64-unknown-linux-gnu'
info: latest update on 2020-03-23, rust version 1.44.0-nightly (d1e81ef23 2020-03-22)
info: skipping nightly which is missing installed component 'rustfmt-preview'
info: syncing channel updates for 'nightly-2020-03-22-x86_64-unknown-linux-gnu'
info: latest update on 2020-03-22, rust version 1.44.0-nightly (38114ff16 2020-03-21)
info: skipping nightly which is missing installed component 'clippy-preview'
info: syncing channel updates for 'nightly-2020-03-21-x86_64-unknown-linux-gnu'
info: latest update on 2020-03-21, rust version 1.44.0-nightly (1057dc97a 2020-03-20)
info: skipping nightly which is missing installed component 'clippy-preview'
info: syncing channel updates for 'nightly-2020-03-20-x86_64-unknown-linux-gnu'
info: latest update on 2020-03-20, rust version 1.44.0-nightly (f4c675c47 2020-03-19)
info: skipping nightly which is missing installed component 'clippy-preview'
info: syncing channel updates for 'nightly-2020-03-19-x86_64-unknown-linux-gnu'
info: latest update on 2020-03-19, rust version 1.44.0-nightly (f509b26a7 2020-03-18)
info: downloading component 'cargo'
info: downloading component 'clippy'
info: downloading component 'rust-std'
info: downloading component 'rustc'
info: downloading component 'rustfmt'
info: installing component 'cargo'
info: installing component 'clippy'
info: installing component 'rust-std'
info: installing component 'rustc'
info: installing component 'rustfmt'

  nightly-x86_64-unknown-linux-gnu installed - rustc 1.44.0-nightly (f509b26a7 2020-03-18)

Documentation is also updated to represent that issue and how this Action handles it: https://github.com/actions-rs/toolchain#components