1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108
|
name: Test
on:
push:
branches:
- master
pull_request:
# This uses the toolchain defined in rust-toolchain
jobs:
fmt:
name: "Rustfmt"
runs-on: ubuntu-latest
env:
# Rustfmt requires a nightly toolchain because we use unstable rules. The
# chosen version is fairly arbitrary
TOOLCHAIN: nightly-2024-04-20
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.TOOLCHAIN }}
components: rustfmt
- name: Cache Rust files
uses: swatinem/rust-cache@v2
- name: Rustfmt
run: cargo +${{ env.TOOLCHAIN }} fmt -- --check
lint:
name: Check/Lint - ${{ matrix.platform.name }}
strategy:
fail-fast: false
matrix:
# Run linting on every platform to make sure we didn't break any builds.
# This is a subset of the Rust targets we support, just one per OS.
platform:
- name: Linux
os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- name: Windows
os: windows-latest
target: x86_64-pc-windows-msvc
- name: macOS
os: macOS-latest
target: aarch64-apple-darwin
runs-on: ${{ matrix.platform.os }}
steps:
- uses: actions/checkout@v4
- name: Cache Rust files
uses: swatinem/rust-cache@v2
with:
key: ${{ matrix.platform.target }}
- name: Install toolchain
run: rustup target add ${{ matrix.platform.target }}
- name: Clippy
run: cargo clippy --target ${{ matrix.platform.target }} --all-targets --all-features -- -D clippy::all
doc:
name: Check Docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Cache Rust files
uses: swatinem/rust-cache@v2
- name: Doc
run: cargo doc --no-deps --all-features --document-private-items
env:
RUSTDOCFLAGS: -D warnings
test:
name: Test - ${{ matrix.platform.name }}
strategy:
fail-fast: false
matrix:
# Run tests on every platform. This is a subset of the Rust targets we
# support, just one per OS.
platform:
- name: Linux
os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- name: Windows
os: windows-latest
target: x86_64-pc-windows-msvc
- name: macOS
os: macOS-latest
target: aarch64-apple-darwin
runs-on: ${{ matrix.platform.os }}
steps:
- uses: actions/checkout@v4
- name: Cache Rust files
uses: swatinem/rust-cache@v2
with:
key: ${{ matrix.platform.target }}
- name: Install toolchain
run: rustup target add ${{ matrix.platform.target }}
- name: Run tests
run: cargo test --workspace
|