actions-rs / toolchain

🛠️ GitHub Action for `rustup` commands
https://github.com/marketplace/actions/rust-toolchain
MIT License
585 stars 86 forks source link

Build doesn't use nightly even when toolchain specifies nightly #226

Closed lexicalunit closed 1 year ago

lexicalunit commented 1 year ago

Do the checklist before filing an issue:

Description

I need my build to happen with a nightly version of rustc, however it does not seem to be possible to do this.

Workflow code

on: [push]

name: CI

jobs:
  build_and_test:
    name: Rust Test
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions-rs/toolchain@v1
        with:
            toolchain: nightly
            override: true
            components: rustfmt, clippy
      - uses: actions-rs/cargo@v1
        with:
          command: build
          args: --release --all-features

Action output

Run actions-rs/toolchain@v1

info: installing component 'cargo'
info: installing component 'rust-std'
info: installing component 'rustc'
  nightly-x86_64-unknown-linux-gnu installed - rustc 1.67.0-nightly (234151769 2022-12-03)
info: checking for self-updates
warning: tool `rustfmt` is already installed, remove it from `/home/runner/.cargo/bin`, then run `rustup update` to have rustup manage this tool.
warning: tool `cargo-fmt` is already installed, remove it from `/home/runner/.cargo/bin`, then run `rustup update` to have rustup manage this tool.
Gathering installed versions
  /home/runner/.cargo/bin/rustc -V
  rustc 1.65.0 (897e37553 2022-11-02)
  Warning: The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
  Warning: The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
  /home/runner/.cargo/bin/cargo -V
  cargo 1.65.0 (4bc8f24d3 2022-10-20)
  Warning: The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
  /home/runner/.cargo/bin/rustup -V
  rustup 1.25.1 (bb60b1e89 2022-07-12)
  info: This is the version for the rustup toolchain manager, not the rustc compiler.
  info: The currently active `rustc` version is `rustc 1.65.0 (897e37553 2022-11-02)`
  Warning: The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/

Run actions-rs/cargo@v1

/home/runner/.cargo/bin/cargo build --release --all-features
    Updating crates.io index
 Downloading crates ...
[...]
error: failed to run custom build command for `pear_codegen v0.1.5`
Error: failed to run custom build command for `pear_codegen v0.1.5`
Caused by:
  process didn't exit successfully: `/home/runner/work/rust-test/rust-test/target/release/build/pear_codegen-aaead5ea68d420a2/build-script-build` (exit status: 101)
  --- stderr
  Error: Pear requires a 'dev' or 'nightly' version of rustc.
  Installed version: 1.65.0 (2022-11-02)
  Minimum required:  1.31.0-nightly (2018-10-05)
  thread 'main' panicked at 'Aborting compilation due to incompatible compiler.', /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/pear_codegen-0.1.5/build.rs:24:13
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
Error: The process '/home/runner/.cargo/bin/cargo' failed with exit code 101

Expected behavior

In the Run actions-rs/cargo@v1 action it errors out because the version of rustc is not nightly, which it should be based on the config for actions-rs/toolchain@v1.

lexicalunit commented 1 year ago

Ah, you also need to specify toolchain: nightly in the actions-rs/cargo@v1 too. Got it.