# CI workflow generated by `autumn new {{project_name}}`.
#
# Runs on every push and pull request:
# - cargo fmt --check
# - cargo clippy -D warnings
# - cargo build
# - cargo test
#
# Toolchain is pinned to the project MSRV ({{rust_version}}) so local and CI
# builds stay in sync.
#
# A Postgres 16 service container is provisioned and DATABASE_URL is set so
# DB-dependent tests can opt in. Tests decorated `#[ignore]` are skipped by
# default; run `cargo test -- --ignored` to include them.
#
# Optional extensions (not required for green CI on a fresh scaffold):
# - Tailwind: add `autumn setup --tailwind` and run the downloaded binary
# before `cargo build` to compile CSS in CI.
# - Coverage: install cargo-llvm-cov and upload to Codecov.
# - Audit: `cargo install cargo-audit` then `cargo audit`.
name: CI
on:
# Run on every branch push and pull request so CI fires on the first push
# regardless of the repository's default branch name. Narrow this to specific
# branches (e.g. `branches: [main]`) once your branching model settles.
push:
pull_request:
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
DATABASE_URL: postgres://autumn:autumn@localhost:5432/{{crate_name}}_test
jobs:
ci:
name: CI
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_USER: autumn
POSTGRES_PASSWORD: autumn
POSTGRES_DB: {{crate_name}}_test
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 5s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@{{rust_version}}
with:
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
- name: Check formatting
run: cargo fmt --all -- --check
- name: Clippy
run: cargo clippy --all-targets -- -D warnings
# Accessibility gate: install the prebuilt `autumn` CLI matching this app's
# autumn-web version and scan raw html! markup for a11y violations. Non-blocking
# (continue-on-error) until the pinned autumn release publishes its prebuilt
# binaries; remove `continue-on-error` to make this an enforcing gate.
- name: Accessibility (a11y) verify
continue-on-error: true
run: |
curl -fsSL "https://raw.githubusercontent.com/madmax983/autumn/v{{autumn_version}}/scripts/install.sh" \
| sh -s -- --version "v{{autumn_version}}"
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
"$HOME/.local/bin/autumn" a11y verify .
- name: Build
run: cargo build
- name: Test
run: cargo test