Repository navigation
207 lines (166 loc) · 7.43 KB
/
Copy pathbuild.yml
File metadata and controls
207 lines (166 loc) · 7.43 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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
name: Build
on:
push:
branches: [ main ]
workflow_dispatch:
workflow_call:
permissions:
contents: read
jobs:
build:
name: Build (ninja, Release, x86)
runs-on: windows-2022
env:
VCPKG_DEFAULT_BINARY_CACHE: ${{ github.workspace }}/vcpkg_bincache
steps:
- name: Checkout (with submodules)
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
lfs: true
- name: Cache vcpkg packages
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/vcpkg_bincache
key: vcpkg-${{ runner.os }}-${{ hashFiles('vcpkg.json', 'custom-vcpkg-ports/**') }}
restore-keys: vcpkg-${{ runner.os }}-
- name: Create vcpkg binary cache directory
shell: pwsh
run: New-Item -ItemType Directory -Force -Path "${{ github.workspace }}/vcpkg_bincache" | Out-Null
- name: Bootstrap vcpkg
run: .\vcpkg\bootstrap-vcpkg.bat -disableMetrics
- name: Set up MSVC x86
uses: ilammy/msvc-dev-cmd@v1
with:
arch: amd64_x86
vsversion: '2022'
- name: Request the CMake file API codemodel
shell: pwsh
run: New-Item -ItemType File -Force -Path "build/ninja/.cmake/api/v1/query/codemodel-v2" | Out-Null
- name: Configure
run: cmake --preset ninja "-DNEXTCLIENT_INSTALL_DIR=${{ github.workspace }}\install"
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Test goldsrc_abi tools
run: python -m unittest discover -s nextclient/goldsrc_abi/tools -t nextclient/goldsrc_abi/tools -p "test_*.py"
- name: Build
run: cmake --build --preset ninja-release --target BUILD_ALL --parallel
# After the build: the gate resolves the includes of every compiled source, and the cmrc
# sources of client_mini_rc and gui_app_core_rc are copied into place by a build rule.
- name: Provenance gate
run: python nextclient/goldsrc_abi/tools/provenance.py --build-dir build/ninja --config Release --allowlist .github/provenance-allowlist.json --report build/provenance-report.json
- name: Upload provenance report
if: always()
uses: actions/upload-artifact@v4
with:
name: provenance-report-${{ github.sha }}
path: build/provenance-report.json
if-no-files-found: ignore
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: NextClient-${{ github.sha }}
path: install/
if-no-files-found: error
- name: Upload PDBs
uses: actions/upload-artifact@v4
with:
name: NextClient-pdb-${{ github.sha }}
path: out/pdb/Release/*.pdb
if-no-files-found: error
# after the uploads: a test build writes its PDBs into out/pdb as well
- name: Configure tests
run: cmake --preset ninja -B build/ninja-tests -DNEXTCLIENT_BUILD_TESTS=ON
- name: Build tests
run: cmake --build build/ninja-tests --config Release --parallel
- name: Set up Mesa software OpenGL
shell: pwsh
run: |
$mesa_version = '26.2.4'
$archive_name = "mesa3d-$mesa_version-release-msvc.7z"
$mesa_archive = Join-Path $env:RUNNER_TEMP $archive_name
$mesa_dir = Join-Path $env:RUNNER_TEMP "mesa3d-$mesa_version"
$download_url = "https://github.com/pal1000/mesa-dist-win/releases/download/$mesa_version/$archive_name"
$expected_hash = '351fc8c8b695878ffb3eaa044b3ead08672a48b1a045e3c3e3975811df0f6695'
Invoke-WebRequest -Uri $download_url -OutFile $mesa_archive
$archive_hash = (Get-FileHash -LiteralPath $mesa_archive -Algorithm SHA256).Hash
if ($archive_hash -ne $expected_hash) {
throw 'Mesa archive SHA-256 mismatch.'
}
7z x $mesa_archive "-o$mesa_dir" 'x86/opengl32.dll' 'x86/libgallium_wgl.dll' -y
if ($LASTEXITCODE -ne 0) {
throw "Cannot extract Mesa archive (exit code $LASTEXITCODE)."
}
$mesa_dlls = @(
(Join-Path $mesa_dir 'x86/opengl32.dll')
(Join-Path $mesa_dir 'x86/libgallium_wgl.dll')
)
Copy-Item -LiteralPath $mesa_dlls -Destination 'build/ninja-tests/out/bin/Release'
- name: Run tests
env:
GALLIUM_DRIVER: llvmpipe
run: ctest --test-dir build/ninja-tests -C Release --output-on-failure
build-linux:
name: Build (linux, Release, x86)
runs-on: ubuntu-24.04
# the code needs GCC 15 (std::vector::append_range), 24.04 only goes up to 14
container: ubuntu:26.04
steps:
# before checkout: without git in the container it downloads a tarball with no submodules.
# GoldSrc is 32-bit only: multilib for -m32, i386 X11 and GL headers for SDL2 and OpenGL
- name: Install system packages
run: |
dpkg --add-architecture i386
apt-get update
apt-get install -y --no-install-recommends \
git git-lfs ca-certificates curl zip unzip tar cmake ninja-build pkg-config python3 \
build-essential gcc-multilib g++-multilib \
libgl-dev:i386 libegl1:i386 libx11-dev:i386 libxext-dev:i386 libxcursor-dev:i386 \
libxi-dev:i386 libxrandr-dev:i386 libxss-dev:i386 libxfixes-dev:i386 libxrender-dev:i386
- name: Checkout (with submodules)
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
lfs: true
# github.workspace is the runner's path, the container sees the repo under another one
- name: Set up vcpkg binary cache
run: |
echo "VCPKG_DEFAULT_BINARY_CACHE=$GITHUB_WORKSPACE/vcpkg_bincache" >> "$GITHUB_ENV"
mkdir -p "$GITHUB_WORKSPACE/vcpkg_bincache"
- name: Cache vcpkg packages
uses: actions/cache@v4
with:
path: vcpkg_bincache
key: vcpkg-linux-ubuntu26.04-${{ hashFiles('vcpkg.json', 'custom-vcpkg-ports/**', 'custom-vcpkg-triplets/**') }}
restore-keys: vcpkg-linux-ubuntu26.04-
- name: Bootstrap vcpkg
run: ./vcpkg/bootstrap-vcpkg.sh -disableMetrics
- name: Check GoldSrc ABI models
run: python3 nextclient/goldsrc_abi/tools/library.py check
- name: Test portable platform tools
run: python3 -m unittest discover -s nextclient/goldsrc_abi/tools -t nextclient/goldsrc_abi/tools -p "test_platforms.py"
- name: Configure
run: cmake --preset linux "-DNEXTCLIENT_INSTALL_DIR=$GITHUB_WORKSPACE/install"
- name: Check Linux x86 ABI layouts
run: cmake --build --preset linux-release --target goldsrc_abi_golden
- name: Build
run: cmake --build --preset linux-release --target BUILD_ALL
# upload-artifact drops the executable bit, nextclient.sh needs it
- name: Pack install directory
run: tar -czf NextClient-linux.tar.gz -C install .
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: NextClient-linux-${{ github.sha }}
path: NextClient-linux.tar.gz
if-no-files-found: error
- name: Configure tests
run: cmake --preset linux -B build/linux-tests -DNEXTCLIENT_BUILD_TESTS=ON
- name: Build tests
run: cmake --build build/linux-tests --config Release
- name: Run tests
run: ctest --test-dir build/linux-tests -C Release --output-on-failure