62 lines
2.4 KiB
YAML
62 lines
2.4 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
pull_request:
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
components: rustfmt, clippy
|
|
- name: Format
|
|
run: cargo fmt --all --check
|
|
- name: Check
|
|
run: cargo check --workspace --all-targets
|
|
- name: Clippy
|
|
run: cargo clippy --workspace --all-targets -- -D warnings
|
|
- name: Test
|
|
run: cargo test --workspace
|
|
- name: Integration checks
|
|
# The cross-layer checks are examples rather than tests, because they
|
|
# are also meant to be read and run by hand. `cargo test` does not run
|
|
# them, so without this step a change that breaks one layer's
|
|
# assumptions about another would pass CI silently.
|
|
run: |
|
|
cargo run -p apsis-rs --features network --example integrate_network
|
|
cargo run -p apsis-rs --features ops --example integrate_ops
|
|
cargo run -p apsis-rs --features sim --example integrate_sim
|
|
- name: Build the benchmark
|
|
# The benchmark is not run in CI, because its timings are only
|
|
# meaningful on a quiet machine, but it must still compile so that it
|
|
# does not rot.
|
|
run: cargo build -p apsis-rs --features full --example bench
|
|
- name: Check the layer rule
|
|
# README.md states that a crate may only depend on layers to its
|
|
# left. Nothing else in the build enforces that, so a reverse
|
|
# dependency would otherwise pass CI silently.
|
|
run: bash scripts/check-layers.sh
|
|
- name: Verify dependency freedom
|
|
run: |
|
|
# Every package in the graph must be a workspace crate. `--prefix
|
|
# none` prints bare `name version` lines, one per package, which the
|
|
# box drawing prefix of the default format would otherwise hide.
|
|
external=$(cargo tree --workspace --all-features \
|
|
--edges normal,build,dev --prefix none 2>/dev/null \
|
|
| sed -E 's/ \(\*\)$//; s/ \([^)]*\)$//' \
|
|
| awk 'NF {print $1}' \
|
|
| sort -u \
|
|
| grep -v '^apsis' || true)
|
|
if [ -n "$external" ]; then
|
|
echo "unexpected external dependency detected:" >&2
|
|
echo "$external" >&2
|
|
exit 1
|
|
fi
|
|
echo "dependency check passed: workspace crates only"
|