-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Expand file tree
/
Copy pathrelease-branch-scheduled-ci.yml
More file actions
238 lines (210 loc) · 8.05 KB
/
Copy pathrelease-branch-scheduled-ci.yml
File metadata and controls
238 lines (210 loc) · 8.05 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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
name: Release Branch Scheduled CI
run-name: Scheduled CI checks for active release branches
on:
schedule:
# Run twice weekly (Monday and Thursday) at 2 AM UTC
- cron: '0 2 * * 1,4'
workflow_dispatch:
inputs:
branches:
description: 'Comma-separated list of release branches to test (leave empty for auto-discovery)'
required: false
type: string
concurrency:
group: ${{ github.workflow }}-${{ github.run_id }}
cancel-in-progress: false
jobs:
discover-branches:
name: Discover active release branches
runs-on: ubuntu-latest
outputs:
branches: ${{ steps.set-branches.outputs.branches }}
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0 # Fetch all branches
- name: Discover release branches
id: set-branches
run: |
if [ -n "${{ github.event.inputs.branches }}" ]; then
# Manual input: use provided branches
branches=$(echo "${{ github.event.inputs.branches }}" | tr ',' '\n' | jq -R -s -c 'split("\n") | map(select(length > 0))')
else
# Auto-discovery: find active release branches (*.x pattern)
# These are the long-lived release branches that should be tested regularly
branches=$(git branch -r | \
grep 'origin/release-[0-9]' | \
grep '\.x$' | \
sed 's|^[[:space:]]*origin/||' | \
sort -V | \
tail -3 | \
jq -R -s -c 'split("\n") | map(select(length > 0) | ltrimstr(" ") | rtrimstr(" "))')
fi
echo "branches=$branches" >> "$GITHUB_OUTPUT"
echo "Testing branches: $branches"
unit-tests:
name: Unit tests on ${{ matrix.branch }}
needs: discover-branches
if: needs.discover-branches.outputs.branches != '[]'
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
branch: ${{ fromJSON(needs.discover-branches.outputs.branches) }}
python: ["3.12", "3.13"]
steps:
- name: Checkout ${{ matrix.branch }}
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: ${{ matrix.branch }}
- name: Install dependencies
uses: ./.github/actions/setup-runner
with:
python-version: ${{ matrix.python }}
- name: Run unit tests
run: |
PYTHON_VERSION=${{ matrix.python }} ./scripts/unit-tests.sh --junitxml=pytest-report-${{ matrix.python }}.xml
- name: Upload test results
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: unit-test-results-${{ matrix.branch }}-${{ matrix.python }}
path: |
.pytest_cache/
pytest-report-${{ matrix.python }}.xml
htmlcov-${{ matrix.python }}/
retention-days: 7
integration-tests:
name: Integration tests on ${{ matrix.branch }}
needs: discover-branches
if: needs.discover-branches.outputs.branches != '[]'
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
branch: ${{ fromJSON(needs.discover-branches.outputs.branches) }}
client: [library, docker, server]
python-version: ["3.12"]
# Pinned to 22.22 due to node-fetch v2 "Premature close" regression in 22.23.0
# (nodejs/node#63989). Unpin once a patched 22.x ships with nodejs/node#64004.
node-version: ['22.22']
client-version: ["latest"]
steps:
- name: Checkout ${{ matrix.branch }}
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: ${{ matrix.branch }}
- name: Setup test environment
uses: ./.github/actions/setup-test-environment
with:
python-version: ${{ matrix.python-version }}
client-version: ${{ matrix.client-version }}
setup: 'ollama'
suite: 'base'
inference-mode: 'replay'
branch: ${{ matrix.branch }}
- name: Check for TypeScript client tests
id: check-ts-client
run: |
if [ -d "tests/integration/client-typescript" ]; then
echo "exists=true" >> "$GITHUB_OUTPUT"
else
echo "exists=false" >> "$GITHUB_OUTPUT"
fi
- name: Setup Node.js for TypeScript client tests
if: matrix.client == 'server' && steps.check-ts-client.outputs.exists == 'true'
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
cache-dependency-path: tests/integration/client-typescript/package-lock.json
- name: Setup TypeScript client
if: matrix.client == 'server' && steps.check-ts-client.outputs.exists == 'true'
id: setup-ts-client
uses: ./.github/actions/setup-typescript-client
with:
client-version: ${{ matrix.client-version }}
- name: Run tests
uses: ./.github/actions/run-and-record-tests
env:
OPENAI_API_KEY: dummy
TS_CLIENT_PATH: ${{ steps.setup-ts-client.outputs.ts-client-path || '' }}
with:
stack-config: >-
${{ matrix.client == 'library' && 'ci-tests'
|| (matrix.client == 'server' && 'server:ci-tests')
|| 'docker:ci-tests' }}
setup: 'ollama'
inference-mode: 'replay'
suite: 'base'
build-verification:
name: Build verification on ${{ matrix.branch }}
needs: discover-branches
if: needs.discover-branches.outputs.branches != '[]'
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
branch: ${{ fromJSON(needs.discover-branches.outputs.branches) }}
python-version: ['3.12', '3.13']
steps:
- name: Checkout ${{ matrix.branch }}
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: ${{ matrix.branch }}
- name: Install uv
uses: astral-sh/setup-uv@11f9893b081a58869d3b5fccaea48c9e9e46f990 # v8.3.2
with:
python-version: ${{ matrix.python-version }}
activate-environment: true
- name: Build OGX API package
if: hashFiles('src/ogx_api/pyproject.toml') != ''
working-directory: src/ogx_api
run: uv build
- name: Build OGX package
run: uv build
- name: Install OGX package (with api stubs from local build)
run: |
if [ -d "src/ogx_api/dist" ]; then
uv pip install --find-links src/ogx_api/dist dist/*.whl
else
uv pip install dist/*.whl
fi
- name: Verify OGX package
run: |
uv pip list
uv pip show ogx
command -v ogx
ogx stack list-apis
ogx stack list-providers inference
ogx stack list-deps starter
summary:
name: Scheduled CI Summary
runs-on: ubuntu-latest
needs: [discover-branches, unit-tests, integration-tests, build-verification]
if: always()
steps:
- name: Check results
run: |
branches="${{ needs.discover-branches.outputs.branches }}"
if [ "$branches" = "[]" ] || [ -z "$branches" ]; then
echo "::warning::No release branches found to test"
exit 0
fi
if [ "${{ needs.unit-tests.result }}" != "success" ]; then
echo "::error::Unit tests failed on one or more branches"
exit 1
fi
if [ "${{ needs.integration-tests.result }}" != "success" ]; then
echo "::error::Integration tests failed on one or more branches"
exit 1
fi
if [ "${{ needs.build-verification.result }}" != "success" ]; then
echo "::error::Build verification failed on one or more branches"
exit 1
fi
echo "✅ All scheduled CI checks passed for release branches!"