Repository navigation
170 lines (149 loc) · 7.36 KB
/
Copy pathpc.yml
File metadata and controls
170 lines (149 loc) · 7.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# The native PC port (docs/PC.md): builds PLATFORM=PC with clang 22 and runs
# its tests, the headless smoke runs of darkcloud among them, on Mesa's
# lavapipe software Vulkan driver. Every library comes from Ubuntu's packages.
# No game data is needed: the smoke tests build their own fixtures.
#
# The Windows job (docs/WINDOWS.md) builds with tools/windows' scripts and runs
# the cases that need no Vulkan device. The Flatpak job (docs/FLATPAK.md)
# packages the Linux build in Flathub's freedesktop 26.08 image. Its manifest
# uses the commit under test as a git source, and its smoke run checks that the
# packaged binary reaches its data check. macOS and the Switch have their own
# workflows (macos.yml, switch.yml).
name: PC builds
on:
push:
branches: [master]
pull_request:
workflow_dispatch:
permissions:
contents: read
jobs:
build:
name: Build and test (Linux x64)
runs-on: ubuntu-26.04
steps:
- uses: actions/checkout@v7
with:
submodules: true
# The Flatpak configures without network, so its manifest has to stage every file Kazarov's CMake
# downloads; this fails on the pull request that pins a Kazarov with one the manifest lacks.
- name: Check the Flatpak stages Kazarov's downloads
run: python3 scripts/port/flatpak_sources.py
- name: Check the vanilla item IDs follow port/include/game/itemdata.hpp
run: python3 scripts/port/item_ids.py --check
- name: Install the toolchain and libraries
run: |
sudo sed -i 's#http://azure.archive.ubuntu.com/ubuntu#https://archive.ubuntu.com/ubuntu#g' /etc/apt/apt-mirrors.txt
sudo apt-get update
sudo apt-get install -y clang-22 lld-22 llvm-22 libclang1-22 python3-clang-22 cmake ninja-build glslang-tools \
mesa-vulkan-drivers vulkan-validationlayers libsdl3-dev libvulkan-dev libgtest-dev nlohmann-json3-dev
# ld.lld and llvm-readobj under their plain names.
echo "/usr/lib/llvm-22/bin" >> "$GITHUB_PATH"
# dcdata links Kazarov's Rust bridge; FFmpeg uses Kazarov's pinned build configuration and cxxbridge-cmd is a
# prebuilt release asset.
rustup toolchain install 1.99.0 --profile minimal
rustup default 1.99.0
tools/ci/prebuilt-deps.sh linux-x64
# lavapipe takes seconds to start each renderer, and some of Kazarov's GfxGpu cases start several.
- name: Configure
run: |
cmake -S . -B port/build/pc -G Ninja -DPLATFORM=PC -DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_CXX_COMPILER=clang++-22 -DDC_TEST_TIMEOUT=60 -DDC_GPU_TEST_TIMEOUT=300
- name: Build
run: cmake --build port/build/pc
# darkcloud is PIE and its arenas lie above 4 GiB (a debug build checks), so a pointer the game
# truncates to 32 bits faults here. The real-data cases skip without DC_DATA. lavapipe filters alpha
# across a texel edge differently from the GPUs GEqualFiltersAroundQuantizedReferences was written
# against, and its depth bounds test disagrees with the opt-in KZ_DEPTH_PLANES one-pass path.
- name: Test
working-directory: port/build/pc
run: |
llvm-readobj --file-headers darkcloud | grep -q 'Type: SharedObject'
env -u DC_DATA ctest --output-on-failure -j4 \
-E 'GEqualFiltersAroundQuantizedReferences|^GfxGpuDepthCopy[.]DepthPlanesOnACopiedDepthMatchPlaneByPlane$'
- name: Audit pointer truncations
run: /usr/bin/python3 scripts/port/truncations.py --build port/build/pc --check
windows:
name: Build and test (Windows x64)
runs-on: windows-2025
defaults:
run:
shell: pwsh
steps:
- uses: actions/checkout@v7
with:
submodules: true
# The runner has no GPU and may have no Vulkan loader; the tests need the loader to start.
- name: Install the toolchain and libraries
run: |
./tools/windows/acquire.ps1 -Root $env:RUNNER_TEMP -VulkanLoader
"VULKAN_RUNTIME=$env:RUNNER_TEMP/deps/vulkan-runtime/VulkanRT-X64-1.4.363.0-Components/x64" >> $env:GITHUB_ENV
- name: Configure
run: |
./tools/windows/configure.ps1 -Root $env:RUNNER_TEMP -BuildDirectory $env:GITHUB_WORKSPACE/port/build/windows -Tests `
-VulkanLibrary $env:VULKAN_RUNTIME/vulkan-1.dll
# Beside the executables, the downloaded loader is found before any in System32.
- name: Build
run: |
./tools/windows/build.ps1 -Root $env:RUNNER_TEMP -BuildDirectory $env:GITHUB_WORKSPACE/port/build/windows -Tests
if ($LASTEXITCODE) { exit $LASTEXITCODE }
Copy-Item $env:VULKAN_RUNTIME/vulkan-1.dll port/build/windows
# The renderer's cases run on Linux and macOS: this runner has a Vulkan loader but no driver, so the cases that
# need a device, labeled gpu (port/src/tests/CMakeLists.txt), cannot start here.
- name: Test
run: ctest --test-dir port/build/windows --output-on-failure -j4 -LE gpu
- name: Package the Windows build
run: |
$files = @('darkcloud.exe', 'dcdata.exe', 'libc++.dll', 'libunwind.dll', 'libwinpthread-1.dll', 'SDL3.dll', 'vulkan-1.dll', 'lang', 'glyphs')
$files += Get-ChildItem 'port/build/windows' -Filter '*.dll' | Where-Object Name -Match '^(avcodec|avformat|avutil|swresample|swscale)-' | ForEach-Object Name
$paths = $files | ForEach-Object { Join-Path 'port/build/windows' $_ }
Compress-Archive -LiteralPath $paths -DestinationPath chronicle-windows-x64.zip
- name: Upload the Windows build
uses: actions/upload-artifact@v7
with:
name: chronicle-windows-x64
path: chronicle-windows-x64.zip
if-no-files-found: error
flatpak:
name: Build the Flatpak (Linux x86_64)
runs-on: ubuntu-26.04
container:
image: ghcr.io/flathub-infra/flatpak-github-actions:freedesktop-26.08
options: --privileged
env:
MANIFEST: port/flatpak/ci.yml
steps:
- uses: actions/checkout@v7
with:
submodules: true
- name: Point the manifest at this commit
run: |
# flatpak-builder clones the workspace, which belongs to another user in the container.
git config --global --add safe.directory "$GITHUB_WORKSPACE"
awk -v commit="$GITHUB_SHA" '
/# chronicle-source:/ {
print
print " - type: git"
print " path: ../.."
print " commit: " commit
skip = 1
next
}
/# chronicle-source-end/ { skip = 0 }
!skip { print }
' port/flatpak/org.themoonpeople.Chronicle.yml > "$MANIFEST"
sed -n '/name: chronicle$/,$p' "$MANIFEST"
- uses: flatpak/flatpak-github-actions/flatpak-builder@v6
with:
manifest-path: ${{ env.MANIFEST }}
bundle: chronicle.flatpak
artifact-name: chronicle-x86_64.flatpak
cache-key: flatpak-builder-${{ hashFiles('port/flatpak/org.themoonpeople.Chronicle.yml') }}
- name: Start darkcloud without data
run: |
set +e
flatpak build --env=XDG_DATA_HOME=/tmp/xdg flatpak_app darkcloud --headless --frames 1 > run.txt 2>&1
status=$?
cat run.txt
echo "darkcloud exited $status"
[ "$status" -eq 3 ] && grep -q 'no game data: /tmp/xdg/chronicle/data' run.txt