name: CI on: push: branches: [main] # Docs-only merges already ran all documentation tests on their pull request and are excluded here so they # neither waste runner slots nor coalesce/cancel a pending code push in ci-push-refs/heads/main. paths-ignore: - "README.md" - "CONTRIBUTING.md" - "AGENTS.md" - "docs/**/*.md" pull_request: workflow_dispatch: # One independent default-branch snapshot daily, not a full run for every queued merge. schedule: - cron: "23 3 * * *" permissions: contents: read concurrency: # Coalesce superseded pending pushes per branch without canceling an active main build. # Scheduled/manual runs already use run_id and cannot be replaced by queued pushes. group: ci-${{ github.event_name }}-${{ github.event.pull_request.number || (github.event_name == 'push' && github.ref) || github.run_id }} cancel-in-progress: ${{ github.event_name == 'pull_request' }} env: PYTEST_FILE_MARKERS: '^import pytest|^ *HAVE_NUMPY =' jobs: change-scope: if: github.event_name == 'pull_request' runs-on: ubuntu-latest timeout-minutes: 5 outputs: docs-only: ${{ steps.paths.outputs.docs-only }} steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: fetch-depth: 2 persist-credentials: false - name: Check whether only documentation changed id: paths shell: bash run: | # A pull_request checkout is the test merge; its first parent is the PR base. # Treat missing history, an empty diff, and renames out of code conservatively. docs_only=false base="${GITHUB_SHA}^1" if git rev-parse --verify -q "${base}^{commit}" >/dev/null 2>&1; then diff_rc=0 git diff --quiet "$base" "$GITHUB_SHA" -- || diff_rc=$? if [ "$diff_rc" -eq 1 ]; then code_rc=0 git diff --quiet --no-renames "$base" "$GITHUB_SHA" -- . \ ':(exclude,top)README.md' ':(exclude,top)CONTRIBUTING.md' \ ':(exclude,top)AGENTS.md' ':(exclude,top,glob)docs/**/*.md' || code_rc=$? if [ "$code_rc" -eq 0 ]; then docs_only=true fi fi fi echo "docs-only=$docs_only" >> "$GITHUB_OUTPUT" # A docs-only diff still needs the tests that read those documents, because `check` is skipped for it: every # tests/test_docs_*.py (links, the design.md contract rows, list items, the repository paths a document # names) and the i18n index, which checks docs/i18n/README.md. All are standard library only and read only # tracked files. Other test files read a document too: the design.md row check, the exe checklist's notes in # docs/*.md, and the clone address the README gives (make_game.py's hint, the dashboard's --github default); # those run here, the last three as the single cases that read it. tests/test_ci_registration.py fails when a # tests/test_docs_*.py, or another test that reads a document, is not run here. - name: Check documentation when only documentation changed if: steps.paths.outputs.docs-only == 'true' run: | for t in tests/test_docs_*.py tests/test_i18n_index.py tests/test_design_contract_rows.py; do echo "== $t" python3 -I "$t" || exit 1 done echo "== document cases of other test files" python3 -I tests/test_exe_checklist.py ExeChecklist.test_this_repository || exit 1 python3 -I tests/test_make_game_preflight.py \ PreflightPrerequisiteTest.test_ensure_submodule_names_the_clone_command_the_readme_gives || exit 1 python3 -I tests/test_progress_dashboard.py Github.test_default_repo_is_the_one_the_readme_clones || exit 1 check: needs: change-scope if: ${{ !cancelled() && needs.change-scope.outputs.docs-only != 'true' }} runs-on: windows-latest # The standard-library loop takes about 20 minutes on this runner (486 files in 20 min 15 s, the whole job # 21 min 20 s, on 24 November 2026). At 15 the job was cancelled on every run and reported nothing. timeout-minutes: 30 steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false submodules: recursive - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 with: python-version: "3.12" - uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0 with: dotnet-version: "8.0.x" cache: true cache-dependency-path: "**/packages.lock.json" - name: Python tools compile run: python -m compileall -q make_game.py tools tests - name: make_game.py help run: python -I make_game.py --help - name: Tests (standard library only, no game data) shell: bash run: | # Keep the pytest selection predicate, but run the selected files four at a time. # The runner reports every failure instead of stopping at the first one. while IFS= read -r t; do if grep -Eq "$PYTEST_FILE_MARKERS" "$t" || ! grep -q '__main__' "$t"; then continue fi printf '%s\n' "$t" done < <(find tests -path 'tests/semantic' -prune -o -type f -name 'test_*.py' -print | LC_ALL=C sort) | python -I scripts/run_standalone_tests.py -j 4 - name: Build rpf9dump run: dotnet build tools/rpf9dump/rpf9dump.csproj -c Release - name: Test TTPF export retry env: RPF9DUMP_DLL: tools/rpf9dump/bin/Release/net8.0/rpf9dump.dll run: python -I tests/test_ttpf_export_resume.py # The standard-library loop above runs this file before rpf9dump is built, where it skips for lack of the DLL. - name: Test rpf9dump exit codes env: RPF9DUMP_DLL: tools/rpf9dump/bin/Release/net8.0/rpf9dump.dll run: python -I tests/test_rpf9dump_exit_codes.py - name: Build the calibrated BCPack reader and test the texture pipeline env: RPF9DUMP_DLL: tools/rpf9dump/bin/Release/net8.0/rpf9dump.dll shell: bash run: | python -m pip install -c tests/requirements.txt numpy CARGO_HOME="$(mktemp -d)" cargo build --release --locked --offline --manifest-path tools/bcpack_calibration/Cargo.toml python -I -c "import sys; sys.path.insert(0, 'tools'); import calibrated_texture; calibrated_texture.native()" python -I tests/test_calibrated_texture.py python -I tests/test_ttpf_assets.py - name: Test rpf9dump diagnostics run: dotnet run --project tests/Rpf9DumpDiagnostics/Rpf9DumpDiagnostics.csproj -c Release # Consolidated Linux job: viewer streaming tests, pytest translator/numpy tests, and the Linux standard-library # test loop (with SPIRV-Tools, LLVM 21, and numpy installed so spirv-val checks, numpy paths, and POSIX-only # tests that skip on Windows run here). linux-python-and-viewer: needs: change-scope if: ${{ !cancelled() && needs.change-scope.outputs.docs-only != 'true' }} runs-on: ubuntu-24.04 timeout-minutes: 15 steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 with: python-version: "3.12" cache: "pip" cache-dependency-path: tests/requirements.txt - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 with: node-version: "24" - name: Viewer chunk streaming (synthetic, no browser or game data) run: node --test tests/test_*.cjs - name: Install llvm-mc (LLVM 21), SPIRV-Tools and Python test dependencies shell: bash run: | # The signing key is checked against apt.llvm.org's published fingerprint before apt trusts it. key=$(mktemp) curl -fsSL -o "$key" https://apt.llvm.org/llvm-snapshot.gpg.key python3 -I scripts/check_apt_key.py "$key" 6084F3CF814B57C1CF12EFD515CF4D18AF4F7421 sudo gpg --dearmor -o /usr/share/keyrings/llvm-snapshot.gpg "$key" echo "deb [signed-by=/usr/share/keyrings/llvm-snapshot.gpg] https://apt.llvm.org/noble/ llvm-toolchain-noble-21 main" | sudo tee /etc/apt/sources.list.d/llvm-21.list > /dev/null sudo apt-get update sudo apt-get install -y --no-install-recommends llvm-21 spirv-tools pip install -r tests/requirements.txt LLVM_MC=/usr/lib/llvm-21/bin/llvm-mc echo "LLVM_MC=$LLVM_MC" >> "$GITHUB_ENV" version_out=$("$LLVM_MC" --version) printf '%s\n' "$version_out" grep -q 'LLVM version 21\.' <<< "$version_out" grep -q 'amdgcn' <<< "$version_out" - name: Translator tests shell: bash run: | pytest_files=() while IFS= read -r t; do if grep -Eq "$PYTEST_FILE_MARKERS" "$t" || ! grep -q '__main__' "$t"; then pytest_files+=("$t") elif [[ "$t" == tests/test_tex_headers.py ]]; then pytest_files+=("$t::TestTextureDescriptorParsing::test_stdlib_qword_scanner_edge_cases_and_parity") fi done < <(find tests -path 'tests/semantic' -prune -o -type f -name 'test_*.py' -print | LC_ALL=C sort) python -m pytest "${pytest_files[@]}" -q - name: Tests (standard library only, Linux) shell: bash run: | while IFS= read -r t; do if grep -Eq "$PYTEST_FILE_MARKERS" "$t" || ! grep -q '__main__' "$t"; then continue fi printf '%s\n' "$t" done < <(find tests -path 'tests/semantic' -prune -o -type f -name 'test_*.py' -print | LC_ALL=C sort) | python -I scripts/run_standalone_tests.py -j 4 semantic-tests: needs: change-scope if: ${{ !cancelled() && needs.change-scope.outputs.docs-only != 'true' }} runs-on: ubuntu-latest timeout-minutes: 10 steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 with: python-version: "3.12" # Some semantic tests assemble and validate the translator's output with spirv-as / spirv-val and skip without # them (test_fma_khr, test_bary_fallback, test_image_coherent...). The runner image has neither, so a skip # here reads as a pass. Installing SPIRV-Tools and setting LEONIDA_REQUIRE_SPIRV_TOOLS=1 makes # tests/semantic/test_spirv_tools_required.py fail when they are missing, so those tests cannot go quiet again. - name: Install SPIRV-Tools shell: bash run: | sudo apt-get update sudo apt-get install -y --no-install-recommends spirv-tools spirv-as --version spirv-val --version - name: Translator semantic tests env: LEONIDA_REQUIRE_SPIRV_TOOLS: "1" run: python -I scripts/run_semantic_tests.py tests/semantic -v