@@ -2,9 +2,9 @@ name: CI - Core
22
33on :
44 push :
5- branches : [ main ]
5+ branches : [main]
66 pull_request :
7- branches : [ main ]
7+ branches : [main]
88
99env :
1010 FORCE_JAVASCRIPT_ACTIONS_TO_NODE24 : true
2020 - timeout-minutes : 5
2121 uses : actions/setup-go@v7
2222 with :
23- go-version-file : ' go.mod'
23+ go-version-file : " go.mod"
2424 - name : Install ripgrep
2525 timeout-minutes : 2
2626 run : |
5959 timeout-minutes : 5
6060 shell : bash
6161 env :
62- BUF_VERSION : ' 1.47.2'
62+ BUF_VERSION : " 1.47.2"
6363 run : |
6464 set -euo pipefail
6565 mkdir -p "$RUNNER_TEMP/bin"
@@ -106,7 +106,7 @@ jobs:
106106 - timeout-minutes : 5
107107 uses : actions/setup-go@v7
108108 with :
109- go-version-file : ' go.mod'
109+ go-version-file : " go.mod"
110110 - name : Normalize Go toolchain env
111111 timeout-minutes : 2
112112 shell : bash
@@ -146,7 +146,7 @@ jobs:
146146 - timeout-minutes : 5
147147 uses : actions/setup-go@v7
148148 with :
149- go-version-file : ' go.mod'
149+ go-version-file : " go.mod"
150150 - name : Normalize Go toolchain env
151151 timeout-minutes : 2
152152 shell : bash
@@ -207,7 +207,7 @@ jobs:
207207 - timeout-minutes : 5
208208 uses : actions/setup-go@v7
209209 with :
210- go-version-file : ' go.mod'
210+ go-version-file : " go.mod"
211211 - name : Normalize Go toolchain env
212212 timeout-minutes : 2
213213 shell : bash
@@ -225,6 +225,7 @@ jobs:
225225 - name : Start Server (SQLite, no external DB)
226226 timeout-minutes : 15
227227 run : |
228+ set -euo pipefail
228229 go build -o bin/croupier-server ./cmd/server
229230 # Build the agent registration probe so happy-path.sh can exercise
230231 # the Agent→Server TCP handshake (Register + Heartbeat). Without it,
@@ -233,17 +234,23 @@ jobs:
233234 # Function-seed helper: inserts the function metadata row that the
234235 # task-lifecycle E2E's POST /tasks requires (no create API exists).
235236 go build -o bin/e2e-function-seed ./examples/cmd/e2e-function-seed
236- # Fresh DB every run: a stale test-data/croupier.db with an older
237- # schema makes AutoMigrate fail (sqlite cannot ALTER ADD a NOT NULL
238- # column). Remove any leftover state before booting.
239- rm -rf data test-data
240- mkdir -p data/uploads test-data
237+ # Each run owns an isolated directory under RUNNER_TEMP. Never
238+ # delete repository data/ or test-data/: CI may run in a worktree
239+ # containing useful local SQLite fixtures.
240+ E2E_DIR="$RUNNER_TEMP/croupier-e2e-${{ github.run_id }}-${{ github.run_attempt }}"
241+ mkdir -p "$E2E_DIR/uploads"
242+ echo "E2E_DIR=$E2E_DIR" >> "$GITHUB_ENV"
243+ echo "E2E_DSN=$E2E_DIR/croupier.db" >> "$GITHUB_ENV"
241244 # Use the SQLite test config so the server boots without a database
242245 # service. Admin/games are seeded from configs/*.json. Redirect
243246 # output to a log file so failures (panic/migrate errors) are
244247 # visible in the failed step instead of being lost to the background.
245- : > server.log
246- ./bin/croupier-server --config configs/test-sqlite.yaml >> server.log 2>&1 &
248+ : > "$E2E_DIR/server.log"
249+ DB_DRIVER=sqlite \
250+ DATABASE_URL="$E2E_DIR/croupier.db" \
251+ STORAGE_DRIVER=file \
252+ STORAGE_BASE_DIR="$E2E_DIR/uploads" \
253+ ./bin/croupier-server --config configs/test-sqlite.yaml >> "$E2E_DIR/server.log" 2>&1 &
247254 SERVER_PID=$!
248255 echo "SERVER_PID=$SERVER_PID" >> $GITHUB_ENV
249256 # Wait for server REST to be ready (deterministic readiness probe).
@@ -263,14 +270,14 @@ jobs:
263270 done
264271 if [ "$ready" -ne 1 ]; then
265272 echo "::error::server did not become ready within 60s; server log:"
266- cat server.log
273+ cat "$E2E_DIR/ server.log"
267274 exit 1
268275 fi
269276 - name : Run E2E tests
270277 timeout-minutes : 10
271278 env :
272279 SERVER_URL : http://localhost:18780
273- DSN : test-data/croupier.db
280+ DSN : ${{ env.E2E_DSN }}
274281 run : |
275282 bash scripts/e2e/happy-path.sh
276283 bash scripts/e2e/task-lifecycle.sh
@@ -279,6 +286,5 @@ jobs:
279286 if : always()
280287 run : |
281288 if [ -n "${SERVER_PID:-}" ]; then
282- kill $SERVER_PID 2>/dev/null || true
289+ kill " $SERVER_PID" 2>/dev/null || true
283290 fi
284-
0 commit comments