100 lines
2.6 KiB
YAML
100 lines
2.6 KiB
YAML
name: CI
|
|
|
|
env:
|
|
CARGO_TERM_VERBOSE: true
|
|
RUSTDOCFLAGS: -Dwarnings
|
|
RUSTFLAGS: -Dwarnings
|
|
|
|
on:
|
|
pull_request:
|
|
push:
|
|
branches:
|
|
- master
|
|
|
|
jobs:
|
|
test:
|
|
name: Tests
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
matrix:
|
|
channel:
|
|
- stable
|
|
- nightly
|
|
- 1.85.0 # MSRV of test dependencies
|
|
os:
|
|
- macos-26
|
|
- macos-26-intel
|
|
- windows-2025
|
|
- ubuntu-26.04
|
|
include:
|
|
- channel: beta
|
|
os: ubuntu-26.04
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v7
|
|
- run: rustup default ${{ matrix.channel }} && rustup update --no-self-update
|
|
- run: cargo test --all
|
|
|
|
clippy:
|
|
name: Clippy
|
|
runs-on: ubuntu-26.04
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v7
|
|
|
|
- name: Update rust
|
|
run: |
|
|
# use beta since it gives us near-latest fixes but isn't as volatile as nightly
|
|
rustup default beta
|
|
rustup component add clippy
|
|
rustup update --no-self-update
|
|
- run: cargo clippy --all -- -Aclippy::while_let_loop
|
|
|
|
msrv:
|
|
name: Check building with the MSRV
|
|
runs-on: ubuntu-26.04
|
|
env:
|
|
RUSTFLAGS: "" # No need to check warnings on old MSRV, clear `-Dwarnings`
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v7
|
|
- run: |
|
|
msrv="$(
|
|
cargo metadata --format-version 1 |
|
|
jq -r --arg CRATE_NAME glob '.packages | map(select((.name == $CRATE_NAME) and (.id | startswith("path+file")))) | first | .rust_version'
|
|
)"
|
|
echo "MSRV: $msrv"
|
|
echo "MSRV=$msrv" >> "$GITHUB_ENV"
|
|
- name: Install Rust
|
|
run: rustup update "$MSRV" --no-self-update && rustup default "$MSRV"
|
|
- run: cargo build -p glob
|
|
|
|
rustfmt:
|
|
name: Rustfmt
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@master
|
|
- name: Install Rust
|
|
run: |
|
|
rustup default nightly
|
|
rustup update --no-self-update
|
|
rustup component add rustfmt
|
|
- run: cargo fmt -- --check
|
|
|
|
success:
|
|
needs:
|
|
- test
|
|
- clippy
|
|
- msrv
|
|
- rustfmt
|
|
runs-on: ubuntu-latest
|
|
# GitHub branch protection is exceedingly silly and treats "jobs skipped because a dependency
|
|
# failed" as success. So we have to do some contortions to ensure the job fails if any of its
|
|
# dependencies fails.
|
|
if: always() # make sure this is never "skipped"
|
|
steps:
|
|
# Manually check the status of all dependencies. `if: failure()` does not work.
|
|
- name: check if any dependency failed
|
|
run: jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}'
|