Skip to content

Commit

Permalink
Test multiple versions of rust.
Browse files Browse the repository at this point in the history
  • Loading branch information
joaander committed May 19, 2024
1 parent 0a4ad20 commit 140a63c
Showing 1 changed file with 19 additions and 14 deletions.
33 changes: 19 additions & 14 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,29 +22,34 @@ env:
CLICOLOR: 1
MDBOOK_VERSION: 0.4.37
LINKCHECK_VERSION: 0.7.7
RUST_VERSION: 1.78.0
RUST_LATEST_VERSION: 1.78.0

jobs:
unit_test:
name: Unit test on ${{ matrix.os }} [${{ matrix.mode }}]
name: Unit test on ${{ matrix.os }} [rust-${{ matrix.rust }}-${{ matrix.mode }}]
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-22.04
# - macos-14
mode: [debug, release]
- macos-14
rust:
# Oldest supported version of rust
- 1.77.2
- 1.78.0
mode:
- debug

include:
- mode: 'debug'
mode_option: ''
- mode: 'release'
mode_option: '--release'
# Add a release build on linux with the latest version of rust
- os: ubuntu-22.04
rust: 1.78.0
mode: release

steps:
- uses: actions/[email protected]
- name: Update rust
run: rustup install "$RUST_VERSION" --no-self-update && rustup default "${RUST_VERSION}"
run: rustup install ${{ matrix.rust }} --no-self-update && rustup default ${{ matrix.rust }}
- name: Check rust installation
run: rustc -vV
- uses: actions/[email protected]
Expand All @@ -54,19 +59,19 @@ jobs:
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-rust-${{ env.RUST_VERSION }}-cargo-unit-test-${{ matrix.mode }}-${{ hashFiles('**/Cargo.lock') }}
key: ${{ runner.os }}-rust-${{ matrix.rust }}-cargo-unit-test-${{ matrix.mode }}-${{ hashFiles('**/Cargo.lock') }}
- name: Build
run: cargo build ${{ matrix.mode_option }} --verbose
run: cargo build ${{ matrix.mode == 'release' && '--release' || '' }} --verbose
- name: Run tests
run: cargo test ${{ matrix.mode_option }} --verbose
run: cargo test ${{ matrix.mode == 'release' && '--release' || '' }} --verbose

execute_tutorials:
name: Execute tutorials
runs-on: ubuntu-22.04
steps:
- uses: actions/[email protected]
- name: Update rust
run: rustup install "$RUST_VERSION" --no-self-update && rustup default "${RUST_VERSION}"
run: rustup install "$RUST_LATEST_VERSION" --no-self-update && rustup default "$RUST_LATEST_VERSION"
- name: Check rust installation
run: rustc -vV
- uses: actions/[email protected]
Expand All @@ -76,7 +81,7 @@ jobs:
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-rust-${{ env.RUST_VERSION }}-cargo-execute-tutorials-${{ hashFiles('**/Cargo.lock') }}
key: ${{ runner.os }}-rust-${{ env.RUST_LATEST_VERSION }}-cargo-execute-tutorials-${{ hashFiles('**/Cargo.lock') }}
- name: Install
run: cargo install --path . --locked --verbose
- name: Run hello.sh
Expand Down

0 comments on commit 140a63c

Please sign in to comment.