-
Notifications
You must be signed in to change notification settings - Fork 0
184 lines (154 loc) · 6.2 KB
/
Copy pathintegration.yml
File metadata and controls
184 lines (154 loc) · 6.2 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 — Tuesday 06:00 UTC so failures land in EU/IN
# working hours, aligned with the TS + Java + Go SDK integration crons.
schedule:
- cron: '0 6 * * 2'
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.
# Matrixed across the same Python versions ci.yml exercises (3.10/3.11/3.12)
# so version-specific drift surfaces at PR time, not at release time.
contract-tests:
name: Contract Tests (Python ${{ matrix.python-version }})
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
fail-fast: false
# PR runs only Python 3.11. Push, dispatch, and weekly Tuesday cron run
# the full matrix to catch version-specific drift before tagging.
matrix:
python-version: ${{ fromJson(github.event_name == 'pull_request' && '["3.11"]' || '["3.10", "3.11", "3.12"]') }}
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Install dependencies
run: pip install -e ".[dev]"
- name: Run contract tests
run: pytest tests/test_contract.py -v --no-cov
# Demo script syntax validation on every PR and push. Lightweight.
demo-scripts:
name: Demo Scripts Validation
runs-on: ubuntu-latest
needs: contract-tests
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
- name: Install dependencies
run: pip install -e ".[dev,all]"
- name: Validate quickstart.py syntax
run: python -m py_compile examples/quickstart.py
- name: Validate gateway_mode.py syntax
run: python -m py_compile examples/gateway_mode.py
- name: Validate openai_integration.py syntax
run: python -m py_compile examples/openai_integration.py
- name: Validate wcp_retry_idempotency.py syntax
run: python -m py_compile examples/wcp_retry_idempotency.py
- name: Import quickstart
run: python -c "from examples.quickstart import main; print('quickstart.py imports successfully')"
- name: Import gateway_mode
run: python -c "from examples.gateway_mode import main, blocked_example; print('gateway_mode.py imports successfully')"
# Integration tests run against a live community stack spun up 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.
integration:
name: Integration Tests (Community Stack)
runs-on: ubuntu-latest
timeout-minutes: 20
needs: [contract-tests, demo-scripts]
if: github.event_name != 'pull_request'
steps:
- name: Checkout SDK
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
- name: Install dependencies
run: pip install -e ".[dev,all]"
- 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"
- name: Run integration tests
env:
RUN_INTEGRATION_TESTS: '1'
AXONFLOW_AGENT_URL: http://localhost:8080
AXONFLOW_CLIENT_ID: demo-client
AXONFLOW_CLIENT_SECRET: demo-secret
run: pytest tests/test_integration.py -v --no-cov
- name: Run quickstart example
env:
AXONFLOW_AGENT_URL: http://localhost:8080
AXONFLOW_CLIENT_ID: demo-client
AXONFLOW_CLIENT_SECRET: demo-secret
run: |
cd examples
timeout 30 python quickstart.py
- name: Run gateway_mode example
env:
AXONFLOW_AGENT_URL: http://localhost:8080
AXONFLOW_CLIENT_ID: demo-client
AXONFLOW_CLIENT_SECRET: demo-secret
run: |
cd examples
timeout 30 python gateway_mode.py
# 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 post-teardown.
docker compose logs --tail=500 > docker-compose-logs.txt 2>/dev/null || true
docker compose down --volumes --remove-orphans || true
fi