name: tests
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
schedule:
- cron: "0 3 * * *"
env:
CARGO_TERM_COLOR: always
jobs:
test:
name: Test on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest, windows-latest, macOS-latest ]
steps:
- uses: actions/checkout@v7
- name: Build
run: cargo build --verbose
- name: Install cargo-hack
run: cargo install cargo-hack
- name: Build individual features
run: cargo hack build --each-feature
- name: Test individual features
run: cargo hack test --each-feature
- name: Test with all features
run: cargo test --all-features
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- run: cargo fmt --all -- --check
clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- run: cargo clippy --all-features -- -D warnings
docs:
runs-on: ubuntu-latest
env:
RUSTDOCFLAGS: -D warnings
steps:
- uses: actions/checkout@v7
- run: cargo doc --all-features --no-deps
semver:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Check the public API against the published release
uses: obi1kenobi/cargo-semver-checks-action@v2
with:
feature-group: all-features
generate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- run: |
make generate
if [ -n "$(git status --porcelain src/protocol/generated)" ]; then
git status --short src/protocol/generated
echo "generated sources are stale, run make generate and commit"
exit 1
fi
vectors:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- run: |
make vectors
if [ -n "$(git status --porcelain vectors)" ]; then
git status --short vectors
echo "vectors are stale, run make vectors and commit"
exit 1
fi
fuzz:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Install nightly toolchain
run: rustup install nightly
- name: Install cargo-fuzz
run: cargo install cargo-fuzz
- name: Check the seeds match the scenario tests
run: |
make fuzz-seeds
if [ -n "$(git status --porcelain fuzz/seeds)" ]; then
git status --short fuzz/seeds
echo "seeds are stale, run make fuzz-seeds and commit"
exit 1
fi
- name: Run all fuzzers from their corpus and seeds
run: make fuzz FUZZ_TIME=${{ github.event_name == 'schedule' && 600 || 60 }} FUZZ_SANITIZER=address