chore: use 1.83.0 for dev, 1.80.0 for building contract #358
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Rust Contracts | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
env: | |
RUST_BACKTRACE: full | |
PRIMARY_RUST_VERSION: 1.83.0 | |
MSRV: 1.80.0 | |
jobs: | |
tests: | |
name: Tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
# Install the primary Rust version first | |
- name: Install primary toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: ${{ env.PRIMARY_RUST_VERSION }} | |
override: false # Don't override - we want multiple versions | |
target: wasm32-unknown-unknown | |
# Install the MSRV (Minimum Supported Rust Version) | |
- name: Install MSRV toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: ${{ env.MSRV }} | |
override: false # Don't override - allow local rust-toolchain files to take precedence | |
target: wasm32-unknown-unknown | |
- uses: Swatinem/rust-cache@v1 | |
with: | |
key: rust-multi-version-${{ env.PRIMARY_RUST_VERSION }}-${{ env.MSRV }} | |
- name: add wasm32-unknown-unknown for both toolchains | |
run: | | |
rustup target add wasm32-unknown-unknown --toolchain ${{ env.PRIMARY_RUST_VERSION }} | |
rustup target add wasm32-unknown-unknown --toolchain ${{ env.MSRV }} | |
# Set the primary toolchain as default but allow local rust-toolchain files to override | |
- name: Set default toolchain | |
run: rustup default ${{ env.PRIMARY_RUST_VERSION }} | |
# List installed toolchains for debugging purposes | |
- name: Show installed toolchains | |
run: rustup toolchain list | |
- name: cargo test | |
run: cargo test --all --all-features | |
lint: | |
name: Format | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
- name: Install toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: ${{ env.PRIMARY_RUST_VERSION }} | |
override: true | |
components: rustfmt, clippy | |
- uses: Swatinem/rust-cache@v1 | |
with: | |
key: rust-version-${{ env.PRIMARY_RUST_VERSION }}-fmt-clippy | |
- name: cargo fmt | |
run: cargo fmt --all -- --check | |
- name: cargo clippy | |
run: cargo clippy --all --all-features --all-targets -- -D warnings |