Skip to content

Commit b5a7079

Browse files
committed
support multiple labels
1 parent dff50ca commit b5a7079

1 file changed

Lines changed: 42 additions & 30 deletions

File tree

.github/workflows/label-validation.yml

Lines changed: 42 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -8,50 +8,62 @@ on:
88
- main
99

1010
jobs:
11-
parse-label:
11+
get-jobs:
1212
runs-on: ubuntu-latest
1313
outputs:
14-
runner-type: ${{ steps.parse-label.outputs.runner-type }}
15-
model-prefix: ${{ steps.parse-label.outputs.model-prefix }}
14+
search-space-config: ${{ steps.get-jobs.outputs.search-space-config }}
1615
steps:
17-
- name: Parse label
18-
id: parse-label
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
19+
- id: get-jobs
1920
shell: python
2021
run: |
2122
import json
23+
import subprocess
2224
import re
2325
import os
2426
27+
# Get matching labels
2528
labels = json.loads(r'''${{ toJson(github.event.pull_request.labels) }}''')
26-
label_names = [label['name'] for label in labels]
27-
print(f"Label names: {label_names}")
29+
pattern = r'^([^_]+)_([^_]+)$'
2830
31+
matching = []
32+
for label in labels:
33+
match = re.match(pattern, label['name'])
34+
if match:
35+
matching.append({'runner-type': match.group(1), 'model-prefix': match.group(2)})
36+
print(f"Matched label: {label['name']}")
2937
38+
if not matching:
39+
print("No matching labels found")
40+
with open(os.environ['GITHUB_OUTPUT'], 'a') as f:
41+
f.write('search-space-config=[]\n')
42+
exit(0)
3043
31-
get-jobs:
32-
needs: parse-label
33-
if: ${{ needs.parse-label.outputs.runner-type != '' && needs.parse-label.outputs.model-prefix != ''}}
34-
runs-on: ubuntu-latest
35-
outputs:
36-
search-space-config: ${{ steps.get-jobs.outputs.search-space-config }}
37-
steps:
38-
- name: Checkout code
39-
uses: actions/checkout@v4
44+
# Generate configs for all matching labels
45+
subprocess.run(['pip', 'install', 'pydantic'], check=True)
4046
41-
- id: get-jobs
42-
run: |
43-
pip install pydantic
44-
CONFIG_JSON=$(python3 ${GITHUB_WORKSPACE}/utils/matrix-logic/generate_sweep_configs.py \
45-
full-sweep \
46-
--runner-type ${{ needs.parse-label.outputs.runner-type }} \
47-
--model-prefix ${{ needs.parse-label.outputs.model-prefix }} \
48-
--seq-lens 1k1k \
49-
--test-mode \
50-
--config-files \
51-
${GITHUB_WORKSPACE}/.github/configs/nvidia-master.yaml \
52-
${GITHUB_WORKSPACE}/.github/configs/amd-master.yaml \
53-
--runner-config ${GITHUB_WORKSPACE}/.github/configs/runners.yaml)
54-
echo "search-space-config=$CONFIG_JSON" >> $GITHUB_OUTPUT
47+
all_configs = []
48+
for label in matching:
49+
result = subprocess.run([
50+
'python3', f"{os.environ['GITHUB_WORKSPACE']}/utils/matrix-logic/generate_sweep_configs.py",
51+
'full-sweep',
52+
'--runner-type', label['runner-type'],
53+
'--model-prefix', label['model-prefix'],
54+
'--seq-lens', '1k1k',
55+
'--test-mode',
56+
'--config-files',
57+
f"{os.environ['GITHUB_WORKSPACE']}/.github/configs/nvidia-master.yaml",
58+
f"{os.environ['GITHUB_WORKSPACE']}/.github/configs/amd-master.yaml",
59+
'--runner-config', f"{os.environ['GITHUB_WORKSPACE']}/.github/configs/runners.yaml"
60+
], capture_output=True, text=True, check=True)
61+
62+
all_configs.extend(json.loads(result.stdout))
63+
64+
print(f"Total configs: {len(all_configs)}")
65+
with open(os.environ['GITHUB_OUTPUT'], 'a') as f:
66+
f.write(f'search-space-config={json.dumps(all_configs)}\n')
5567
5668
validate:
5769
needs: get-jobs

0 commit comments

Comments
 (0)