File tree Expand file tree Collapse file tree 5 files changed +39
-0
lines changed
Expand file tree Collapse file tree 5 files changed +39
-0
lines changed Original file line number Diff line number Diff line change @@ -216,6 +216,10 @@ jobs:
216216 run : |
217217 python -m devtools ci scan-headers
218218
219+ - name : Ensure YAML files are up to date
220+ run : |
221+ python -m devtools ci update-yaml
222+
219223 - uses : actions/upload-artifact@v4
220224 with :
221225 name : " pypi-meson-${{ runner.os }}-${{ runner.arch }}-${{ matrix.python_version }}"
Original file line number Diff line number Diff line change @@ -152,3 +152,22 @@ def scan_headers(ctx: Context):
152152
153153 if not ok :
154154 sys .exit (1 )
155+
156+
157+ @ci .command ()
158+ @click .pass_obj
159+ def update_yaml (ctx : Context ):
160+ """Run update-yaml on all projects"""
161+ failed_subprojects = 0
162+ for project in ctx .subprojects .values ():
163+ if project .is_semiwrap_project ():
164+ if not project .cfg .ci_update_yaml :
165+ print ("- Skipping" , project .name , file = sys .stderr )
166+ continue
167+
168+ if not project .update_yaml ():
169+ failed_subprojects += 1
170+
171+ if failed_subprojects != 0 :
172+ print (f"update-yaml has failed for { failed_subprojects } project(s)" )
173+ sys .exit (1 )
Original file line number Diff line number Diff line change @@ -16,6 +16,8 @@ class SubprojectConfig:
1616 #: Whether `ci scan-headers` should include this project
1717 ci_scan_headers : bool = True
1818
19+ ci_update_yaml : bool = True
20+
1921
2022@dataclasses .dataclass
2123class Parameters :
Original file line number Diff line number Diff line change @@ -61,6 +61,19 @@ def scan_headers(self):
6161 )
6262 return result .returncode == 0
6363
64+ def update_yaml (self ):
65+ """Resyncs the yaml files with their header files"""
66+ result = run_cmd (
67+ sys .executable ,
68+ "-m" ,
69+ "semiwrap" ,
70+ "update-yaml" ,
71+ "--write" ,
72+ cwd = self .path ,
73+ check = False ,
74+ )
75+ return result .returncode == 0
76+
6477 def update_init (self ):
6578 run_cmd (
6679 sys .executable ,
Original file line number Diff line number Diff line change @@ -103,6 +103,7 @@ robot = true
103103# practicality over purity - this is because we use a static
104104# library that only exists at build time
105105ci_scan_headers = false
106+ ci_update_yaml = false
106107
107108[subprojects ."robotpy-apriltag" ]
108109py_version = " wrapper"
You can’t perform that action at this time.
0 commit comments