Skip to content

Commit b5cbe9f

Browse files
committed
Update rdev to be able to run update-yaml
1 parent cdd5320 commit b5cbe9f

File tree

5 files changed

+39
-0
lines changed

5 files changed

+39
-0
lines changed

.github/workflows/dist.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff 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 }}"

devtools/ci.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff 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)

devtools/config.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff 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
2123
class Parameters:

devtools/subproject.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff 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,

rdev.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff 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
105105
ci_scan_headers = false
106+
ci_update_yaml = false
106107

107108
[subprojects."robotpy-apriltag"]
108109
py_version = "wrapper"

0 commit comments

Comments
 (0)