forked from RLinf/RLinf
-
Notifications
You must be signed in to change notification settings - Fork 3
143 lines (117 loc) · 4.7 KB
/
ci-tests.yml
File metadata and controls
143 lines (117 loc) · 4.7 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
name: CI Test
on:
push:
branches:
- "release/v[0-9].[0-9]"
- main
pull_request:
branches: [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:
file_filter: ${{ steps.filter.outputs.file_filter }}
install_filter: ${{ steps.filter.outputs.install_filter }}
docker_filter: ${{ steps.filter.outputs.docker_filter }}
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:
filters: |
file_filter:
- '**/*.py'
- 'tests/**'
- '.github/workflows/*tests.yml'
- '*.yaml'
install_filter:
- 'pyproject.toml'
- 'requirements/*.sh'
- 'requirements/*.txt'
- '.github/workflows/install.yml'
docker_filter:
- 'docker/torch*/**'
- '.github/workflows/docker-build.yml'
# =============================================== 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.file_filter == 'true'
uses: ./.github/workflows/unit-tests.yml
# =============================================== agent e2e tests ====================================================
agent-reason-e2e-tests:
needs: [check-changes]
if: needs.check-changes.outputs.file_filter == 'true'
uses: ./.github/workflows/agent-e2e-tests.yml
# =============================================== embodied e2e tests ====================================================
embodied-e2e-tests:
needs: [check-changes]
if: needs.check-changes.outputs.file_filter == 'true'
uses: ./.github/workflows/embodied-e2e-tests.yml
# =============================================== scheduler tests ====================================================
scheduler-tests:
needs: [check-changes]
if: needs.check-changes.outputs.file_filter == 'true'
uses: ./.github/workflows/scheduler-tests.yml
# =============================================== finale ====================================================
ci-test-finish:
needs: [
check-changes,
install-tests,
docker-tests,
unit-tests,
agent-reason-e2e-tests,
embodied-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