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

Support new TOML format for rust-toolchain #126

Open
2 of 3 tasks
Pytal opened this issue Nov 27, 2020 · 17 comments · May be fixed by #166
Open
2 of 3 tasks

Support new TOML format for rust-toolchain #126

Pytal opened this issue Nov 27, 2020 · 17 comments · May be fixed by #166
Labels
enhancement New feature or request

Comments

@Pytal
Copy link
Contributor

Pytal commented Nov 27, 2020

Do the checklist before filing an issue:

Motivation

As announced with Rustup 1.23.0 and documented here, there is a new TOML syntax for the rust-toolchain file which should be supported by this action.

Workflow Failure

Additionally using the TOML syntax without specifying the toolchain input will cause the workflow to fail.

@Pytal Pytal added the enhancement New feature or request label Nov 27, 2020
@svartalf
Copy link
Member

rustup is installed already on the virtual machines and upgraded by this action only if need (ex. profile input is set, but available rustup does not supports it).

In this case we should probably try to parse rust-toolchain file to see if it looks like a TOML; if it is a case, rustup needs to be upgraded first.

@jrvanwhy
Copy link

jrvanwhy commented Dec 2, 2020

Updating rustup isn't the only problem. The current ubuntu-latest version -- 20201129.1 -- already has rustup 1.23.0 (I don't know if it's at 100% deployment yet), yet I received the following error in an action run:

/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.47.0-nightly (32c654a97 2020-08-19)`
Installed rustup 1.23.0 support profiles
/usr/share/rust/.cargo/bin/rustup set profile minimal
info: profile set to 'minimal'
/usr/share/rust/.cargo/bin/rustup toolchain install [toolchain]
# See https://rust-lang.github.io/rustup-components-history/ for a list of
# recently nightlies and what components are available for them.
channel = "nightly-2020-08-20"
components = ["clippy", "miri", "rustfmt"]
targets = ["thumbv7em-none-eabi",
           "riscv32imac-unknown-none-elf",
           "riscv32imc-unknown-none-elf"]
error: invalid toolchain name: '[toolchain]
# See https://rust-lang.github.io/rustup-components-history/ for a list of
# recently nightlies and what components are available for them.
channel = "nightly-2020-08-20"
components = ["clippy", "miri", "rustfmt"]
targets = ["thumbv7em-none-eabi",
           "riscv32imac-unknown-none-elf",
           "riscv32imc-unknown-none-elf"]'
Error: The process '/usr/share/rust/.cargo/bin/rustup' failed with exit code 1

The full workflow execution is at https://github.com/tock/libtock-rs/pull/263/checks?check_run_id=1484520959

EDIT: I forgot to say this, but it appears that this action is trying to pass the contents of rust-toolchain to rustup as a command line argument.

jrvanwhy added a commit to jrvanwhy/libtock-rs that referenced this issue Dec 2, 2020
Rustup will not automatically install the correct targets, so we no longer need the `rustup target add` steps. After this, the `actions-rs/toolchain` step doesn't give us much, and is currently broken (actions-rs/toolchain#126), so I removed that step as well.
@fpoli
Copy link

fpoli commented Dec 2, 2020

rustup is installed already and upgraded by this action only if need

I'm not sure that would work on MacOS. I just found that on macos-latest a manual rustup self update fails with "error: self-update is disabled for this build of rustup".

@ebroto
Copy link

ebroto commented Dec 9, 2020

EDIT: I forgot to say this, but it appears that this action is trying to pass the contents of rust-toolchain to rustup as a command line argument.

Yes, I think that's the case, see

toolchain/src/args.ts

Lines 28 to 35 in 553f0f7

const rustToolchainFile = readFileSync(overrideFile, {
encoding: "utf-8",
flag: "r",
}).trim();
debug(`using toolchain from rust-toolchain file: ${rustToolchainFile}`);
return rustToolchainFile;
and

toolchain/src/args.ts

Lines 44 to 45 in 553f0f7

return {
name: determineToolchain(overrideFile),

alistair23 pushed a commit to tock/libtock-rs that referenced this issue Dec 11, 2020
Rustup will not automatically install the correct targets, so we no longer need the `rustup target add` steps. After this, the `actions-rs/toolchain` step doesn't give us much, and is currently broken (actions-rs/toolchain#126), so I removed that step as well.
@Kixunil
Copy link

Kixunil commented Jan 14, 2021

Hint for people who got bitten by this: just run rustup show, you probably don't need this whole project then.

Yes, it's retarded workaround/name for a command but better than waiting eternity for someone to fix this.

@shonfeder
Copy link

shonfeder commented Feb 22, 2021

Your hint helped me, thanks @Kixunil. To make the hint more explicit:

If you're using a toml rust-toolchain file, you can just replace

      - name: Setup rust toolchain
        uses: actions-rs/toolchain@v1

with

      - name: Setup rust toolchain
        run: rustup show

@JoshOrndorff
Copy link

Hi there, I can easily solve this, but I'm stuck because of #163 Any ehlp appreciated.

The just-run-rustup-show trick is great iff you already have rustup installed on your ci machine. Any tips for that?

@crawfxrd
Copy link

The just-run-rustup-show trick is great iff you already have rustup installed on your ci machine. Any tips for that?

If you're using shared runners, it's already there and you just run the command.

If you're using self-hosted runners, you control what's installed on the image. So refer to how GitHub sets up Rust.

@boaz-codota
Copy link

What is missing to support this? I'm willing to make the contribution, just not sure where to start

@boaz-codota boaz-codota linked a pull request Apr 5, 2021 that will close this issue
@boaz-codota
Copy link

Please merge: #166

boaz-codota added a commit to codota/toolchain that referenced this issue Apr 5, 2021
SeraphyBR added a commit to SeraphyBR/seraphybr.github.io that referenced this issue May 4, 2021
UpsettingBoy added a commit to UpsettingBoy/rocket-template that referenced this issue Jun 4, 2021
UpsettingBoy added a commit to UpsettingBoy/rocket-template that referenced this issue Jun 4, 2021
* Initial actions setup
* Removed toolchain option
* TOML file not supported yet by rust-actions
See  actions-rs/toolchain#126
* Downgraded toolchain file to pre-rustup 1.23.0
mkroening pushed a commit to mkroening/toolchain that referenced this issue Jun 11, 2021
mkroening pushed a commit to mkroening/toolchain that referenced this issue Jun 11, 2021
bpowers added a commit to bpowers/simlin that referenced this issue Aug 11, 2021
PrettyWood added a commit to pydantic/pydantic-core that referenced this issue Jun 18, 2022
rust-toolchain does not support the new rust-toolchain.toml format
actions-rs/toolchain#126
samuelcolvin pushed a commit to pydantic/pydantic-core that referenced this issue Jun 20, 2022
* chore: ignore pyenv file

* fix(build): force use of nightly toolchain

* ci: simplify pipeline

* ci: use legacy format for rust-toolchain

rust-toolchain does not support the new rust-toolchain.toml format
actions-rs/toolchain#126
Wilfred added a commit to Wilfred/difftastic that referenced this issue Aug 27, 2022
It doesn't support rust-toolchain.toml per
actions-rs/toolchain#126 and it isn't
receiving new updates per
actions-rs/toolchain#216 .
@max-sixty
Copy link

If anyone else is hitting this, I found that:

heaths added a commit to heaths/msica-rs that referenced this issue Oct 16, 2022
dariuszparys pushed a commit to dariuszparys/chariott that referenced this issue Nov 15, 2022
Using now rustup show instead of the dedicated action-rs/toolchain
github action. This allows using the .toml extension. Thanks
@atifaziz for pointing out
actions-rs/toolchain#126 (comment)
threadexio added a commit to threadexio/zeus that referenced this issue Jan 22, 2023
Signed-off-by: threadexio <pzarganitis@gmail.com>
@dsherret
Copy link

dsherret commented Mar 10, 2023

I found that project was also nice and minimal, but didn't want to support the rust-toolchain.toml file so I created a fork of it that is specifically for this functionality for anyone else who needs it: https://github.com/dsherret/rust-toolchain-file

@nazar-pc
Copy link

nazar-pc commented Mar 10, 2023

Default cargo installation in GitHub Actions already honors toolchain file, you don't even need an action to install anything, it "just works" automatically and will download toolchains and specified components if they are not yet available.

Simply remove actions-rs/toolchain from your workflow, it is no longer necessary.

@dsherret
Copy link

dsherret commented Mar 10, 2023

@nazar-pc you're right! I just tested it out switching between versions and it seems to work. I wish I had known that earlier. Thanks!

Edit: Huh, one drawback is it doesn't do other setup stuff like setup colours and enable the new sparse registry protocol like what dtolnay/rust-toolchain does. All the output is white text. I'm going to keep using the fork for the time being and just slim it down to skip the rustup steps.

image

@nazar-pc
Copy link

For colors you need to set CARGO_TERM_COLOR: always in environment variables, same for other features.

@dsherret
Copy link

dsherret commented Mar 10, 2023

@nazar-pc yeah, but it's more verbose compared to a single line and doing this helps keep multiple repos in sync. I like the defaults dtolnay/rust-toolchain does and it helps me not have to worry about handling differences in those defaults when upgrading versions.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request