-
Notifications
You must be signed in to change notification settings - Fork 1
156 lines (145 loc) · 6.04 KB
/
Copy pathci.yml
File metadata and controls
156 lines (145 loc) · 6.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
name: ci
on:
pull_request:
push:
branches: [main]
# A force-push or a rapid second push should not leave two runs racing; the older
# one is cancelled rather than burning a runner on a commit nobody will merge.
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
# Read-only by default. Nothing here writes to the repository, and a fork-based
# pull request must never hold a writable token.
permissions:
contents: read
jobs:
# ── Required checks ────────────────────────────────────────────────────────
# Everything in this group passes on main today. Only checks that are green
# from the first run belong here: a required check that always fails is
# indistinguishable from a broken merge queue and teaches people to ignore CI.
frontend:
name: frontend (build)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: '22'
cache: npm
- run: npm ci
- run: npm run build
backend:
name: backend (compile + package)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-java@v5.6.0
with:
distribution: temurin
java-version: '25'
cache: maven
# No database service here on purpose: with tests skipped nothing opens a
# connection, so this job stays fast and has exactly one failure mode —
# the code does not compile, or does not package.
- run: ./mvnw -B -ntp -DskipTests verify
working-directory: backend
mcp:
name: mcp (syntax)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: '22'
# Every JS file in the package, not just the entrypoint: the server is a
# thin shim over lib and command modules, and a syntax error in any of them
# surfaces only when an agent loads that path at runtime.
- name: Syntax-check MCP sources
run: find mcp -name '*.js' -not -path '*/node_modules/*' -print0 | xargs -0 -n1 node --check
compose-build:
name: docker compose build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
# Catches the case where the code compiles but the image does not. Our
# distribution path is "clone and build", so an unbuildable image is a
# total outage for a new user even when every test passes.
- name: Synthesize .env
run: |
cp .env.example .env
printf 'SECURITY_JWT_SECRET=%s\n' "$(openssl rand -base64 64 | tr -d '\n')" >> .env
printf 'ENCRYPTION_KEY=%s\n' "$(openssl rand -base64 32)" >> .env
- run: docker compose build
# ── Advisory checks ────────────────────────────────────────────────────────
# These run on every pull request and report, but do not block. They are staged
# this way because both are red on main right now (backend: 77 of 1293 tests
# failing; frontend: 41 eslint errors). Promote each to a required check in
# branch protection the day its suite goes green — that promotion is the point
# of running them, not an afterthought.
#
# `continue-on-error` belongs on the STEP, never on the job. At job level the
# workflow run goes green but GitHub still reports the individual check as
# failed, which paints a red X on every pull request whatever it contains. That
# makes a genuinely broken change indistinguishable from a healthy one and
# trains reviewers to merge through red — the exact habit CI exists to prevent.
backend-tests:
name: backend tests (advisory)
runs-on: ubuntu-latest
services:
postgres:
# pgvector, not stock postgres: rag_documents.embedding is vector(3072)
# and the schema will not create against an image without the extension.
image: pgvector/pgvector:pg18
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: dba_agent
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U postgres"
--health-interval 10s
--health-timeout 5s
--health-retries 10
steps:
- uses: actions/checkout@v7
- uses: actions/setup-java@v5.6.0
with:
distribution: temurin
java-version: '25'
cache: maven
# Generated per run and discarded with the runner, rather than written into
# this file or held as a repository secret. Nothing in the test suite needs
# a key that outlives the job, so nothing should own one. The id must be
# local-2025-01: application-test.properties pins ENCRYPTION_KEY_ID to it.
- name: Generate ephemeral encryption key
run: echo "ENCRYPTION_KEYS=local-2025-01:$(openssl rand -base64 32)" >> "$GITHUB_ENV"
- run: ./mvnw -B -ntp test
continue-on-error: true
working-directory: backend
env:
TEST_DB_URL: jdbc:postgresql://localhost:5432/dba_agent?sslmode=disable
TEST_DB_USERNAME: postgres
TEST_DB_PASSWORD: postgres
AZURE_SEARCH_API_KEY: dummy-test-key
- name: Publish test summary
if: always()
run: |
echo '### Backend test results' >> "$GITHUB_STEP_SUMMARY"
echo '```' >> "$GITHUB_STEP_SUMMARY"
grep -ho 'Tests run:.*' backend/target/surefire-reports/*.txt 2>/dev/null \
| tail -5 >> "$GITHUB_STEP_SUMMARY" \
|| echo 'no surefire reports produced' >> "$GITHUB_STEP_SUMMARY"
echo '```' >> "$GITHUB_STEP_SUMMARY"
lint:
name: frontend lint (advisory)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: '22'
cache: npm
- run: npm ci
- run: npm run lint
continue-on-error: true