Files
sentio/.github/workflows/ci.yml
T
Truespar Team e801570089 Make the notices check reproducible and diagnosable
Pin cargo-about, split the install into its own step so a failure is
attributable, and print the diff plus upload the generated file when it
mismatches. The check has failed three runs and the logs need admin
rights to read.
2026-08-24 08:15:22 +02:00

113 lines
3.8 KiB
YAML

name: CI
on:
push:
branches: ["**"]
pull_request:
env:
CARGO_TERM_COLOR: always
# Builds read the committed .sqlx/ cache, so no database is needed.
SQLX_OFFLINE: "true"
jobs:
check:
name: fmt, clippy, test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
# aws-lc-rs (the rustls backend) needs cmake; some deps need libclang.
- name: Install build dependencies
run: sudo apt-get update && sudo apt-get install -y cmake libclang-dev
- name: Formatting
run: cargo fmt --all -- --check
- name: Clippy
run: cargo clippy --workspace --all-targets -- -D warnings
- name: Tests
run: cargo test --workspace
- name: Release build
run: cargo build --release --bin sentio-smtp
# Licence policy: what may enter the dependency graph at all.
- name: cargo-deny
uses: EmbarkStudios/cargo-deny-action@v2
with:
command: check
# Pinned: an unpinned generator makes the comparison below
# irreproducible, since a new cargo-about can reformat the output.
- name: Install cargo-about
run: cargo install --locked --features cli --version 0.9.2 cargo-about
# Attribution: MIT and BSD require their notices to ship with the binary,
# so a stale file is a compliance gap, not a cosmetic one.
- name: Third-party notices are up to date
run: |
# tr: some licence texts carry CRLF, which .gitattributes strips
# on commit. Without this the diff fails on line endings alone.
cargo about generate --fail about.hbs | tr -d '\r' > /tmp/notices.md
if ! diff -u THIRD-PARTY-NOTICES.md /tmp/notices.md > /tmp/notices.diff; then
echo "::error::THIRD-PARTY-NOTICES.md is stale - regenerate with: cargo about generate --fail about.hbs | tr -d '\r' > THIRD-PARTY-NOTICES.md"
echo "--- first 60 lines of the difference ---"
head -60 /tmp/notices.diff
exit 1
fi
- name: Upload the generated notices on failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: notices-generated
path: /tmp/notices.md
if-no-files-found: ignore
# The committed spec must match the code, or generated clients drift.
- name: OpenAPI spec is up to date
run: |
./target/release/sentio-smtp openapi > /tmp/openapi.json
diff -u docs/openapi.json /tmp/openapi.json \
|| { echo "::error::docs/openapi.json is stale - run: cargo run -- openapi > docs/openapi.json"; exit 1; }
windows:
name: windows x86_64
# Compile-only for now. The code has a non-unix shutdown path and no
# unix-only dependencies, so the open question is whether aws-lc-sys (the C
# crypto behind rustls) builds here - it needs NASM. If this stays green,
# shipping Windows binaries is a small step from it.
runs-on: windows-latest
steps:
- uses: actions/checkout@v7
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- uses: ilammy/setup-nasm@v1
- name: Check
run: cargo check --workspace --all-targets
docker:
name: docker build
# Builds without pushing. publish.yml owns the registry and only runs for a
# v* tag, so this is what keeps main honest about the Dockerfile in between
# releases.
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: docker/setup-buildx-action@v4
- name: Build image
uses: docker/build-push-action@v7
with:
context: .
push: false
cache-from: type=gha
cache-to: type=gha,mode=max