diff --git a/.github/workflows/editor.yml b/.github/workflows/editor.yml index 9dcf3a4..57dece9 100644 --- a/.github/workflows/editor.yml +++ b/.github/workflows/editor.yml @@ -26,7 +26,7 @@ jobs: fetch-depth: 0 persist-credentials: false - name: Check public sources - run: python3 tools/public_release/check_public_tree.py --root . --history + run: python3 tools/public_release/check_public_tree.py --root . --history --revision HEAD - name: Linux dependencies if: runner.os == 'Linux' run: sudo apt-get update && sudo apt-get install -y ninja-build pkg-config libgtk-3-dev libx11-dev libxext-dev libxrandr-dev libxcursor-dev libxi-dev libxfixes-dev libxss-dev libgl1-mesa-dev xvfb xauth xdotool diff --git a/src/editor/CMakeLists.txt b/src/editor/CMakeLists.txt index 99ce7a2..040e93f 100644 --- a/src/editor/CMakeLists.txt +++ b/src/editor/CMakeLists.txt @@ -78,4 +78,7 @@ install(TARGETS openbmh_editor RUNTIME DESTINATION . COMPONENT Editor) install(DIRECTORY "${editor_assets}/" DESTINATION assets/editor COMPONENT Editor) add_executable(editor_core_tests ../../tests/editor_core_tests.cpp) target_link_libraries(editor_core_tests PRIVATE bmh_editor_core) +if(MSVC) + target_compile_options(editor_core_tests PRIVATE /utf-8) +endif() add_test(NAME editor_core_tests COMMAND editor_core_tests) diff --git a/tools/public_release/check_public_tree.py b/tools/public_release/check_public_tree.py index a6ad244..f6b58e8 100644 --- a/tools/public_release/check_public_tree.py +++ b/tools/public_release/check_public_tree.py @@ -250,11 +250,12 @@ def scan_tree(root: Path): return findings, len(names) -def scan_history(root: Path): +def scan_history(root: Path, revision=None): findings = [] references = subprocess.check_output(["git", "-C", str(root), "for-each-ref", "--format=%(refname)"]) findings.extend(scan_blob("ref-names", references)) - refs = subprocess.check_output(["git", "-C", str(root), "rev-list", "--all"], text=True).splitlines() + selection = [revision] if revision else ["--all"] + refs = subprocess.check_output(["git", "-C", str(root), "rev-list", *selection], text=True).splitlines() seen = set() checked = 0 for revision in refs: @@ -286,15 +287,18 @@ def main(argv=None): parser = argparse.ArgumentParser(description=__doc__) parser.add_argument("--root", type=Path, default=Path.cwd()) parser.add_argument("--history", action="store_true", help="also check all reachable commits and their blobs") + parser.add_argument("--revision", help="with --history, inspect this revision's ancestry instead of unrelated refs") parser.add_argument("--json", type=Path, help="write a report containing rule names and locations only") args = parser.parse_args(argv) + if args.revision and (not args.history or args.revision.startswith('-')): + parser.error("--revision requires --history and a revision, not an option") if args.history and shutil.which("git") is None: parser.error("Git is required for history checks") root = args.root.resolve(strict=True) findings, files = scan_tree(root) commits = blobs = 0 if args.history: - extra, commits, blobs = scan_history(root) + extra, commits, blobs = scan_history(root, args.revision) findings.extend(extra) findings = sorted(set(findings)) def display_path(name):