forked from flagos-ai/FlagScale
-
Notifications
You must be signed in to change notification settings - Fork 2
371 lines (340 loc) · 15.5 KB
/
Copy pathall_tests_common.yml
File metadata and controls
371 lines (340 loc) · 15.5 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
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
name: Common All Tests
on:
workflow_call:
inputs:
platform:
required: true
type: string
description: Platform name (e.g., cuda, default)
ci_train_image:
required: false
type: string
description: Override train image (e.g., newly built image). Falls back to platform config if not set.
default: ""
ci_inference_image:
required: false
type: string
description: Override inference image. Falls back to platform config if not set.
default: ""
runs_on:
required: false
type: string
description: Override runs_on. Falls back to platform config if not set.
default: ""
container_volumes:
required: false
type: string
description: Override container_volumes. Falls back to platform config if not set.
default: ""
jobs:
checkout_and_config:
defaults:
run:
shell: bash
runs-on: ubuntu-latest
outputs:
# ci_image: ${{ steps.config.outputs.ci_image }}
ci_train_image: ${{ steps.config.outputs.ci_train_image }}
ci_inference_image: ${{ steps.config.outputs.ci_inference_image }}
runs_on: ${{ steps.config.outputs.runs_on }}
container_volumes: ${{ steps.config.outputs.container_volumes }}
container_options: ${{ steps.config.outputs.container_options }}
device_types: ${{ steps.config.outputs.device_types }}
train_test_matrix: ${{ steps.config.outputs.train_test_matrix }}
hetero_train_test_matrix: ${{ steps.config.outputs.hetero_train_test_matrix }}
inference_test_matrix: ${{ steps.config.outputs.inference_test_matrix }}
serve_test_matrix: ${{ steps.config.outputs.serve_test_matrix }}
rl_test_matrix: ${{ steps.config.outputs.rl_test_matrix }}
benchmark_test_matrix: ${{ steps.config.outputs.benchmark_test_matrix }}
pkg_mgr: ${{ steps.config.outputs.pkg_mgr }}
env_path: ${{ steps.config.outputs.env_path }}
env_name_train: ${{ steps.config.outputs.env_name_train }}
env_name_inference: ${{ steps.config.outputs.env_name_inference }}
env_name_serve: ${{ steps.config.outputs.env_name_serve }}
env_name_rl: ${{ steps.config.outputs.env_name_rl }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
ref: ${{ github.event.pull_request.head.ref || github.ref }}
ssh-strict: true
ssh-user: git
persist-credentials: false
clean: true
sparse-checkout-cone-mode: true
fetch-tags: false
show-progress: true
lfs: false
submodules: false
set-safe-directory: true
- name: Cache source code
id: cache-source
uses: actions/cache@v4
with:
path: .
key: source-code-${{ github.sha }}
- name: Create source code tarball for distribution
run: |
tar -czf /tmp/flagscale-source.tar.gz \
--exclude='.git' \
--exclude='*.pyc' \
--exclude='__pycache__' \
.
- name: Upload source code artifact
uses: actions/upload-artifact@v4
with:
name: flagscale-source-${{ github.sha }}
path: /tmp/flagscale-source.tar.gz
retention-days: 1
compression-level: 0
- name: Load platform configuration
id: config
run: |
set -euo pipefail
PLATFORM="${{ inputs.platform }}"
CONFIG_FILE=".github/configs/${PLATFORM}.yml"
if [ ! -f "$CONFIG_FILE" ]; then
echo "❌ Error: Platform configuration file not found: $CONFIG_FILE"
echo "Available configs:"
ls -la .github/configs/
exit 1
fi
# Install mikefarah/yq (v4) for YAML parsing
sudo wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/download/v4.45.1/yq_linux_amd64
sudo chmod +x /usr/local/bin/yq
/usr/local/bin/yq --version
# Source the platform config loading script
source ./tools/install/utils/load_platform_config.sh
# Load configuration and group tests by task
load_platform_config "$PLATFORM"
# Override images if provided as inputs
if [ -n "${{ inputs.ci_train_image }}" ]; then
echo "ci_train_image=${{ inputs.ci_train_image }}" >> $GITHUB_OUTPUT
fi
if [ -n "${{ inputs.ci_inference_image }}" ]; then
echo "ci_inference_image=${{ inputs.ci_inference_image }}" >> $GITHUB_OUTPUT
fi
# Use single-quoted assignment so bash treats the JSON value literally
# (double quotes inside the JSON would break echo "runs_on=${{ inputs.runs_on }}")
RUNS_ON_INPUT='${{ inputs.runs_on }}'
if [ -n "$RUNS_ON_INPUT" ]; then
{ echo 'runs_on<<EOFRUNSON_INPUT'; echo "$RUNS_ON_INPUT"; echo 'EOFRUNSON_INPUT'; } >> $GITHUB_OUTPUT
fi
# (double quotes inside the JSON would break echo "container_volumes=${{ inputs.container_volumes }}")
CONTAINER_VOLUMES_INPUT='${{ inputs.container_volumes }}'
if [ -n "$CONTAINER_VOLUMES_INPUT" ]; then
{ echo 'container_volumes<<EOFRUNSON_INPUT'; echo "$CONTAINER_VOLUMES_INPUT"; echo 'EOFRUNSON_INPUT'; } >> $GITHUB_OUTPUT
fi
# CLI validation runs first (outside virtual env) as a gate for all subsequent tests
cli_validation:
needs: checkout_and_config
uses: ./.github/workflows/functional_tests_cli.yml
with:
platform: ${{ inputs.platform }}
image: ${{ needs.checkout_and_config.outputs.ci_train_image }}
runs_on: ${{ needs.checkout_and_config.outputs.runs_on }}
container_volumes: ${{ needs.checkout_and_config.outputs.container_volumes }}
container_options: ${{ needs.checkout_and_config.outputs.container_options }}
source_artifact: flagscale-source-${{ github.sha }}
pkg_mgr: ${{ needs.checkout_and_config.outputs.pkg_mgr }}
env_name: ${{ needs.checkout_and_config.outputs.env_name_train }}
env_path: ${{ needs.checkout_and_config.outputs.env_path }}
unit_tests:
needs:
- checkout_and_config
- cli_validation
if: fromJson(needs.checkout_and_config.outputs.device_types)[0] != null
strategy:
fail-fast: false
matrix:
device: ${{ fromJson(needs.checkout_and_config.outputs.device_types) }}
uses: ./.github/workflows/unit_tests_common.yml
name: unit_tests
with:
platform: ${{ inputs.platform }}
device: ${{ matrix.device }}
image: ${{ needs.checkout_and_config.outputs.ci_train_image }}
runs_on: ${{ needs.checkout_and_config.outputs.runs_on }}
container_volumes: ${{ needs.checkout_and_config.outputs.container_volumes }}
container_options: ${{ needs.checkout_and_config.outputs.container_options }}
source_artifact: flagscale-source-${{ github.sha }}
pkg_mgr: ${{ needs.checkout_and_config.outputs.pkg_mgr }}
env_name: ${{ needs.checkout_and_config.outputs.env_name_train }}
env_path: ${{ needs.checkout_and_config.outputs.env_path }}
functional_tests_train:
needs:
- checkout_and_config
- cli_validation
- unit_tests
if: fromJson(needs.checkout_and_config.outputs.train_test_matrix)[0] != null
uses: ./.github/workflows/functional_tests_train.yml
with:
platform: ${{ inputs.platform }}
test_matrix: ${{ needs.checkout_and_config.outputs.train_test_matrix }}
image: ${{ needs.checkout_and_config.outputs.ci_train_image }}
runs_on: ${{ needs.checkout_and_config.outputs.runs_on }}
container_volumes: ${{ needs.checkout_and_config.outputs.container_volumes }}
container_options: ${{ needs.checkout_and_config.outputs.container_options }}
source_artifact: flagscale-source-${{ github.sha }}
pkg_mgr: ${{ needs.checkout_and_config.outputs.pkg_mgr }}
env_name: ${{ needs.checkout_and_config.outputs.env_name_train }}
env_path: ${{ needs.checkout_and_config.outputs.env_path }}
functional_tests_hetero_train:
needs:
- checkout_and_config
- cli_validation
- unit_tests
if: fromJson(needs.checkout_and_config.outputs.hetero_train_test_matrix)[0] != null
uses: ./.github/workflows/functional_tests_hetero_train.yml
with:
platform: ${{ inputs.platform }}
test_matrix: ${{ needs.checkout_and_config.outputs.hetero_train_test_matrix }}
image: ${{ needs.checkout_and_config.outputs.ci_train_image }}
runs_on: ${{ needs.checkout_and_config.outputs.runs_on }}
container_volumes: ${{ needs.checkout_and_config.outputs.container_volumes }}
container_options: ${{ needs.checkout_and_config.outputs.container_options }}
source_artifact: flagscale-source-${{ github.sha }}
pkg_mgr: ${{ needs.checkout_and_config.outputs.pkg_mgr }}
env_name: ${{ needs.checkout_and_config.outputs.env_name_train }}
env_path: ${{ needs.checkout_and_config.outputs.env_path }}
functional_tests_inference:
needs:
- checkout_and_config
- cli_validation
- unit_tests
if: fromJson(needs.checkout_and_config.outputs.inference_test_matrix)[0] != null
uses: ./.github/workflows/functional_tests_inference.yml
with:
platform: ${{ inputs.platform }}
test_matrix: ${{ needs.checkout_and_config.outputs.inference_test_matrix }}
image: ${{ needs.checkout_and_config.outputs.ci_inference_image }}
runs_on: ${{ needs.checkout_and_config.outputs.runs_on }}
container_volumes: ${{ needs.checkout_and_config.outputs.container_volumes }}
container_options: ${{ needs.checkout_and_config.outputs.container_options }}
source_artifact: flagscale-source-${{ github.sha }}
pkg_mgr: ${{ needs.checkout_and_config.outputs.pkg_mgr }}
env_name: ${{ needs.checkout_and_config.outputs.env_name_inference }}
env_path: ${{ needs.checkout_and_config.outputs.env_path }}
functional_tests_serve:
needs:
- checkout_and_config
- cli_validation
- unit_tests
if: fromJson(needs.checkout_and_config.outputs.serve_test_matrix)[0] != null
uses: ./.github/workflows/functional_tests_serve.yml
with:
platform: ${{ inputs.platform }}
test_matrix: ${{ needs.checkout_and_config.outputs.serve_test_matrix }}
image: ${{ needs.checkout_and_config.outputs.ci_inference_image }}
runs_on: ${{ needs.checkout_and_config.outputs.runs_on }}
container_volumes: ${{ needs.checkout_and_config.outputs.container_volumes }}
container_options: ${{ needs.checkout_and_config.outputs.container_options }}
source_artifact: flagscale-source-${{ github.sha }}
pkg_mgr: ${{ needs.checkout_and_config.outputs.pkg_mgr }}
env_name: ${{ needs.checkout_and_config.outputs.env_name_serve }}
env_path: ${{ needs.checkout_and_config.outputs.env_path }}
# NOTE: rl functional tests are temporarily disabled
# functional_tests_rl:
# needs:
# - checkout_and_config
# - unit_tests
# if: fromJson(needs.checkout_and_config.outputs.rl_test_matrix)[0] != null
# uses: ./.github/workflows/functional_tests_rl.yml
# with:
# platform: ${{ inputs.platform }}
# test_matrix: ${{ needs.checkout_and_config.outputs.rl_test_matrix }}
# image: ${{ needs.checkout_and_config.outputs.ci_image }}
# runs_on: ${{ needs.checkout_and_config.outputs.runs_on }}
# container_volumes: ${{ needs.checkout_and_config.outputs.container_volumes }}
# container_options: ${{ needs.checkout_and_config.outputs.container_options }}
# source_artifact: flagscale-source-${{ github.sha }}
# pkg_mgr: ${{ needs.checkout_and_config.outputs.pkg_mgr }}
# env_name: ${{ needs.checkout_and_config.outputs.env_name_rl }}
# env_path: ${{ needs.checkout_and_config.outputs.env_path }}
functional_tests_benchmark:
needs:
- checkout_and_config
- cli_validation
- unit_tests
if: fromJson(needs.checkout_and_config.outputs.benchmark_test_matrix)[0] != null
uses: ./.github/workflows/functional_tests_benchmark.yml
with:
platform: ${{ inputs.platform }}
test_matrix: ${{ needs.checkout_and_config.outputs.benchmark_test_matrix }}
image: ${{ needs.checkout_and_config.outputs.ci_train_image }}
runs_on: ${{ needs.checkout_and_config.outputs.runs_on }}
container_volumes: ${{ needs.checkout_and_config.outputs.container_volumes }}
container_options: ${{ needs.checkout_and_config.outputs.container_options }}
source_artifact: flagscale-source-${{ github.sha }}
pkg_mgr: ${{ needs.checkout_and_config.outputs.pkg_mgr }}
env_name: ${{ needs.checkout_and_config.outputs.env_name_train }}
env_path: ${{ needs.checkout_and_config.outputs.env_path }}
all_tests_complete:
defaults:
run:
shell: bash
needs:
- checkout_and_config
- cli_validation
- unit_tests
- functional_tests_train
- functional_tests_hetero_train
- functional_tests_benchmark
- functional_tests_inference
- functional_tests_serve
# NOTE: Disabled tests removed from needs
# - functional_tests_rl
runs-on: ubuntu-latest
if: always()
steps:
- name: Verify all tests passed
run: |
# Check all test jobs (skip if not run)
failed=false
if [ "${{ needs.unit_tests.result }}" != "success" ] && \
[ "${{ needs.unit_tests.result }}" != "skipped" ]; then
echo "❌ Unit tests failed"
failed=true
fi
if [ "${{ needs.cli_validation.result }}" != "success" ] && \
[ "${{ needs.cli_validation.result }}" != "skipped" ]; then
echo "❌ CLI validation failed"
failed=true
fi
# Only check functional tests if they ran
if [ "${{ needs.functional_tests_train.result }}" != "success" ] && \
[ "${{ needs.functional_tests_train.result }}" != "skipped" ]; then
echo "❌ Training functional tests failed"
failed=true
fi
if [ "${{ needs.functional_tests_hetero_train.result }}" != "success" ] && \
[ "${{ needs.functional_tests_hetero_train.result }}" != "skipped" ]; then
echo "❌ Heterogeneous training functional tests failed"
failed=true
fi
if [ "${{ needs.functional_tests_benchmark.result }}" != "success" ] && \
[ "${{ needs.functional_tests_benchmark.result }}" != "skipped" ]; then
echo "❌ Benchmark tests failed"
failed=true
fi
if [ "${{ needs.functional_tests_inference.result }}" != "success" ] && \
[ "${{ needs.functional_tests_inference.result }}" != "skipped" ]; then
echo "❌ Inference functional tests failed"
failed=true
fi
if [ "${{ needs.functional_tests_serve.result }}" != "success" ] && \
[ "${{ needs.functional_tests_serve.result }}" != "skipped" ]; then
echo "❌ Serve functional tests failed"
failed=true
fi
# NOTE: Inference, serve, and rl checks disabled
# if [ "${{ needs.functional_tests_rl.result }}" != "success" ] && \
# [ "${{ needs.functional_tests_rl.result }}" != "skipped" ]; then
# echo "❌ RL functional tests failed"
# failed=true
# fi
if [ "$failed" = "true" ]; then
exit 1
fi
echo "✅ All tests completed successfully!"