Skip to content
This repository has been archived by the owner on Oct 13, 2023. It is now read-only.

Using both rust-toolchain and toolchain leads to missing component #136

Open
l4l opened this issue Dec 4, 2020 · 1 comment
Open

Using both rust-toolchain and toolchain leads to missing component #136

l4l opened this issue Dec 4, 2020 · 1 comment
Labels
bug Something isn't working

Comments

@l4l
Copy link

l4l commented Dec 4, 2020

Description

Using both toolchain parameter and rust-toolchain file leads to weird behavior. Particularly the error is missing rustfmt: error: 'cargo-fmt' is not installed for the toolchain.

I did 2 pipeline runs, first one without rust-toolchain file (but with parameter toolchain) passes "Check format" step (though fails later, but unrelated to the project) and the second one (with both toolchain parameter and rust-toolchain file) fails with error message error: 'cargo-fmt' is not installed for the toolchain. Diff clearly states that the only interesting change is a rust-toolchain addition.

Workflow code

is the same for both cases:

name: CI

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

env:
  CARGO_TERM_COLOR: always

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v2
    - uses: actions-rs/toolchain@v1
      with:
        toolchain: stable
        components: rustfmt, clippy
    - name: Build
      run: cargo build --verbose
    - name: Check format
      run: cargo fmt -- --check
    - name: Lint
      run: cargo clippy -- -D warnings
    - name: Run tests
      run: cargo test --verbose

Action output

[First] install step
/usr/share/rust/.cargo/bin/rustup show
Default host: x86_64-unknown-linux-gnu
rustup home:  /home/runner/.rustup

info: syncing channel updates for '1.48.0-x86_64-unknown-linux-gnu'
info: latest update on 2020-11-19, rust version 1.48.0 (7eac88abb 2020-11-16)
info: downloading component 'cargo'
info: downloading component 'rust-std'
info: downloading component 'rustc'
info: installing component 'cargo'
info: using up to 500.0 MiB of RAM to unpack components
info: installing component 'rust-std'
info: installing component 'rustc'
1.48.0-x86_64-unknown-linux-gnu (overridden by '/home/runner/work/yofi/yofi/rust-toolchain')
rustc 1.48.0 (7eac88abb 2020-11-16)
/usr/share/rust/.cargo/bin/rustup -V
rustup 1.23.0 (00924c9ba 2020-11-27)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.48.0 (7eac88abb 2020-11-16)`
Installed rustup 1.23.0 support components
/usr/share/rust/.cargo/bin/rustup toolchain install stable --component rustfmt --component clippy
info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
info: latest update on 2020-11-19, rust version 1.48.0 (7eac88abb 2020-11-16)
info: component 'clippy' for target 'x86_64-unknown-linux-gnu' is up to date
info: component 'rustfmt' for target 'x86_64-unknown-linux-gnu' is up to date

  stable-x86_64-unknown-linux-gnu unchanged - rustc 1.48.0 (7eac88abb 2020-11-16)

info: checking for self-updates
info: downloading self-update
Gathering installed versions
  /usr/share/rust/.cargo/bin/rustc -V
  rustc 1.48.0 (7eac88abb 2020-11-16)
  /usr/share/rust/.cargo/bin/cargo -V
  cargo 1.48.0 (65cbdd2dc 2020-10-14)
  /usr/share/rust/.cargo/bin/rustup -V
  rustup 1.23.1 (3df2264a9 2020-11-30)
  info: This is the version for the rustup toolchain manager, not the rustc compiler.
  info: The currently active `rustc` version is `rustc 1.48.0 (7eac88abb 2020-11-16)`
[First] check format step (failed)
error: 'cargo-fmt' is not installed for the toolchain '1.48.0-x86_64-unknown-linux-gnu'
To install, run `rustup component add rustfmt --toolchain 1.48.0-x86_64-unknown-linux-gnu`
Error: Process completed with exit code 1.
[Second] install step
/usr/share/rust/.cargo/bin/rustup show
Default host: x86_64-unknown-linux-gnu
rustup home:  /home/runner/.rustup

stable-x86_64-unknown-linux-gnu (default)
rustc 1.48.0 (7eac88abb 2020-11-16)
/usr/share/rust/.cargo/bin/rustup -V
rustup 1.23.0 (00924c9ba 2020-11-27)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.48.0 (7eac88abb 2020-11-16)`
Installed rustup 1.23.0 support components
/usr/share/rust/.cargo/bin/rustup toolchain install stable --component rustfmt --component clippy
info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
info: latest update on 2020-11-19, rust version 1.48.0 (7eac88abb 2020-11-16)
info: component 'clippy' for target 'x86_64-unknown-linux-gnu' is up to date
info: component 'rustfmt' for target 'x86_64-unknown-linux-gnu' is up to date

  stable-x86_64-unknown-linux-gnu unchanged - rustc 1.48.0 (7eac88abb 2020-11-16)

info: checking for self-updates
info: downloading self-update
Gathering installed versions
  /usr/share/rust/.cargo/bin/rustc -V
  rustc 1.48.0 (7eac88abb 2020-11-16)
  /usr/share/rust/.cargo/bin/cargo -V
  cargo 1.48.0 (65cbdd2dc 2020-10-14)
  /usr/share/rust/.cargo/bin/rustup -V
  rustup 1.23.1 (3df2264a9 2020-11-30)
  info: This is the version for the rustup toolchain manager, not the rustc compiler.
  info: The currently active `rustc` version is `rustc 1.48.0 (7eac88abb 2020-11-16)`
[Second] check format step (succeeded)
Run cargo fmt -- --check
Install step diff
5,14c5
< info: syncing channel updates for '1.48.0-x86_64-unknown-linux-gnu'
< info: latest update on 2020-11-19, rust version 1.48.0 (7eac88abb 2020-11-16)
< info: downloading component 'cargo'
< info: downloading component 'rust-std'
< info: downloading component 'rustc'
< info: installing component 'cargo'
< info: using up to 500.0 MiB of RAM to unpack components
< info: installing component 'rust-std'
< info: installing component 'rustc'
< 1.48.0-x86_64-unknown-linux-gnu (overridden by '/home/runner/work/yofi/yofi/rust-toolchain')
---
> stable-x86_64-unknown-linux-gnu (default)

Expected behavior

Don't really know actually. Perhaps cargo fmt should not fail, or maybe there should be some more descriptive error that toolchain and rust-toolchain are mutually exclusive.

@l4l l4l added the bug Something isn't working label Dec 4, 2020
@humb1t
Copy link

humb1t commented Jun 28, 2023

@l4l thank you - I was trying to understand what's wrong with CI and your hint saved me a lot of time.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Development

No branches or pull requests

2 participants