Skip to content

Commit 505cc5e

Browse files
noahgiftclaude
andcommitted
ci: gate workflow with postgres docker compose + cargo test
Adds .github/workflows/ci.yml so the paiml org's "Green Main" ruleset can auto-merge PRs. The ruleset requires a status check named literally `gate`; we provide it as an aggregator over a `gate-matrix` job that runs the same Makefile entrypoints a user runs locally (make up / pagila / verify / test / capstone smoke). This was deferred from the initial commit per spec but is required to make `gh pr merge --auto` actually fire — the org rule blocks otherwise. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 2d5dc94 commit 505cc5e

1 file changed

Lines changed: 93 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
name: ci
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
workflow_dispatch:
9+
10+
env:
11+
CARGO_TERM_COLOR: always
12+
CARGO_INCREMENTAL: 0
13+
14+
concurrency:
15+
group: ${{ github.workflow }}-${{ github.ref }}
16+
cancel-in-progress: true
17+
18+
jobs:
19+
# The matrix entry does the actual work. Postgres comes up via docker
20+
# compose so the CI path matches what users run locally — same Makefile,
21+
# same scripts, same entry points. The `gate` aggregator below is the
22+
# status check the org's main-branch ruleset keys off of.
23+
gate-matrix:
24+
name: gate-matrix (${{ matrix.toolchain }})
25+
runs-on: ubuntu-latest
26+
strategy:
27+
fail-fast: false
28+
matrix:
29+
toolchain: ["1.95.0"]
30+
steps:
31+
- name: Checkout
32+
uses: actions/checkout@v4
33+
34+
- name: Install Rust toolchain
35+
uses: dtolnay/rust-toolchain@master
36+
with:
37+
toolchain: ${{ matrix.toolchain }}
38+
components: rustfmt, clippy
39+
40+
- name: Cache cargo
41+
uses: Swatinem/rust-cache@v2
42+
with:
43+
shared-key: gate-${{ matrix.toolchain }}
44+
45+
- name: Boot postgres + load Pagila
46+
run: |
47+
make up
48+
make pagila
49+
50+
- name: Format
51+
run: cargo fmt --all -- --check
52+
53+
- name: Clippy
54+
run: cargo clippy --workspace --all-targets -- -D warnings
55+
56+
- name: Verify headline counts
57+
run: make verify
58+
59+
- name: Test
60+
env:
61+
DATABASE_URL: postgres://postgres:postgres@localhost:5432/pagila
62+
run: cargo test --workspace --all-targets --release
63+
64+
- name: Doc tests
65+
env:
66+
DATABASE_URL: postgres://postgres:postgres@localhost:5432/pagila
67+
run: cargo test --workspace --doc
68+
69+
- name: Release build
70+
run: cargo build --release --workspace
71+
72+
- name: Capstone smoke (customers --limit 3)
73+
env:
74+
DATABASE_URL: postgres://postgres:postgres@localhost:5432/pagila
75+
run: cargo run --release --bin postgres-reports -- --report customers --limit 3
76+
77+
# Aggregator. The org's main-branch ruleset requires a status check named
78+
# exactly `gate`. The matrix above only emits `gate-matrix (toolchain)`
79+
# rows. This job collapses the matrix into one check name auto-merge can
80+
# find.
81+
gate:
82+
name: gate
83+
needs: [gate-matrix]
84+
runs-on: ubuntu-latest
85+
if: always()
86+
steps:
87+
- name: Verify all jobs succeeded
88+
run: |
89+
if [ "${{ needs.gate-matrix.result }}" != "success" ]; then
90+
echo "::error::gate-matrix failed (result=${{ needs.gate-matrix.result }})"
91+
exit 1
92+
fi
93+
echo "✓ all gates passed"

0 commit comments

Comments
 (0)