forked from RLinf/RLinf
-
Notifications
You must be signed in to change notification settings - Fork 0
290 lines (254 loc) · 10.5 KB
/
ci-tests.yml
File metadata and controls
290 lines (254 loc) · 10.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
name: CI Test
on:
pull_request:
branches:
- "release/v[0-9]*.[0-9]*"
- main
types: [synchronize, labeled]
workflow_dispatch:
concurrency:
group: code-test-${{ github.ref }}
cancel-in-progress: true
jobs:
# =============================================== check changes ====================================================
check-changes:
runs-on: ubuntu-latest
outputs:
install_filter: ${{ steps.filter.outputs.install_filter }}
docker_filter: ${{ steps.filter.outputs.docker_filter }}
shared_filter: ${{ steps.filter.outputs.shared_filter }}
embodied_filter: ${{ steps.filter.outputs.embodied_filter }}
agent_reason_filter: ${{ steps.filter.outputs.agent_reason_filter }}
sft_filter: ${{ steps.filter.outputs.sft_filter }}
unit_test_filter: ${{ steps.filter.outputs.unit_test_filter }}
scheduler_test_filter: ${{ steps.filter.outputs.scheduler_test_filter }}
checked_files_filter: ${{ steps.filter.outputs.checked_files_filter }}
all_changes_filter: ${{ steps.filter.outputs.all_changes_filter }}
checked_files_filter_files: ${{ steps.filter.outputs.checked_files_filter_files }}
all_changes_no_delete_filter_files: ${{ steps.filter.outputs.all_changes_no_delete_filter_files }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Fail if the PR does not have the 'run-ci' label
if: github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'run-ci')
run: |
echo "This pull request does not have the 'run-ci' label. Failing the workflow."
exit 1
- name: Fail if the PR is a draft
if: github.event_name == 'pull_request' && github.event.pull_request.draft == true
run: |
echo "This pull request is a draft. Failing the workflow."
exit 1
- name: Detect file changes
id: filter
uses: dorny/paths-filter@v3
with:
list-files: json
filters: |
install_filter: &install
- 'pyproject.toml'
- 'requirements/*.sh'
- 'requirements/*.txt'
- '.github/workflows/install.yml'
docker_filter: &docker
- *install
- 'docker/**'
- '.github/workflows/docker-build.yml'
shared_filter: &shared
- *install
- 'rlinf/data/**'
- 'rlinf/algorithms/**'
- 'rlinf/scheduler/**'
- 'rlinf/utils/**'
- 'rlinf/workers/actor/__init__.py'
- 'rlinf/workers/actor/fsdp_actor_worker.py'
- 'rlinf/workers/reward/*.py'
- 'rlinf/workers/rollout/**'
- 'rlinf/hybrid_engines/**'
- 'rlinf/data/**'
- 'rlinf/config.py'
- 'rlinf/__init__.py'
- 'rlinf/*/__init__.py'
- 'toolkits/auto_placement/**'
embodied_filter: &embodied
- *shared
- 'rlinf/workers/actor/async_ppo_fsdp_worker.py'
- 'rlinf/envs/**'
- 'rlinf/workers/actor/async_fsdp_sac_policy_worker.py'
- 'rlinf/workers/actor/fsdp_sac_policy_worker.py'
- 'rlinf/workers/env/**'
- 'rlinf/workers/rollout/hf/**'
- 'rlinf/models/embodiment/**'
- 'rlinf/models/worldmodel/**'
- 'rlinf/runners/*embodied*.py'
- 'examples/embodiment/**'
- 'tests/e2e_tests/embodied/**'
- 'tests/e2e_tests/training_backend/**'
- 'toolkits/eval_scripts_openpi/**'
- 'toolkits/eval_scripts_dexbotic/**'
- 'toolkits/realworld_check/**'
- 'toolkits/replay_buffer/**'
- '.github/workflows/embodied-e2e-tests.yml'
agent_reason_filter: &agent
- *shared
- 'rlinf/agents/**'
- 'rlinf/workers/actor/ma_megatron_actor_worker.py'
- 'rlinf/workers/actor/megatron_actor_worker.py'
- 'rlinf/workers/critic/**'
- 'rlinf/workers/megatron_worker.py'
- 'rlinf/workers/agent/**'
- 'rlinf/workers/inference/**'
- 'rlinf/workers/rollout/server/**'
- 'rlinf/workers/rollout/sglang/**'
- 'rlinf/workers/rollout/vllm/**'
- 'rlinf/runners/agent_runner.py'
- 'rlinf/runners/reasoning_runner.py'
- 'rlinf/runners/coding_online_rl_runner.py'
- 'rlinf/runners/agent_eval_runner.py'
- 'rlinf/runners/reasoning_eval_runner.py'
- 'examples/agent/**'
- 'examples/reasoning/**'
- 'tests/e2e_tests/agent/**'
- 'tests/e2e_tests/reasoning/**'
- '.github/workflows/agent-e2e-tests.yml'
sft_filter: &sft
- *shared
- 'rlinf/workers/sft/**'
- 'rlinf/runners/sft_runner.py'
- 'examples/sft/**'
- 'tests/e2e_tests/sft/**'
- '.github/workflows/sft-e2e-tests.yml'
unit_test_filter: &unit
- *shared
- 'tests/unit_tests/**'
- '.github/workflows/unit-tests.yml'
scheduler_test_filter: &scheduler
- *shared
- *embodied
- *agent
- 'tests/e2e_tests/auto_placement/**'
- 'tests/e2e_tests/dynamic_scheduler/**'
- '.github/workflows/scheduler-tests.yml'
checked_files_filter:
- *install
- *docker
- *shared
- *embodied
- *agent
- *sft
- *unit
- *scheduler
- docs/**/*.py
- '.github/workflows/ci-tests.yml'
all_changes_filter: &all_changes
- *install
- *docker
- '**/*.py'
- 'tests/**'
- '.github/workflows/*tests.yml'
- '*.yaml'
all_changes_no_delete_filter:
- added|modified: *all_changes
# =============================================== filter coverage test ============================================
filter-coverage-test:
needs: [check-changes]
runs-on: ubuntu-latest
steps:
- name: Print files not covered by any CI filter
run: |
set -euo pipefail
json_input=$(cat << 'EOF'
{
"all": ${{ needs.check-changes.outputs.all_changes_no_delete_filter_files }},
"checked": ${{ needs.check-changes.outputs.checked_files_filter_files }}
}
EOF
)
missing=$(echo "$json_input" | jq -r '
def to_set:
reduce .[] as $x ({}; .[$x] = true);
.all as $all
| (.checked // []) as $chk
| $chk | to_set as $covered
| [
$all[]
| select((. as $p | ($covered[$p] // false)) | not)
]
')
if [ "$missing" != "[]" ]; then
echo "The following changed files are not covered by any CI filter:" >&2
echo "$missing" | jq -r '.[]' >&2
exit 1
fi
# =============================================== install tests ====================================================
install-tests:
needs: [check-changes]
if: needs.check-changes.outputs.install_filter == 'true'
uses: ./.github/workflows/install.yml
# =============================================== docker tests ====================================================
docker-tests:
needs: [check-changes]
if: needs.check-changes.outputs.docker_filter == 'true'
uses: ./.github/workflows/docker-build.yml
# =============================================== unit tests ====================================================
unit-tests:
needs: [check-changes]
if: needs.check-changes.outputs.unit_test_filter == 'true'
uses: ./.github/workflows/unit-tests.yml
# =============================================== agent e2e tests ====================================================
agent-reason-e2e-tests:
needs: [check-changes]
if: needs.check-changes.outputs.agent_reason_filter == 'true'
uses: ./.github/workflows/agent-e2e-tests.yml
# =============================================== embodied e2e tests ====================================================
embodied-e2e-tests:
needs: [check-changes]
if: needs.check-changes.outputs.embodied_filter == 'true'
uses: ./.github/workflows/embodied-e2e-tests.yml
# =============================================== sft e2e tests ====================================================
sft-e2e-tests:
needs: [check-changes]
if: needs.check-changes.outputs.sft_filter == 'true'
uses: ./.github/workflows/sft-e2e-tests.yml
# =============================================== scheduler tests ====================================================
scheduler-tests:
needs: [check-changes]
if: needs.check-changes.outputs.scheduler_test_filter == 'true'
uses: ./.github/workflows/scheduler-tests.yml
# =============================================== finale ====================================================
ci-test-finish:
needs: [
check-changes,
filter-coverage-test,
install-tests,
docker-tests,
unit-tests,
agent-reason-e2e-tests,
embodied-e2e-tests,
sft-e2e-tests,
scheduler-tests
]
if: always()
runs-on: ubuntu-latest
steps:
# Refer to https://github.com/sgl-project/sglang/blob/main/.github/workflows/pr-test.yml
- name: Check all dependent job statuses
run: |
# Convert the 'needs' context to a JSON string
json_needs='${{ toJson(needs) }}'
# Get a list of all job names from the JSON keys
job_names=$(echo "$json_needs" | jq -r 'keys_unsorted[]')
for job in $job_names; do
# For each job, extract its result
result=$(echo "$json_needs" | jq -r --arg j "$job" '.[$j].result')
# Print the job name and its result
echo "$job: $result"
# Check for failure or cancellation and exit if found
if [[ "$result" == "failure" || "$result" == "cancelled" ]]; then
echo "The above jobs failed."
exit 1
fi
done
# If the loop completes, all jobs were successful
echo "All jobs completed successfully"
exit 0