@@ -23,76 +23,75 @@ jobs:
2323 id : matrix
2424 env :
2525 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
26- run : python3 << 'EOF_PYTHON'
27- import subprocess
28- import json
29- import sys
30- import os
31-
32- # Detect modified skills
33- result = subprocess.run(
34- ["python3", "ci/detect_changes.py", "${{ github.event.issue.number }}"],
35- capture_output=True, text=True
36- )
37- modified_skills = result.stdout.strip().split() if result.stdout.strip() else []
38- print(f"Modified skills : {modified_skills}")
39-
40- # Extract filter from comment
41- comment = "${{ github.event.comment.body }}"
42- filter_provider = "all"
43- if "/test copilot" in comment :
44- filter_provider = "copilot"
45- elif "/test ollama" in comment :
46- filter_provider = "ollama"
47- elif "/test gemini" in comment :
48- filter_provider = "gemini"
49-
50- # Generate base matrix
51- result = subprocess.run(
52- ["uv", "run", "--with", "pyyaml", "ci/matrix_generator.py", "--filter-provider", filter_provider],
53- capture_output=True, text=True, stderr=subprocess.DEVNULL
54- )
55-
56- if result.returncode != 0 :
57- print(f"Error generating matrix : {result.stderr}", file=sys.stderr)
58- sys.exit(1)
59-
60- # Extract JSON from output (skip non-JSON lines)
61- lines = result.stdout.strip().split('\n')
62- json_lines = [l for l in lines if l.startswith('{') or l.startswith('[')]
63- json_str = '\n'.join(json_lines)
64-
65- try :
66- base_matrix = json.loads(json_str)
67- except json.JSONDecodeError as e :
68- print(f"Error parsing matrix JSON : {e}", file=sys.stderr)
69- print(f"Output was : {result.stdout}", file=sys.stderr)
70- sys.exit(1)
71-
72- # Expand matrix if skills were modified
73- matrix = {"include" : []}
74-
75- if modified_skills and modified_skills[0] :
76- print(f"Expanding matrix : {len(modified_skills)} skills × {len(base_matrix['include'])} models")
77- for item in base_matrix["include"] :
78- for skill in modified_skills :
79- new_item = item.copy()
80- new_item["skill"] = skill
81- new_item["display_name"] = f"{item['display_name']} / {skill}"
82- matrix["include"].append(new_item)
83- else :
84- print(f"Testing all skills : {len(base_matrix['include'])} models")
85- matrix = base_matrix
86-
87- # Output matrix
88- matrix_json = json.dumps(matrix)
89- print(f"Generated {len(matrix['include'])} jobs")
90- print(f"result={matrix_json}")
91-
92- with open(os.environ.get('GITHUB_OUTPUT', ''), 'a') as f :
93- f.write(f"result={matrix_json}\n")
94-
95- EOF_PYTHON
26+ run : |
27+ python3 << 'MATRIX_SCRIPT'
28+ import subprocess
29+ import json
30+ import sys
31+ import os
32+
33+ # Detect modified skills
34+ result = subprocess.run(
35+ ["python3", "ci/detect_changes.py", "${{ github.event.issue.number }}"],
36+ capture_output=True, text=True
37+ )
38+ modified_skills = result.stdout.strip().split() if result.stdout.strip() else []
39+ print(f"Modified skills: {modified_skills}")
40+
41+ # Extract filter from comment
42+ comment = "${{ github.event.comment.body }}"
43+ filter_provider = "all"
44+ if "/test copilot" in comment:
45+ filter_provider = "copilot"
46+ elif "/test ollama" in comment:
47+ filter_provider = "ollama"
48+ elif "/test gemini" in comment:
49+ filter_provider = "gemini"
50+
51+ # Generate base matrix
52+ result = subprocess.run(
53+ ["uv", "run", "--with", "pyyaml", "ci/matrix_generator.py", "--filter-provider", filter_provider],
54+ capture_output=True, text=True, stderr=subprocess.DEVNULL
55+ )
56+
57+ if result.returncode != 0:
58+ print(f"Error generating matrix: {result.stderr}", file=sys.stderr)
59+ sys.exit(1)
60+
61+ # Extract JSON from output
62+ lines = result.stdout.strip().split('\n')
63+ json_lines = [l for l in lines if l.startswith('{') or l.startswith('[')]
64+ json_str = '\n'.join(json_lines)
65+
66+ try:
67+ base_matrix = json.loads(json_str)
68+ except json.JSONDecodeError as e:
69+ print(f"Error parsing matrix JSON: {e}", file=sys.stderr)
70+ print(f"Output was: {result.stdout}", file=sys.stderr)
71+ sys.exit(1)
72+
73+ # Expand matrix if skills were modified
74+ matrix = {"include": []}
75+
76+ if modified_skills and modified_skills[0]:
77+ print(f"Expanding matrix: {len(modified_skills)} skills × {len(base_matrix['include'])} models")
78+ for item in base_matrix["include"]:
79+ for skill in modified_skills:
80+ new_item = item.copy()
81+ new_item["skill"] = skill
82+ new_item["display_name"] = f"{item['display_name']} / {skill}"
83+ matrix["include"].append(new_item)
84+ else:
85+ print(f"Testing all skills: {len(base_matrix['include'])} models")
86+ matrix = base_matrix
87+
88+ # Output matrix
89+ matrix_json = json.dumps(matrix)
90+ print(f"Generated {len(matrix['include'])} jobs")
91+
92+ with open(os.environ.get('GITHUB_OUTPUT', ''), 'a') as f:
93+ f.write(f"result={matrix_json}\n")
94+ MATRIX_SCRIPT
9695
9796 evaluate :
9897 needs : prepare
0 commit comments