-
Notifications
You must be signed in to change notification settings - Fork 494
239 lines (218 loc) · 7.96 KB
/
Copy pathunittest.yaml
File metadata and controls
239 lines (218 loc) · 7.96 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
name: unit-test
permissions:
contents: read
on:
workflow_dispatch:
push:
branches: [ "master" ]
types: [opened, synchronize, reopened, labeled, unlabeled]
pull_request:
branches: [ "master" ]
types: [opened, synchronize, reopened, labeled, unlabeled]
jobs:
preprocess:
runs-on: ubuntu-latest
outputs:
changed_files: ${{ steps.changed-files.outputs.all_changed_files }}
pr_id: ${{ steps.get-pr-id.outputs.PR_ID }}
labels: ${{ fromJSON(steps.get-labels.outputs.result) }}
steps:
- id: changed-files
uses: tj-actions/changed-files@v47
- id: wait-for-triage
uses: ArcticLampyrid/action-wait-for-workflow@v1.3.0
with:
workflow: .github/workflows/triage.yaml
- id: get-pr-id
shell: bash
run: |
if [ "${{ github.event_name }}" == "pull_request" ]; then
PR_ID=${{ github.event.pull_request.number }}
elif [ "${{ github.event_name }}" == "push" ]; then
PR_NUMBER=$(git log -1 --pretty=format:'%s' | grep -oE '#[0-9]+' | grep -oE '[0-9]+')
PR_ID=${PR_NUMBER}
fi
echo "PR_ID=${PR_ID}" >> "$GITHUB_OUTPUT"
# NOTE: Preserve these line for debugging's purpose
echo "PR_ID: ${PR_ID}"
- id: get-labels
uses: actions/github-script@v9
with:
script: |
// Determine if the event is a pull request
const isPullRequest = context.eventName === 'pull_request';
if (!isPullRequest) {
return "";
}
const prNumber = context.payload.pull_request.number;
const { data: labels } = await github.rest.issues.listLabelsOnIssue({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
});
console.log('Labels:', labels.map(label => label.name));
return JSON.stringify(labels.map(label => label.name));
build-doc:
needs: preprocess
if: contains(needs.preprocess.outputs.labels, 'documentation')
uses: ./.github/workflows/mkdocs.yaml
cpp-op:
needs: preprocess
if: contains(needs.preprocess.outputs.labels, 'ops/cpp')
uses: ./.github/workflows/cpp-op-test.yaml
python-op:
needs: preprocess
if: contains(needs.preprocess.outputs.labels, 'tests')
concurrency:
group: python-op-${{ needs.preprocess.outputs.pr_id }}
cancel-in-progress: true
runs-on: jiuding
steps:
- uses: actions/checkout@v6
- shell: bash
run: tools/gpu_check.sh
- shell: bash
env:
CHANGED_FILES: ${{ join(needs.preprocess.outputs.changed_files, ' ') }}
run: |
bash tools/test-op.sh ${{ needs.preprocess.outputs.pr_id }}
examples:
needs: preprocess
if: contains(needs.preprocess.outputs.labels, 'examples')
concurrency:
group: examples-test-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
runs-on: jiuding
steps:
- uses: actions/checkout@v6
- shell: bash
run: tools/gpu_check.sh
- shell: bash
env:
CHANGED_FILES: ${{ join(needs.preprocess.outputs.changed_files, ' ') }}
run: |
bash tools/test-examples.sh ${{ needs.preprocess.outputs.pr_id }}
backend-ascend:
needs: preprocess
if: contains(needs.preprocess.outputs.labels, 'vendor/Ascend')
uses: ./.github/workflows/backend-test.yaml
with:
vendor: ascend
runner_label: ascend
gpu_check_script: tools/gpu_check_ascend.sh
changed_files: ${{ join(needs.preprocess.outputs.changed_files, ' ') }}
pr_id: ${{ needs.preprocess.outputs.pr_id }}
secrets:
RUNNER_SSH_KEY: ${{ secrets.RUNNER_SSH_KEY }}
backend-hygon:
needs: preprocess
if: contains(needs.preprocess.outputs.labels, 'vendor/Hygon')
uses: ./.github/workflows/backend-test.yaml
with:
vendor: hygon
runner_label: hygon
gpu_check_script: tools/gpu_check_hygon.sh
changed_files: ${{ join(needs.preprocess.outputs.changed_files, ' ') }}
pr_id: ${{ needs.preprocess.outputs.pr_id }}
secrets:
RUNNER_SSH_KEY: ${{ secrets.RUNNER_SSH_KEY }}
backend-iluvatar:
needs: preprocess
if: contains(needs.preprocess.outputs.labels, 'vendor/Iluvatar')
uses: ./.github/workflows/backend-test.yaml
with:
vendor: iluvatar
runner_label: iluvatar
gpu_check_script: tools/gpu_check_iluvatar.sh
changed_files: ${{ join(needs.preprocess.outputs.changed_files, ' ') }}
pr_id: ${{ needs.preprocess.outputs.pr_id }}
secrets:
RUNNER_SSH_KEY: ${{ secrets.RUNNER_SSH_KEY }}
backend-kunlunxin:
needs: preprocess
# Skipping backend-kunlunxin because we don't have a backend runner
if: false
# if: contains(needs.preprocess.outputs.labels, 'vendor/Kunlunxin')
uses: ./.github/workflows/backend-test.yaml
with:
vendor: kunlunxin
runner_label: kunlunxin
gpu_check_script: tools/gpu_check_kunlunxin.sh
changed_files: ${{ join(needs.preprocess.outputs.changed_files, ' ') }}
pr_id: ${{ needs.preprocess.outputs.pr_id }}
secrets:
RUNNER_SSH_KEY: ${{ secrets.RUNNER_SSH_KEY }}
backend-metax:
needs: preprocess
if: contains(needs.preprocess.outputs.labels, 'vendor/MetaX')
uses: ./.github/workflows/backend-test.yaml
with:
vendor: metax
runner_label: metax
gpu_check_script: tools/gpu_check_metax.sh
changed_files: ${{ join(needs.preprocess.outputs.changed_files, ' ') }}
pr_id: ${{ needs.preprocess.outputs.pr_id }}
secrets:
RUNNER_SSH_KEY: ${{ secrets.RUNNER_SSH_KEY }}
backend-mthreads:
needs: preprocess
if: contains(needs.preprocess.outputs.labels, 'vendor/MooreThreads')
uses: ./.github/workflows/backend-test.yaml
with:
vendor: mthreads
runner_label: moore
gpu_check_script: tools/gpu_check_mthreads.sh
changed_files: ${{ join(needs.preprocess.outputs.changed_files, ' ') }}
pr_id: ${{ needs.preprocess.outputs.pr_id }}
secrets:
RUNNER_SSH_KEY: ${{ secrets.RUNNER_SSH_KEY }}
backend-nvidia:
needs: preprocess
if: contains(needs.preprocess.outputs.labels, 'vendor/NVIDIA')
uses: ./.github/workflows/backend-test.yaml
with:
vendor: nvidia
runner_label: h20
gpu_check_script: tools/gpu_check.sh
changed_files: ${{ join(needs.preprocess.outputs.changed_files, ' ') }}
pr_id: ${{ needs.preprocess.outputs.pr_id }}
secrets:
RUNNER_SSH_KEY: ${{ secrets.RUNNER_SSH_KEY }}
backend-tsingmicro:
needs: preprocess
if: contains(needs.preprocess.outputs.labels, 'vendor/TsingMicro')
uses: ./.github/workflows/backend-test.yaml
with:
vendor: tsingmicro
runner_label: tsingmicro
gpu_check_script: tools/gpu_check_tsingmicro.sh
changed_files: ${{ join(needs.preprocess.outputs.changed_files, ' ') }}
pr_id: ${{ needs.preprocess.outputs.pr_id }}
secrets:
RUNNER_SSH_KEY: ${{ secrets.RUNNER_SSH_KEY }}
backend-thead:
needs: preprocess
if: contains(needs.preprocess.outputs.labels, 'vendor/Thead')
uses: ./.github/workflows/backend-test.yaml
with:
vendor: thead
runner_label: thead
gpu_check_script: tools/gpu_check_thead.sh
changed_files: ${{ join(needs.preprocess.outputs.changed_files, ' ') }}
pr_id: ${{ needs.preprocess.outputs.pr_id }}
secrets:
RUNNER_SSH_KEY: ${{ secrets.RUNNER_SSH_KEY }}
# TODO(Qiming): This job doesn't require an nvidia backend, the generic
# test-op workflow should be fine.
alpha-ops:
needs: preprocess
if: contains(needs.preprocess.outputs.labels, 'ops/alpha')
uses: ./.github/workflows/backend-test.yaml
with:
vendor: nvidia
runner_label: hopper
gpu_check_script: tools/gpu_check.sh
test_script: tools/test-op-experimental.sh
changed_files: ${{ needs.preprocess.outputs.changed_files }}
secrets:
RUNNER_SSH_KEY: ${{ secrets.RUNNER_SSH_KEY }}