name: CI
on:
push:
branches: [main, master]
pull_request:
env:
CARGO_TERM_COLOR: always
jobs:
pr-release-label:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Warn when release label is missing
env:
LABELS_JSON: ${{ toJson(github.event.pull_request.labels.*.name) }}
run: |
has_release_label=false
while IFS= read -r label; do
if [[ "$label" == release:* ]]; then
has_release_label=true
break
fi
done < <(jq -r '.[]' <<<"${LABELS_JSON}")
if [[ "${has_release_label}" == true ]]; then
echo "::notice::Release label detected on this PR."
else
echo "::warning::No release:* label set. Merge to main will skip auto-release."
fi
check:
name: Check (${{ matrix.rust }})
runs-on: ubuntu-latest
strategy:
matrix:
rust: [stable, nightly]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
- name: Shared preflight
if: matrix.rust == 'stable'
run: scripts/preflight.sh full
- name: Build
if: matrix.rust != 'stable'
run: cargo build
- name: Test
if: matrix.rust != 'stable'
run: cargo test
- name: Clippy
if: matrix.rust != 'stable'
run: cargo clippy -- -D warnings
- name: Format check
if: matrix.rust != 'stable'
run: cargo fmt --check
check-windows:
name: Check (Windows)
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
- name: Build
run: cargo build
- name: Test
run: cargo test
- name: Clippy
run: cargo clippy -- -D warnings
- name: Format check
run: cargo fmt --check