name: CI
on:
push:
pull_request:
jobs:
check:
name: lint + test (linux)
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Verify THIRD-PARTY-LICENSES retains the libzstd entry
run: |
if ! grep -q '^- package_name: libzstd$' THIRD-PARTY-LICENSES \
|| ! grep -q 'Copyright (c) Meta Platforms' THIRD-PARTY-LICENSES; then
echo "::error::THIRD-PARTY-LICENSES is missing the hand-maintained libzstd entry — re-add it after regenerating (see CONTRIBUTING.md)."
exit 1
fi
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Check formatting
run: cargo fmt --all --check
- name: Clippy (warnings denied)
run: cargo clippy --all-targets -- -D warnings
- name: Clippy (pure-rust feature)
run: cargo clippy --all-targets --no-default-features --features pure-rust -- -D warnings
- name: Test
run: cargo test
- name: Test (pure-rust feature)
run: cargo test --no-default-features --features pure-rust
test-macos:
name: test (macos)
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Test
run: cargo test
semver-check:
name: semver compatibility
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: dtolnay/rust-toolchain@stable
- uses: taiki-e/install-action@v2
with:
tool: cargo-semver-checks
- name: Check for undeclared breaking changes
run: |
LAST_TAG=$(git describe --tags --match 'v*' --abbrev=0 2>/dev/null || echo "")
if [ -z "$LAST_TAG" ]; then
echo "No prior version tag; skipping semver check."
exit 0
fi
echo "Comparing against $LAST_TAG"
if cargo semver-checks check-release --baseline-rev "$LAST_TAG" --default-features; then
exit 0
fi
# cargo-semver-checks found a breaking change. Acceptable only when the
# conventional-commit history since the last tag acknowledges it.
COMMITS=$(git log "${LAST_TAG}..HEAD" --format="%s%n%b")
if echo "$COMMITS" | grep -qE '^(feat|fix|[a-z]+)(\([^)]*\))?!:|BREAKING[ -]CHANGE'; then
echo "Breaking change is acknowledged in commit history — version bump required."
exit 0
fi
echo "::error::cargo-semver-checks found a breaking API change not acknowledged"
echo "::error::in any commit since ${LAST_TAG}. Add feat!: / fix!: or a"
echo "::error::BREAKING CHANGE footer to the responsible commit, or revert the break."
exit 1
test-windows:
name: test (windows)
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Test
run: cargo test