Skip to content

Commit

Permalink
ci: install rust with pinned version (#247)
Browse files Browse the repository at this point in the history
PR installs rust in CI with pinned version

close #240

- [x] Does not require a CHANGELOG entry
  • Loading branch information
alvicsam authored Mar 27, 2024
1 parent bc9491d commit 2477277
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 65 deletions.
2 changes: 2 additions & 0 deletions .github/env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
RUST_STABLE_VERSION=1.76.0
RUST_NIGHTLY_VERSION=2024-03-14
15 changes: 7 additions & 8 deletions .github/workflows/clippy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,21 @@ jobs:
- name: Install updates and protobuf-compiler
run: sudo apt update && sudo apt install --assume-yes cmake protobuf-compiler

- name: Install nightly toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
components: clippy

- name: Checkout
uses: actions/checkout@v3

- name: Set rust version via common env file
run: cat .github/env >> $GITHUB_ENV

- name: Install nightly toolchain
run: rustup toolchain install "nightly-$RUST_NIGHTLY_VERSION" --profile minimal --component clippy

- name: Fetch cache
uses: Swatinem/rust-cache@a95ba195448af2da9b00fb742d14ffaaf3c21f43 # v2.7.0
with:
shared-key: "fellowship-cache-clippy"

- name: Clippy
run: cargo +nightly clippy --all-targets --locked -q
run: cargo +nightly-$RUST_NIGHTLY_VERSION clippy --all-targets --locked -q
env:
SKIP_WASM_BUILD: 1
16 changes: 7 additions & 9 deletions .github/workflows/fmt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,14 @@ jobs:
runs-on: ubuntu-22.04

steps:

- name: Install nightly toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
components: rustfmt

- name: Checkout
uses: actions/checkout@v3

- name: Set rust version via common env file
run: cat .github/env >> $GITHUB_ENV

- name: Install nightly toolchain
run: rustup toolchain install "nightly-$RUST_NIGHTLY_VERSION" --profile minimal --component rustfmt

- name: Rustfmt (check)
run: cargo +nightly fmt --all -- --check
run: cargo +nightly-$RUST_NIGHTLY_VERSION fmt --all -- --check
81 changes: 33 additions & 48 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
echo "itest=$TASKS" >> $GITHUB_OUTPUT
runtime-test:
needs: [ runtime-matrix ]
needs: [runtime-matrix]
continue-on-error: true
runs-on: ubuntu-22.04
strategy:
Expand All @@ -65,24 +65,19 @@ jobs:
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
df -h
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
target: wasm32-unknown-unknown
components: rust-src

- name: Install nightly toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
target: wasm32-unknown-unknown

- name: Checkout
uses: actions/checkout@v3

- name: Set rust version via common env file
run: cat .github/env >> $GITHUB_ENV

- name: Install stable toolchain
run: |
rustup install $RUST_STABLE_VERSION
rustup default $RUST_STABLE_VERSION
rustup target add wasm32-unknown-unknown
rustup component add rust-src
- name: Fetch cache
uses: Swatinem/rust-cache@a95ba195448af2da9b00fb742d14ffaaf3c21f43 # v2.7.0
with:
Expand All @@ -100,7 +95,7 @@ jobs:
SKIP_WASM_BUILD: 1

integration-test:
needs: [ integration-test-matrix ]
needs: [integration-test-matrix]
continue-on-error: true
runs-on: ubuntu-22.04
strategy:
Expand All @@ -126,24 +121,19 @@ jobs:
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
df -h
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
target: wasm32-unknown-unknown
components: rust-src

- name: Install nightly toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
target: wasm32-unknown-unknown

- name: Checkout
uses: actions/checkout@v3

- name: Set rust version via common env file
run: cat .github/env >> $GITHUB_ENV

- name: Install stable toolchain
run: |
rustup install $RUST_STABLE_VERSION
rustup default $RUST_STABLE_VERSION
rustup target add wasm32-unknown-unknown
rustup component add rust-src
- name: Fetch cache
uses: Swatinem/rust-cache@a95ba195448af2da9b00fb742d14ffaaf3c21f43 # v2.7.0
with:
Expand Down Expand Up @@ -176,24 +166,19 @@ jobs:
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
df -h
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
target: wasm32-unknown-unknown
components: rust-src

- name: Install nightly toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
target: wasm32-unknown-unknown

- name: Checkout
uses: actions/checkout@v3

- name: Set rust version via common env file
run: cat .github/env >> $GITHUB_ENV

- name: Install stable toolchain
run: |
rustup install $RUST_STABLE_VERSION
rustup default $RUST_STABLE_VERSION
rustup target add wasm32-unknown-unknown
rustup component add rust-src
- name: Fetch cache
uses: Swatinem/rust-cache@a95ba195448af2da9b00fb742d14ffaaf3c21f43 # v2.7.0
with:
Expand All @@ -203,4 +188,4 @@ jobs:
run: cargo test -p chain-spec-generator --release --locked -q --features=runtime-benchmarks
env:
RUSTFLAGS: "-C debug-assertions -D warnings"
SKIP_WASM_BUILD: 1
SKIP_WASM_BUILD: 1

0 comments on commit 2477277

Please sign in to comment.