Skip to content

Commit 06e01cb

Browse files
committed
Use own rustup action instead of external one
1 parent b7f3070 commit 06e01cb

File tree

2 files changed

+58
-3
lines changed

2 files changed

+58
-3
lines changed

.github/actions/rustup/action.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: rustup toolchain install
2+
description: Install the Rust toolchain
3+
4+
inputs:
5+
toolchain:
6+
description: 'Identifier of the rust toolchain to install'
7+
required: false
8+
default: 'stable'
9+
type: string
10+
targets:
11+
description: 'Rust compiler targets to install, as a space-delimited list'
12+
required: false
13+
default: ''
14+
type: string
15+
components:
16+
description: 'List of components to install via rustup, as a space-delimited list'
17+
required: false
18+
default: ''
19+
type: string
20+
21+
runs:
22+
using: composite
23+
steps:
24+
- run: |
25+
if ! command -v rustup &>/dev/null; then
26+
curl --proto '=https' --tlsv1.2 --retry 10 --retry-connrefused -fsSL "https://sh.rustup.rs" | sh -s -- -y
27+
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
28+
fi
29+
shell: bash
30+
31+
- run: rustup override unset
32+
shell: bash
33+
34+
- run: rustup default ${{ inputs.toolchain }}
35+
shell: bash
36+
37+
- if: ${{ inputs.targets != '' }}
38+
run: rustup target add ${{ inputs.targets }}
39+
shell: bash
40+
41+
- if: ${{ inputs.components != '' }}
42+
run: rustup component add ${{ inputs.components }}
43+
shell: bash
44+
45+
- run: |
46+
echo "CARGO_NET_RETRY=10" >> $GITHUB_ENV
47+
echo "CARGO_TERM_COLOR=always" >> $GITHUB_ENV
48+
echo "RUSTUP_MAX_RETRIES=10" >> $GITHUB_ENV
49+
shell: bash
50+
51+
- run: rustup show active-toolchain || rustup toolchain install
52+
shell: bash
53+
54+
- run: rustc --version --verbose
55+
shell: bash

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,16 @@ jobs:
2222
triple: x86_64-unknown-linux-gnu
2323
runs-on: [ self-hosted, cluster, "${{ matrix.os }}", "${{ matrix.arch }}" ]
2424
steps:
25-
- name: Install Rust
26-
uses: actions-rust-lang/setup-rust-toolchain@v1
27-
2825
- name: Check out risc0/rust
2926
uses: actions/checkout@v3
3027
with:
3128
submodules: 'recursive'
3229
path: rust
3330
fetch-depth: 0
3431

32+
- name: Install Rust
33+
uses: ./rust/.github/actions/rustup
34+
3535
- name: Check out risc0/risc0
3636
uses: actions/checkout@v4
3737
with:

0 commit comments

Comments
 (0)