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

fix: upgrade the toolchain #325

Merged
merged 6 commits into from
Feb 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ take a look at the following examples:
| target | No | The `--target` option for Cargo | string | |
| container | No | manylinux docker container image name | string | Default depends on `target` and `manylinux` options, Set to `off` to disable manylinux docker build and build on the host instead. |
| docker-options | No | Additional Docker run options, for passing environment variables and etc. | string |
| rust-toolchain | No | Rust toolchain name | string | Defaults to `stable` for Docker build |
| rust-toolchain | No | Rust toolchain name. | string | Defaults to `stable` for Docker build. To use the latest available version for the host build, the user must specify this in the CI config or repo config. |
| rustup-components | No | Rustup components | string | Defaults to empty |
| working-directory | No | The working directory to run the command in | string | Defaults to the root of the repository |
| sccache | No | Enable sccache for faster builds | boolean | Defaults to `false` |
Expand Down
5 changes: 3 additions & 2 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11890,9 +11890,9 @@ async function dockerBuild(container, maturinRelease, hostHomeMount, args) {
const rustupComponents = core.getInput('rustup-components');
const commands = [
'#!/bin/bash',
'set -e',
'set -euo pipefail',
'echo "::group::Install Rust"',
`which rustup > /dev/null || curl --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain ${rustToolchain}`,
`command -v rustup &> /dev/null && { rm -frv ~/.rustup/toolchains/; rustup show; } || curl --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain ${rustToolchain}`,
'export PATH="$HOME/.cargo/bin:$HOME/.local/bin:$PATH"',
`echo "Install Rust toolchain ${rustToolchain}"`,
`rustup override set ${rustToolchain}`,
Expand Down Expand Up @@ -12116,6 +12116,7 @@ async function hostBuild(maturinRelease, args) {
core.startGroup('Install Rust target');
if (rustToolchain && rustToolchain.length > 0) {
core.info(`Installing Rust toolchain ${rustToolchain}`);
await exec.exec('rustup', ['update', '--no-self-update', rustToolchain]);
await exec.exec('rustup', ['override', 'set', rustToolchain]);
await exec.exec('rustup', ['component', 'add', 'llvm-tools-preview'], {
ignoreReturnCode: true
Expand Down
36 changes: 27 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"typescript": "^4.6.2"
},
"devDependencies": {
"@types/node": "^18.11.3",
"@types/node": "^18.19.76",
"@typescript-eslint/parser": "^5.40.1",
"@vercel/ncc": "^0.36.0",
"eslint": "^8.26.0",
Expand Down
6 changes: 4 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -632,10 +632,11 @@ async function dockerBuild(
const commands = [
'#!/bin/bash',
// Stop on first error
'set -e',
'set -euo pipefail',
// Install Rust
'echo "::group::Install Rust"',
`which rustup > /dev/null || curl --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain ${rustToolchain}`,
// refer to https://github.com/rust-lang/rustup/issues/1167#issuecomment-367061388
`command -v rustup &> /dev/null && { rm -frv ~/.rustup/toolchains/; rustup show; } || curl --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain ${rustToolchain}`,
'export PATH="$HOME/.cargo/bin:$HOME/.local/bin:$PATH"',
`echo "Install Rust toolchain ${rustToolchain}"`,
`rustup override set ${rustToolchain}`,
Expand Down Expand Up @@ -936,6 +937,7 @@ async function hostBuild(
core.startGroup('Install Rust target')
if (rustToolchain && rustToolchain.length > 0) {
core.info(`Installing Rust toolchain ${rustToolchain}`)
await exec.exec('rustup', ['update', '--no-self-update', rustToolchain])
await exec.exec('rustup', ['override', 'set', rustToolchain])
await exec.exec('rustup', ['component', 'add', 'llvm-tools-preview'], {
ignoreReturnCode: true
Expand Down
Loading