| 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.85.0 # MSRV of test dependencies |
| 24 |
os: |
| 25 |
- macos-26 |
| 26 |
- macos-26-intel |
| 27 |
- windows-2025 |
| 28 |
- ubuntu-26.04 |
| 29 |
include: |
| 30 |
- channel: beta |
| 31 |
os: ubuntu-26.04 |
| 32 |
|
| 33 |
steps: |
| 34 |
- name: Checkout repository |
| 35 |
uses: actions/checkout@v7 |
| 36 |
- run: rustup default ${{ matrix.channel }} && rustup update --no-self-update |
| 37 |
- run: cargo test --all |
| 38 |
|
| 39 |
clippy: |
| 40 |
name: Clippy |
| 41 |
runs-on: ubuntu-26.04 |
| 42 |
steps: |
| 43 |
- name: Checkout repository |
| 44 |
uses: actions/checkout@v7 |
| 45 |
|
| 46 |
- name: Update rust |
| 47 |
run: | |
| 48 |
# use beta since it gives us near-latest fixes but isn't as volatile as nightly |
| 49 |
rustup default beta |
| 50 |
rustup component add clippy |
| 51 |
rustup update --no-self-update |
| 52 |
- run: cargo clippy --all -- -Aclippy::while_let_loop |
| 53 |
|
| 54 |
msrv: |
| 55 |
name: Check building with the MSRV |
| 56 |
runs-on: ubuntu-26.04 |
| 57 |
env: |
| 58 |
RUSTFLAGS: "" # No need to check warnings on old MSRV, clear `-Dwarnings` |
| 59 |
steps: |
| 60 |
- name: Checkout repository |
| 61 |
uses: actions/checkout@v7 |
| 62 |
- run: | |
| 63 |
msrv="$( |
| 64 |
cargo metadata --format-version 1 | |
| 65 |
jq -r --arg CRATE_NAME glob '.packages | map(select((.name == $CRATE_NAME) and (.id | startswith("path+file")))) | first | .rust_version' |
| 66 |
)" |
| 67 |
echo "MSRV: $msrv" |
| 68 |
echo "MSRV=$msrv" >> "$GITHUB_ENV" |
| 69 |
- name: Install Rust |
| 70 |
run: rustup update "$MSRV" --no-self-update && rustup default "$MSRV" |
| 71 |
- run: cargo build -p glob |
| 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) }}' |