From fdec30403ddeb672fa0dd8c7459156623eb6d282 Mon Sep 17 00:00:00 2001 From: skylartaylor Date: Sun, 22 Nov 2026 00:21:16 +0100 Subject: [PATCH] Report existing packaging tests to Sonar without excluding helpers --- .github/workflows/sonarcloud.yml | 2 ++ packaging/nightly-tests.py | 23 +++++++++++++++++++++++ sonar-project.properties | 4 ++++ 3 files changed, 29 insertions(+) create mode 100644 packaging/nightly-tests.py diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index f84ad336b5..c9535b1706 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -23,4 +23,6 @@ jobs: fonts-ref: cc9269cd8d8258785dac603fba3122e5d2556795 # The coverage build's ~1.3 GB cache would not fit the repository's 10 GB cache budget. build-cache: false + python-coverage-source: packaging + python-coverage-script: packaging/nightly-tests.py secrets: inherit diff --git a/packaging/nightly-tests.py b/packaging/nightly-tests.py new file mode 100644 index 0000000000..5d410795af --- /dev/null +++ b/packaging/nightly-tests.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python3 +"""Run the existing synthetic packaging suites together; no app build or signing.""" +import importlib.util +from pathlib import Path +import unittest + + +def main() -> int: + here = Path(__file__).resolve().parent + suite = unittest.TestSuite() + for name, relative in ( + ("photo_archive_suite", "nightly-archive-tests.py"), + ("photo_plist_suite", "macos/nightly_plist_tests.py"), + ): + spec = importlib.util.spec_from_file_location(name, here / relative) + module = importlib.util.module_from_spec(spec) + spec.loader.exec_module(module) + suite.addTests(unittest.defaultTestLoader.loadTestsFromModule(module)) + return 0 if unittest.TextTestRunner(verbosity=2).run(suite).wasSuccessful() else 1 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/sonar-project.properties b/sonar-project.properties index 73d114e6bc..b689deae2b 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -1,2 +1,6 @@ sonar.projectKey=storytold_photocraft sonar.organization=storytold +# These exact fixture runners are tests, not production code. Do not exclude helpers. +sonar.tests=packaging +sonar.test.inclusions=packaging/nightly-tests.py,packaging/nightly-archive-tests.py,packaging/macos/nightly_plist_tests.py,packaging/windows/nightly-package-tests.ps1,packaging/windows/nightly-signing-tests.ps1 +sonar.python.coverage.reportPaths=python-coverage.xml