| 1 |
name: CI |
| 2 |
|
| 3 |
env: |
| 4 |
CARGO_TERM_VERBOSE: true |
| 5 |
RUSTDOCFLAGS: -Dwarnings |
| 6 |
RUSTFLAGS: -Dwarnings |
| 7 |
|
| 8 |
on: |
| 9 |
pull_request: |
| 10 |
push: |
| 11 |
branches: |
| 12 |
- master |
| 13 |
|
| 14 |
jobs: |
| 15 |
test: |
| 16 |
name: Tests |
| 17 |
runs-on: ${{ matrix.os }} |
| 18 |
strategy: |
| 19 |
matrix: |
| 20 |
channel: |
| 21 |
- stable |
| 22 |
- nightly |
| 23 |
- 1.63.0 # MSRV of test dependencies |
| 24 |
os: |
| 25 |
- macos-13 # x86 MacOS |
| 26 |
- macos-15 # Arm MacOS |
| 27 |
- windows-2025 |
| 28 |
- ubuntu-24.04 |
| 29 |
include: |
| 30 |
- channel: beta |
| 31 |
os: ubuntu-24.04 |
| 32 |
|
| 33 |
steps: |
| 34 |
- name: Checkout repository |
| 35 |
uses: actions/checkout@v4 |
| 36 |
|
| 37 |
- name: Update rust |
| 38 |
run: | |
| 39 |
rustup default ${{ matrix.channel }} |
| 40 |
rustup update --no-self-update |
| 41 |
|
| 42 |
- run: cargo test --all |
| 43 |
|
| 44 |
clippy: |
| 45 |
name: Clippy |
| 46 |
runs-on: ubuntu-24.04 |
| 47 |
steps: |
| 48 |
- name: Checkout repository |
| 49 |
uses: actions/checkout@v4 |
| 50 |
|
| 51 |
- name: Update rust |
| 52 |
run: | |
| 53 |
# use beta since it gives us near-latest fixes but isn't as volatile as nightly |
| 54 |
rustup default beta |
| 55 |
rustup component add clippy |
| 56 |
rustup update --no-self-update |
| 57 |
- run: cargo clippy --all -- -Aclippy::while_let_loop |
| 58 |
|
| 59 |
msrv: |
| 60 |
name: Check building with the MSRV |
| 61 |
runs-on: ubuntu-24.04 |
| 62 |
steps: |
| 63 |
- name: Checkout repository |
| 64 |
uses: actions/checkout@v4 |
| 65 |
|
| 66 |
- name: Update rust |
| 67 |
run: | |
| 68 |
rustup default 1.63.0 |
| 69 |
rustup update --no-self-update |
| 70 |
|
| 71 |
- run: cargo build |
| 72 |
|
| 73 |
rustfmt: |
| 74 |
name: Rustfmt |
| 75 |
runs-on: ubuntu-latest |
| 76 |
steps: |
| 77 |
- uses: actions/checkout@master |
| 78 |
- name: Install Rust |
| 79 |
run: | |
| 80 |
rustup default nightly |
| 81 |
rustup update --no-self-update |
| 82 |
rustup component add rustfmt |
| 83 |
- run: cargo fmt -- --check |
| 84 |
|
| 85 |
success: |
| 86 |
needs: |
| 87 |
- test |
| 88 |
- clippy |
| 89 |
- msrv |
| 90 |
- rustfmt |
| 91 |
runs-on: ubuntu-latest |
| 92 |
# GitHub branch protection is exceedingly silly and treats "jobs skipped because a dependency |
| 93 |
# failed" as success. So we have to do some contortions to ensure the job fails if any of its |
| 94 |
# dependencies fails. |
| 95 |
if: always() # make sure this is never "skipped" |
| 96 |
steps: |
| 97 |
# Manually check the status of all dependencies. `if: failure()` does not work. |
| 98 |
- name: check if any dependency failed |
| 99 |
run: jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}' |