Skip to content

Commit ce424e8

Browse files
committed
Add CI check to ensure that all headers are ignored or wrapped
1 parent 69f649c commit ce424e8

File tree

5 files changed

+51
-0
lines changed

5 files changed

+51
-0
lines changed

.github/workflows/dist.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,10 @@ jobs:
212212
SCCACHE_WEBDAV_USERNAME: ${{ secrets.WPI_ARTIFACTORY_USERNAME }}
213213
SCCACHE_WEBDAV_PASSWORD: ${{ secrets.WPI_ARTIFACTORY_TOKEN }}
214214

215+
- name: Ensure all headers are accounted for
216+
run: |
217+
python -m devtools ci scan-headers
218+
215219
- uses: actions/upload-artifact@v4
216220
with:
217221
name: "pypi-meson-${{ runner.os }}-${{ runner.arch }}-${{ matrix.python_version }}"

devtools/ci.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,3 +128,27 @@ def build_meson_wheels(ctx: Context, no_test: bool, cross: T.Optional[str]):
128128
)
129129
if not no_test:
130130
project.test(install_requirements=True)
131+
132+
133+
@ci.command()
134+
@click.pass_obj
135+
def scan_headers(ctx: Context):
136+
"""Run scan-headers on all projects"""
137+
ok = True
138+
for project in ctx.subprojects.values():
139+
if project.is_semiwrap_project():
140+
if not project.cfg.ci_scan_headers:
141+
print("- Skipping", project.name, file=sys.stderr)
142+
continue
143+
144+
with ctx.handle_exception(f"scan-headers {project.name}"):
145+
if not project.scan_headers():
146+
print(
147+
"- ERROR:",
148+
project.pyproject_path,
149+
"does not wrap/ignore every header!",
150+
)
151+
ok = False
152+
153+
if not ok:
154+
sys.exit(1)

devtools/config.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ class SubprojectConfig:
1313
#: Whether this should be built on roborio or not
1414
roborio: bool
1515

16+
#: Whether `ci scan-headers` should include this project
17+
ci_scan_headers: bool = True
18+
1619

1720
@dataclasses.dataclass
1821
class Parameters:

rdev.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,10 @@ roborio = true
9898
py_version = "wrapper"
9999
roborio = true
100100

101+
# practicality over purity - this is because we use a static
102+
# library that only exists at build time
103+
ci_scan_headers = false
104+
101105
[subprojects."robotpy-apriltag"]
102106
py_version = "wrapper"
103107
roborio = true

subprojects/robotpy-cscore/pyproject.toml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,22 @@ update_init = [
7878
"cscore"
7979
]
8080

81+
scan_headers_ignore = [
82+
# Only wrapping the C++ API
83+
"cscore.h",
84+
"cscore_c.h",
85+
"cscore_raw.h",
86+
87+
# Not needed
88+
"cameraserver/CameraServerShared.h",
89+
"vision/VisionPipeline.h",
90+
"vision/VisionRunner.h",
91+
92+
# Not wrapping OpenCV or cvnp
93+
"cvnp/*",
94+
"opencv2/*"
95+
]
96+
8197
[tool.semiwrap.extension_modules."cscore._cscore"]
8298
name = "cscore"
8399

0 commit comments

Comments
 (0)