-
Notifications
You must be signed in to change notification settings - Fork 0
184 lines (158 loc) · 6.61 KB
/
Copy pathintegration.yml
File metadata and controls
184 lines (158 loc) · 6.61 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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
name: Integration Tests
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch: {}
# Weekly drift catch
schedule:
- cron: '0 6 * * 2' # Tuesday 06:00 UTC — failures land in EU/IN working hours
permissions:
contents: read
# Avoid spawning parallel docker-compose stacks for back-to-back pushes;
# also cancels stale PR runs when a new commit lands. Push to main keys on SHA
# so main runs never queue or cancel each other.
concurrency:
group: integration-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
env:
AXONFLOW_TELEMETRY: 'off'
jobs:
# Contract tests run on every PR and push. No network, no stack.
contract-tests:
name: Contract Tests
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run contract tests
run: npm run test:contract
# Example + integration-test type-check on every PR and push. Catches API
# drift at PR time without needing a live stack. Mirrors Python SDK
# demo-scripts job.
example-typecheck:
name: Example Type-Check
runs-on: ubuntu-latest
timeout-minutes: 10
needs: contract-tests
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Type-check examples against local source
run: npx tsc -p tsconfig.examples.json
# Integration test files live behind jest's testPathIgnorePatterns
# (only run on push-to-main), so jest never type-checks them at PR
# time. Drift in those files (e.g. method renames on AxonFlow) only
# surfaced after merge. Catch it on every PR. The dedicated tsconfig
# inherits strict + esModuleInterop + types from tsconfig.json so
# the gate matches what ts-jest applies at runtime.
- name: Type-check integration test files
run: npx tsc -p tsconfig.tests.json
# Integration tests run against a live community stack via docker compose.
# Runs on main merges, scheduled, and manual dispatch. Skipped on PRs to keep
# latency reasonable — PR-level live coverage is added in QF-13.
# Mirrors axonflow-sdk-go/.github/workflows/integration.yml.
integration:
name: Integration Tests (Community Stack)
runs-on: ubuntu-latest
timeout-minutes: 20
needs: [contract-tests, example-typecheck]
if: github.event_name != 'pull_request'
steps:
- name: Checkout SDK
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build SDK
run: npm run build
- name: Clone community stack
run: git clone --depth 1 https://github.com/getaxonflow/axonflow.git ../axonflow
- name: Start community stack
run: |
cd ../axonflow
docker compose up -d --wait --wait-timeout 120
# Belt-and-suspenders: also poll /health, since not every compose
# service has a healthcheck wired.
echo "Waiting for agent to be healthy..."
timeout 120 bash -c 'until curl -sf http://localhost:8080/health; do sleep 2; done'
echo "Agent is healthy"
echo "Waiting for orchestrator to be healthy..."
timeout 60 bash -c 'until curl -sf http://localhost:8081/health; do sleep 2; done'
echo "Orchestrator is healthy"
# tests/integration.test.ts targets a fully-featured stack (LLM
# provider configured, planning engine initialised, PII enforcement
# blocking) — community boots without those, so several assertions
# fail at runtime even when the wire shape is correct. Tracked in
# axonflow-sdk-typescript#198 — refactor that suite to community-
# vs enterprise-tier groupings, then re-enable here. PR-time
# typecheck against the integration files still runs in
# example-typecheck above, so wire-shape drift is still caught.
#
# The basic example below remains the live community-stack smoke.
- name: Run basic example against live stack
env:
AXONFLOW_AGENT_URL: http://localhost:8080
AXONFLOW_CLIENT_ID: demo-client
AXONFLOW_CLIENT_SECRET: demo-secret
run: |
set -e
# Clean tarball dir so a stale .tgz from a re-run can't shadow the
# fresh one. `npm pack --json` gives us the exact filename — don't
# rely on alphabetical glob.
rm -rf /tmp/sdk-tarball /tmp/example-runner
mkdir -p /tmp/sdk-tarball /tmp/example-runner
PACK_JSON=$(npm pack --pack-destination /tmp/sdk-tarball --json)
TARBALL_NAME=$(printf '%s' "$PACK_JSON" | node -e 'process.stdin.on("data",d=>{const o=JSON.parse(d);console.log(o[0].filename||o[0].name)})')
TARBALL="/tmp/sdk-tarball/$TARBALL_NAME"
test -f "$TARBALL" || { echo "Tarball not found at $TARBALL"; ls -la /tmp/sdk-tarball; exit 1; }
cp examples/basic/index.ts /tmp/example-runner/
cd /tmp/example-runner
npm init -y >/dev/null
npm install --prefer-offline --no-audit --no-fund \
"$TARBALL" tsx@4 typescript@5 @types/node@20
timeout 60 npx tsx index.ts
# Logs MUST be captured before `Stop community stack` runs — `compose
# down` destroys the containers and `compose logs` then returns
# nothing. `if: failure()` here, `if: always()` on teardown.
- name: Show docker logs on failure
if: failure()
run: |
if [ -d "../axonflow" ]; then
cd ../axonflow
docker compose logs --tail=200 || true
fi
- name: Upload docker logs on failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: docker-compose-logs
path: ../axonflow/docker-compose-logs.txt
if-no-files-found: ignore
- name: Stop community stack
if: always()
run: |
if [ -d "../axonflow" ]; then
cd ../axonflow
# Persist logs to disk so the upload step can grab them even after teardown.
docker compose logs --tail=500 > docker-compose-logs.txt 2>/dev/null || true
docker compose down --volumes --remove-orphans || true
fi