Skip to content

Commit

Permalink
Use rust toolchain version in workflows (#303)
Browse files Browse the repository at this point in the history
  • Loading branch information
MonicaOlejniczak authored Jan 7, 2025
1 parent 832353b commit 8fa60a0
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 22 deletions.
23 changes: 23 additions & 0 deletions .github/actions/rust-toolchain/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Install Rust
description: Install the Rust toolchain

inputs:
components:
description: Comma-separated list of components to be additionally installed
required: false
targets:
description: Comma-separated list of target triples to install for this toolchain
required: false

runs:
using: composite
steps:
- name: Set toolchain
run: echo "RUST_TOOLCHAIN=$(cat rust-toolchain)" >> $GITHUB_ENV
shell: bash
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
components: ${{ inputs.components }}
targets: ${{ inputs.targets }}
toolchain: ${{ env.RUST_TOOLCHAIN }}
13 changes: 4 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,9 @@ jobs:
- uses: actions/setup-node@v4
with:
cache: yarn
- uses: dtolnay/rust-toolchain@master
- uses: ./.github/actions/rust-toolchain
with:
toolchain: 1.83.0
components: rustfmt
components: clippy, rustfmt
- run: yarn --frozen-lockfile
- run: yarn lint

Expand Down Expand Up @@ -67,9 +66,7 @@ jobs:
with:
cache: yarn
node-version: ${{ matrix.node }}
- uses: dtolnay/rust-toolchain@master
with:
toolchain: 1.83.0
- uses: ./.github/actions/rust-toolchain
- uses: Swatinem/rust-cache@v2
with:
shared-key: ${{ matrix.os }}
Expand Down Expand Up @@ -98,9 +95,7 @@ jobs:
with:
cache: yarn
node-version: ${{ matrix.node }}
- uses: dtolnay/rust-toolchain@master
with:
toolchain: 1.83.0
- uses: ./.github/actions/rust-toolchain
- uses: Swatinem/rust-cache@v2
with:
shared-key: ${{ matrix.os }}
Expand Down
16 changes: 5 additions & 11 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,9 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@master
uses: ./.github/actions/rust-toolchain
with:
toolchain: 1.83.0
target: ${{ matrix.target }}
targets: ${{ matrix.target }}
- uses: bahmutov/[email protected]
- uses: Swatinem/rust-cache@v2
if: ${{ inputs.type != 'latest' }}
Expand Down Expand Up @@ -87,11 +86,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: 1.83.0
profile: minimal
override: true
uses: ./.github/actions/rust-toolchain
- uses: bahmutov/[email protected]
- name: Build native packages
run: yarn build-native-${{ inputs.profile }}
Expand Down Expand Up @@ -139,10 +134,9 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@master
uses: ./.github/actions/rust-toolchain
with:
toolchain: 1.83.0
target: ${{ matrix.target }}
targets: ${{ matrix.target }}
- name: Install cross compile toolchains
run: |
sudo apt-get update
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/repl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,8 @@ jobs:
with:
cache: yarn
node-version: 20
- uses: dtolnay/rust-toolchain@master
- uses: ./.github/actions/rust-toolchain
with:
toolchain: 1.83.0
targets: wasm32-unknown-unknown
- name: Install wasm-opt
run: |
Expand Down

0 comments on commit 8fa60a0

Please sign in to comment.