Files
mandy/.github/workflows/runtime.yml

211 lines
8.9 KiB
YAML

# Builds the loader (runtime/) with MSVC and Vulkan headers (plus GPU tools and llvmpipe tests on Linux) on runtime or
# translator changes, so a change that breaks the C++ build or tests shows up in CI.
name: Runtime
on:
push:
branches: [main]
paths-ignore:
- "docs/**"
- "*.md"
- "viewer/**"
- "tests/**"
- "assets/**"
- ".github/ISSUE_TEMPLATE/**"
- ".github/workflows/ci.yml"
- ".github/workflows/jactionlint.yml"
- ".github/workflows/no-game-data.yml"
pull_request:
paths-ignore:
- "docs/**"
- "*.md"
- "viewer/**"
- "tests/**"
- "assets/**"
- ".github/ISSUE_TEMPLATE/**"
- ".github/workflows/ci.yml"
- ".github/workflows/jactionlint.yml"
- ".github/workflows/no-game-data.yml"
workflow_dispatch:
permissions:
contents: read
concurrency:
group: runtime-${{ github.event_name }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
windows:
runs-on: windows-latest
timeout-minutes: 20
env:
SCCACHE_GHA_ENABLED: "true"
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
with:
python-version: "3.12"
- uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0
- uses: mozilla-actions/sccache-action@fc920bf0ec8de6ee65d409111f7ec508035751ba # v0.0.11
- name: Cache Vulkan headers
id: vulkan-headers-cache
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: .vulkan-headers/include
key: vulkan-headers-6802bb4733b63ed5efd3adb308a6c885ef180ea1
- name: Checkout Vulkan headers (vulkan-sdk-1.4.363.0)
if: steps.vulkan-headers-cache.outputs.cache-hit != 'true'
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: KhronosGroup/Vulkan-Headers
ref: 6802bb4733b63ed5efd3adb308a6c885ef180ea1 # vulkan-sdk-1.4.363.0
path: .vulkan-headers
sparse-checkout: include
persist-credentials: false
- name: Configure
env:
VULKAN_SDK: ${{ github.workspace }}/.vulkan-headers
run: >-
cmake -S runtime -B runtime/build -G Ninja
-DCMAKE_BUILD_TYPE=RelWithDebInfo
-DLEONIDA_D3D12_SHIM_TESTS=ON
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache
-DCMAKE_POLICY_DEFAULT_CMP0141=NEW
-DCMAKE_MSVC_DEBUG_INFORMATION_FORMAT=Embedded
- name: Build
run: cmake --build runtime/build
# For the wine job: the test list, the checkout it was made in, and the built executables and DLLs. Only what
# this repository builds goes in; there is no game data on the runner.
- name: List tests for Wine
shell: bash
run: |
ctest --test-dir runtime/build --show-only=json-v1 > runtime/build/ctest.json
cygpath -m "$GITHUB_WORKSPACE" > runtime/build/windows-root.txt
- name: Upload the Windows build for Wine
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: runtime-windows
path: |
runtime/build/**/*.exe
runtime/build/**/*.dll
runtime/build/ctest.json
runtime/build/windows-root.txt
retention-days: 7
if-no-files-found: error
- name: CPU runtime tests
run: ctest --test-dir runtime/build --output-on-failure
# Runs the Windows build's tests under Wine, so a change that breaks the loader on Linux (through Wine or Proton)
# shows up. The required ones are the loader and the stand-in game run end to end; the table in the job summary
# shows the rest. run_tiny_game_exit_code isn't required: under Wine the process now and then exits 0 although
# gta6rt calls ExitProcess(1) (#634, finding).
wine:
needs: windows
runs-on: ubuntu-24.04
timeout-minutes: 20
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: runtime-windows
path: runtime/build
- name: Install Wine, Xvfb and llvmpipe
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends wine wine64 xvfb xauth mesa-vulkan-drivers libvulkan1
wine --version
- name: Create the Wine prefix
env:
WINEPREFIX: ${{ runner.temp }}/wineprefix
WINEDLLOVERRIDES: "mscoree,mshtml="
WINEDEBUG: "-all"
run: |
xvfb-run -a wineboot --init
wineserver -w
- name: Windows tests under Wine
env:
WINEPREFIX: ${{ runner.temp }}/wineprefix
WINEDLLOVERRIDES: "mscoree,mshtml="
WINEDEBUG: "-all"
run: >-
xvfb-run -a python3 -I scripts/run_wine_tests.py
--tests runtime/build/ctest.json
--windows-root "$(cat runtime/build/windows-root.txt)"
--summary "$GITHUB_STEP_SUMMARY"
--require loader --require pe_loader --require loader_tls --require unimplemented_policy
--require run_tiny_game
# Also runs the hand-written GPU tests (runtime/test/shaders) on Mesa's llvmpipe, a software Vulkan driver, so a
# translator or harness change that breaks a test result shows up on every pull request, without a GPU.
linux-gpu-tools:
runs-on: ubuntu-24.04
timeout-minutes: 15
env:
SCCACHE_GHA_ENABLED: "true"
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: mozilla-actions/sccache-action@fc920bf0ec8de6ee65d409111f7ec508035751ba # v0.0.11
- name: Install Vulkan SDK, llvmpipe, llvm-mc and SPIRV-Tools
run: |
pkgs=(libvulkan-dev mesa-vulkan-drivers vulkan-tools spirv-tools)
command -v cmake >/dev/null || pkgs+=(cmake)
command -v ninja >/dev/null || pkgs+=(ninja-build)
command -v g++ >/dev/null || pkgs+=(g++)
[ -x /usr/lib/llvm-18/bin/llvm-mc ] || pkgs+=(llvm-18)
sudo apt-get update
sudo apt-get install -y --no-install-recommends "${pkgs[@]}"
- name: Configure
run: >-
cmake -S runtime -B runtime/build -G Ninja
-DCMAKE_BUILD_TYPE=RelWithDebInfo
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache
- name: Build
run: cmake --build runtime/build --parallel
- name: Check GPU tools exist
run: |
for tool in vk_harness vk_pipeline_check vk_command_replay_test vk_compute_test vk_texture_test vk_store_test vk_bindless_test clear_color_test d3d12_state_map_test command_list_test descriptor_table_test gfx10_descriptors_test; do
if [ ! -f "runtime/build/$tool" ] && [ ! -f "runtime/build/$tool.exe" ]; then
echo "Missing: $tool"
exit 1
fi
done
echo "All GPU tools built"
- name: CPU runtime tests (Linux)
run: ctest --test-dir runtime/build --output-on-failure
- name: GPU tests on llvmpipe
run: |
vulkaninfo --summary | grep -E 'deviceName.*llvmpipe' # fails the step if llvmpipe isn't there
python3 -I scripts/run_gpu_tests.py --build runtime/build --llvm-mc /usr/lib/llvm-18/bin/llvm-mc --work "$RUNNER_TEMP/gpu-native"
- name: Pipeline checker exit status on llvmpipe
shell: bash
run: |
dir=$(mktemp -d "$RUNNER_TEMP/pipeline-check.XXXXXX")
echo '{"ready":{"stage":"vs"},"missing":{"stage":"ps","outputs":[0]}}' > "$dir/index.json"
python3 -I tools/spirv_stubs.py "$dir"
cp "$dir/stubs/vs_empty.spv" "$dir/ready.spv"
check() {
runtime/build/vk_pipeline_check "$dir" "$dir/cache.bin" "$@" | tee "$dir/check.log"
}
status=0
check || status=$?
test "$status" -eq 1
grep -Fx 'MODULE FAIL missing' "$dir/check.log"
grep -Fx 'vs pipelines: 1 ok, 0 failed, 0 skipped' "$dir/check.log"
test -s "$dir/cache.bin"
cp "$dir/stubs/ps_empty.spv" "$dir/missing.spv"
check
grep -Fx 'ps pipelines: 1 ok, 0 failed, 0 skipped' "$dir/check.log"
grep -Fx 'vs pipelines: 1 ok, 0 failed, 0 skipped' "$dir/check.log"
check --max-bytes 1
grep -F 'big modules skipped: 2' "$dir/check.log"
- name: GPU tests on llvmpipe, compute with wave64 emulation
# llvmpipe has 8-wide subgroups, so the wave64 compute tests only run emulated. The emulated mesh tests are
# left out: llvmpipe's LLVM backend aborts compiling them ("Cannot emit physreg copy instruction").
env:
LEONIDA_W64_EMULATE: "1"
run: python3 -I scripts/run_gpu_tests.py --build runtime/build --llvm-mc /usr/lib/llvm-18/bin/llvm-mc --work "$RUNNER_TEMP/gpu-w64" --filter cs_