Skip to content

Commit 67d025e

Browse files
committed
chore: update SDKs, transport layer, and CI workflows
- SDK updates: cpp, csharp, go, java, js, python - Transport layer: mux_conn improvements and tests - CI: workflow updates - Documentation: SDK guides and feature matrix - Scripts: dashboard E2E guard updates
1 parent 17f4c6b commit 67d025e

88 files changed

Lines changed: 2552 additions & 1805 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: CI - Core
22

33
on:
44
push:
5-
branches: [ main ]
5+
branches: [main]
66
pull_request:
7-
branches: [ main ]
7+
branches: [main]
88

99
env:
1010
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
@@ -20,7 +20,7 @@ jobs:
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: |
@@ -59,7 +59,7 @@ jobs:
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-

cmd/server/root.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,7 @@ func applyRuntimeDefaults(c *config.Config) {
446446

447447
// ✅ Auto-adjust timeout based on SSE configuration to prevent premature disconnection
448448
validateAndAdjustTimeout(c)
449+
applyStorageEnvironmentOverrides(c)
449450

450451
if strings.EqualFold(strings.TrimSpace(c.Storage.Driver), "file") {
451452
if strings.TrimSpace(c.Storage.BaseDir) == "" {
@@ -454,6 +455,21 @@ func applyRuntimeDefaults(c *config.Config) {
454455
}
455456
}
456457

458+
// applyStorageEnvironmentOverrides makes file storage relocatable in CI and
459+
// ephemeral deployments. Database overrides are resolved in svc; storage must
460+
// be applied here before ServiceContext initializes the object store.
461+
func applyStorageEnvironmentOverrides(c *config.Config) {
462+
if c == nil {
463+
return
464+
}
465+
if driver := strings.TrimSpace(os.Getenv("STORAGE_DRIVER")); driver != "" {
466+
c.Storage.Driver = driver
467+
}
468+
if baseDir := strings.TrimSpace(os.Getenv("STORAGE_BASE_DIR")); baseDir != "" {
469+
c.Storage.BaseDir = baseDir
470+
}
471+
}
472+
457473
func wrapHTTPHandler(svcCtx *svc.ServiceContext, handler http.Handler) http.Handler {
458474
if svcCtx == nil || svcCtx.Telemetry == nil {
459475
return handler

cmd/server/server_test.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,17 @@ func TestApplyRuntimeDefaults_NonFileStorage(t *testing.T) {
181181
assert.Equal(t, "", c.Storage.BaseDir)
182182
}
183183

184+
func TestApplyRuntimeDefaults_StorageEnvironmentOverrides(t *testing.T) {
185+
t.Setenv("STORAGE_DRIVER", "file")
186+
t.Setenv("STORAGE_BASE_DIR", "/tmp/croupier-e2e/uploads")
187+
c := &config.Config{Storage: config.StorageConfig{Driver: "s3", BaseDir: "bucket-prefix"}}
188+
189+
applyRuntimeDefaults(c)
190+
191+
assert.Equal(t, "file", c.Storage.Driver)
192+
assert.Equal(t, "/tmp/croupier-e2e/uploads", c.Storage.BaseDir)
193+
}
194+
184195
// ---------------------------------------------------------------------------
185196
// PrintVersionInfo
186197
// ---------------------------------------------------------------------------

docs/sdks/cpp/guide/quick-start.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ int main() {
77
croupier::sdk::ClientConfig config;
88
config.game_id = "my-game";
99
config.env = "development";
10-
config.agent_addr = "127.0.0.1:19090";
10+
config.agent_addr = "127.0.0.1:19091";
1111

1212
croupier::sdk::CroupierClient client(config);
1313
client.Connect();

docs/sdks/csharp/guide/quick-start.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
using Croupier.Sdk;
1212

1313
var client = new CroupierClient(new ClientConfig {
14-
AgentAddr = "127.0.0.1:19090",
14+
AgentAddr = "127.0.0.1:19091",
1515
ServiceId = "my-service",
1616
GameId = "my-game",
1717
Env = "dev"

docs/sdks/csharp/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ dotnet add package Croupier.Sdk
2828
using Croupier.Sdk;
2929

3030
var client = new CroupierClient(new ClientConfig {
31-
AgentAddr = "127.0.0.1:19090",
31+
AgentAddr = "127.0.0.1:19091",
3232
ServiceId = "my-service",
3333
GameId = "my-game"
3434
});

docs/sdks/go/guide/integration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import (
1818

1919
func main() {
2020
client := croupier.NewClient(&croupier.ClientConfig{
21-
AgentAddr: "localhost:19090",
21+
AgentAddr: "localhost:19091",
2222
GameID: "demo-game",
2323
Env: "development",
2424
Insecure: true,

docs/sdks/go/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import "github.com/cuihairu/croupier/sdks/go/pkg/croupier"
3131

3232
func main() {
3333
cfg := &croupier.ClientConfig{
34-
AgentAddr: "127.0.0.1:19090",
34+
AgentAddr: "127.0.0.1:19091",
3535
GameID: "my-game",
3636
Env: "development",
3737
}

docs/sdks/js/guide/integration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import {
1717

1818
async function main() {
1919
const config: ClientConfig = {
20-
agentAddr: "127.0.0.1:19090",
20+
agentAddr: "127.0.0.1:19091",
2121
serviceId: "my-service",
2222
};
2323

docs/sdks/js/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ npm install @croupier/sdk
2929
import { CroupierClient } from "@croupier/sdk";
3030

3131
const client = new CroupierClient({
32-
agentAddr: "127.0.0.1:19090",
32+
agentAddr: "127.0.0.1:19091",
3333
gameId: "my-game",
3434
env: "development",
3535
insecure: true,

0 commit comments

Comments
 (0)