apsis-rs/.github/workflows/ci.yml

43 lines
1.3 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: 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"