Skip to content

Commit 505c73f

Browse files
BotCoder254claude
andcommitted
ci: add GitHub Actions compile + test gate for frontend and Rust crates
Adds .github/workflows/ci.yml running on every push, PR, and manual dispatch. Two job groups, all self-contained (no DB, secrets, or services): - frontend: npm install --legacy-peer-deps (mirrors the Vercel/Netlify install to avoid React 19 peer-dep conflicts), tsc --noEmit type-check, react-scripts test --passWithNoTests, and a production build. - rust: a matrix over the three sibling crates (protocol, backend, runner, edition 2024) that runs cargo build + cargo test with per-crate caching. The backend needs no PostgreSQL because it uses runtime sqlx queries, not compile-time query! macros. Concurrency cancels superseded runs per ref. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 7e0410a commit 505c73f

1 file changed

Lines changed: 89 additions & 0 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
name: CI
2+
3+
# Compile + test gate for the whole monorepo: the React/TypeScript frontend
4+
# and the three sibling Rust crates (protocol, backend, runner). Every job is
5+
# self-contained — no database, no secrets, no external services — because the
6+
# backend uses runtime sqlx queries (no compile-time `query!` macros), so the
7+
# control plane builds and unit-tests without a live PostgreSQL.
8+
9+
on:
10+
push:
11+
branches: ["**"]
12+
pull_request:
13+
workflow_dispatch:
14+
15+
# One in-flight run per ref: a new push cancels the previous run's jobs.
16+
concurrency:
17+
group: ci-${{ github.ref }}
18+
cancel-in-progress: true
19+
20+
permissions:
21+
contents: read
22+
23+
env:
24+
CARGO_TERM_COLOR: always
25+
26+
jobs:
27+
# --- Frontend: React + TypeScript (create-react-app) ----------------------
28+
frontend:
29+
name: frontend (typecheck · test · build)
30+
runs-on: ubuntu-latest
31+
steps:
32+
- uses: actions/checkout@v4
33+
34+
- name: Set up Node
35+
uses: actions/setup-node@v4
36+
with:
37+
node-version: 20
38+
cache: npm
39+
cache-dependency-path: package-lock.json
40+
41+
# --legacy-peer-deps mirrors the Vercel/Netlify install and sidesteps the
42+
# React 19 peer-dependency conflicts across the UI stack.
43+
- name: Install dependencies
44+
run: npm install --legacy-peer-deps
45+
46+
- name: Type-check (tsc --noEmit)
47+
run: npx tsc --noEmit
48+
49+
- name: Test
50+
run: npx react-scripts test --watchAll=false --passWithNoTests
51+
env:
52+
CI: true
53+
54+
# CI=false so create-react-app does not promote lint warnings to build
55+
# errors — matches the production build on Vercel/Netlify.
56+
- name: Build
57+
run: npm run build
58+
env:
59+
CI: false
60+
61+
# --- Rust crates: protocol, backend, runner (edition 2024) ----------------
62+
rust:
63+
name: rust
64+
runs-on: ubuntu-latest
65+
strategy:
66+
fail-fast: false
67+
matrix:
68+
crate: [protocol, backend, runner]
69+
defaults:
70+
run:
71+
working-directory: ${{ matrix.crate }}
72+
steps:
73+
- uses: actions/checkout@v4
74+
75+
- name: Install stable Rust toolchain
76+
uses: dtolnay/rust-toolchain@stable
77+
78+
# Per-crate cache keyed on each crate's own Cargo.lock (no shared
79+
# workspace) so the three builds don't clobber each other's cache.
80+
- name: Cache cargo build
81+
uses: Swatinem/rust-cache@v2
82+
with:
83+
workspaces: ${{ matrix.crate }}
84+
85+
- name: Build
86+
run: cargo build --locked --verbose
87+
88+
- name: Test
89+
run: cargo test --locked --verbose

0 commit comments

Comments
 (0)