Merge pull request #99 from jlebon/pr/oci #115
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
# Maintained in https://github.com/coreos/repo-templates | |
# Do not edit downstream. | |
name: Rust | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
permissions: | |
contents: read | |
# don't waste job slots on superseded code | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
CARGO_TERM_COLOR: always | |
# Minimum supported Rust version (MSRV) | |
MSRV: 1.61.0 | |
# Pinned toolchain for linting | |
ACTIONS_LINTS_TOOLCHAIN: 1.75.0 | |
jobs: | |
tests-stable: | |
name: Tests, stable toolchain | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v3 | |
- name: Install toolchain | |
uses: dtolnay/rust-toolchain@v1 | |
with: | |
toolchain: stable | |
- name: Cache build artifacts | |
uses: Swatinem/rust-cache@v2 | |
- name: cargo build | |
run: cargo build --all-targets | |
- name: cargo test | |
run: cargo test --all-targets | |
tests-release-stable: | |
name: Tests (release), stable toolchain | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v3 | |
- name: Install toolchain | |
uses: dtolnay/rust-toolchain@v1 | |
with: | |
toolchain: stable | |
- name: Cache build artifacts | |
uses: Swatinem/rust-cache@v2 | |
- name: cargo build (release) | |
run: cargo build --all-targets --release | |
- name: cargo test (release) | |
run: cargo test --all-targets --release | |
tests-release-msrv: | |
name: Tests (release), minimum supported toolchain | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v3 | |
- name: Install toolchain | |
uses: dtolnay/rust-toolchain@v1 | |
with: | |
toolchain: ${{ env.MSRV }} | |
- name: Cache build artifacts | |
uses: Swatinem/rust-cache@v2 | |
- name: cargo build (release) | |
run: cargo build --all-targets --release | |
- name: cargo test (release) | |
run: cargo test --all-targets --release | |
linting: | |
name: Lints, pinned toolchain | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v3 | |
- name: Install toolchain | |
uses: dtolnay/rust-toolchain@v1 | |
with: | |
toolchain: ${{ env.ACTIONS_LINTS_TOOLCHAIN }} | |
components: rustfmt, clippy | |
- name: Cache build artifacts | |
uses: Swatinem/rust-cache@v2 | |
- name: cargo fmt (check) | |
run: cargo fmt -- --check -l | |
- name: cargo clippy (warnings) | |
run: cargo clippy --all-targets -- -D warnings | |
tests-other-channels: | |
name: Tests, unstable toolchain | |
runs-on: ubuntu-latest | |
continue-on-error: true | |
strategy: | |
matrix: | |
channel: [beta, nightly] | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v3 | |
- name: Install toolchain | |
uses: dtolnay/rust-toolchain@v1 | |
with: | |
toolchain: ${{ matrix.channel }} | |
- name: Cache build artifacts | |
uses: Swatinem/rust-cache@v2 | |
- name: cargo build | |
run: cargo build --all-targets | |
- name: cargo test | |
run: cargo test --all-targets |