-
Notifications
You must be signed in to change notification settings - Fork 126
317 lines (311 loc) · 13 KB
/
ci_build.yml
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
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
name: CI Build
# Perform CI builds for pull requests targeting the dev branches.
on:
pull_request:
branches:
- dev
jobs:
linux:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- {
name: "Ubuntu GCC Release",
os: ubuntu-latest,
artifact: "gfxreconstruct-dev-ubuntu-gcc-release",
test_failure_artifact: "gfxreconstruct-dev-test-failure-ubuntu-gcc-release",
type: "release",
build_dir: "build",
cc: "gcc", cxx: "g++"
}
- {
name: "Ubuntu GCC Debug",
os: ubuntu-latest,
artifact: "gfxreconstruct-dev-ubuntu-gcc-debug",
test_failure_artifact: "gfxreconstruct-dev-test-failure-ubuntu-gcc-debug",
type: "debug",
build_dir: "dbuild",
cc: "gcc", cxx: "g++"
}
steps:
- name: Clone repository
uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Install build dependencies
run: |
sudo apt-get update
sudo apt-get install -y libx11-xcb-dev libxcb-keysyms1-dev libwayland-dev libxrandr-dev liblz4-dev libzstd-dev
- uses: lukka/get-cmake@latest
with:
cmakeVersion: 3.16.3
- name: Run build script
run: |
if [ "${{ matrix.config.type }}" == "release" ]
then
clang-format --version # A check for version 9 should be added.
git fetch origin ${{ github.base_ref }} # Fetch target branch to FETCH_HEAD for code style check.
python3 scripts/build.py --config ${{ matrix.config.type }} --check-code-style-base FETCH_HEAD --parallel 0
python3 framework/generated/generate_vulkan.py # check generated code isn't out of date
git diff --exit-code
else
python3 scripts/build.py --config ${{ matrix.config.type }} --skip-check-code-style --parallel 0
fi
- name: Run test app test cases
id: test_apps
run: |
cd ${{matrix.config.build_dir}}/linux/x64/output/test
sudo useradd test
sudo usermod -a -G docker test
chmod -R g+w .
sudo -n -u test ./run-tests.sh
- name: Upload test failure artifacts
uses: actions/upload-artifact@v4
if: ${{ failure() && steps.test_apps.conclusion == 'failure' }}
with:
name: ${{ matrix.config.test_failure_artifact }}
path: ${{matrix.config.build_dir}}/linux/x64/output/test
- name: Prepare artifacts
run: |
cp LICENSE.txt ${{ matrix.config.build_dir }}/linux/x64/output/bin/
cp LICENSE_ThirdParty.txt ${{ matrix.config.build_dir }}/linux/x64/output/bin/
cp USAGE_desktop_Vulkan.md ${{ matrix.config.build_dir }}/linux/x64/output/bin/
cp layer/vk_layer_settings.txt ${{ matrix.config.build_dir }}/linux/x64/output/bin/
mv ${{ matrix.config.build_dir }}/linux/x64/output/bin gfxreconstruct-dev
mv ${{ matrix.config.build_dir }}/linux/x64/output/lib*/*.so gfxreconstruct-dev/
mv ${{ matrix.config.build_dir }}/linux/x64/output/share/vulkan/explicit_layer.d/*.json gfxreconstruct-dev/
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.config.artifact }}
path: ./gfxreconstruct-dev
windows:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- {
name: "Windows MSVC Release",
os: windows-latest,
artifact: "gfxreconstruct-dev-windows-msvc-release",
test_failure_artifact: "gfxreconstruct-dev-test-failure-windows-msvc-release",
type: "release",
build_dir: "build",
cc: "cl", cxx: "cl"
}
- {
name: "Windows MSVC Debug",
os: windows-latest,
artifact: "gfxreconstruct-dev-windows-msvc-debug",
test_failure_artifact: "gfxreconstruct-dev-test-failure-windows-msvc-debug",
type: "debug",
build_dir: "dbuild",
cc: "cl", cxx: "cl"
}
steps:
- name: Require Python 3.10
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install Ply Python Module
run: pip install ply
- name: Run with VsDevCmd
uses: ilammy/msvc-dev-cmd@v1
- name: Install SDK 20348
uses: GuillaumeFalourd/setup-windows10-sdk-action@v2
with:
sdk-version: 20348
- name: Set WindowsSDKVersion
run:
echo ("WindowsSDKVersion=10.0.20348.0\") >> $env:GITHUB_ENV
- name: Clone repository from merge of PR branch and dev branch
uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Check generated code
run: |
python3 framework/generated/generate_dx12.py # check generated code isn't out of date
git diff --exit-code
- name: Run build script
run: |
python scripts\build.py --skip-check-code-style --config ${{ matrix.config.type }} --parallel 0
- name: Run test app test cases
id: test_apps
run: |
curl.exe -o vulkan-sdk.zip https://sdk.lunarg.com/sdk/download/1.3.296.0/windows/VulkanRT-1.3.296.0-Components.zip
Expand-Archive vulkan-sdk.zip -DestinationPath $pwd\vulkan-sdk
$env:Path += ";$pwd\vulkan-sdk\VulkanRT-1.3.296.0-Components\x64"
cd ${{matrix.config.build_dir}}\windows\x64\output\test
./run-tests.ps1
- name: Upload test failure artifacts
uses: actions/upload-artifact@v4
if: ${{ failure() && steps.test_apps.conclusion == 'failure' }}
with:
name: ${{ matrix.config.test_failure_artifact }}
path: ${{matrix.config.build_dir}}\windows\x64\output\test
- name: Prepare artifacts
run: |
copy LICENSE.txt ${{ matrix.config.build_dir }}\windows\x64\output\bin\
copy LICENSE_ThirdParty.txt ${{ matrix.config.build_dir }}\windows\x64\output\bin\
copy USAGE_desktop_D3D12.md ${{ matrix.config.build_dir }}\windows\x64\output\bin\
copy USAGE_desktop_Vulkan.md ${{ matrix.config.build_dir }}\windows\x64\output\bin\
copy layer\vk_layer_settings.txt ${{ matrix.config.build_dir }}\windows\x64\output\bin\
move ${{ matrix.config.build_dir }}\windows\x64\output\bin gfxreconstruct-dev
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.config.artifact }}
path: .\gfxreconstruct-dev
macOS:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- {
name: "macOS Release",
os: macos-latest,
artifact: "gfxreconstruct-dev-macOS-release",
test_failure_artifact: "gfxreconstruct-dev-test-failure-macOS-release",
type: "release",
build_dir: "build"
}
- {
name: "macOS Debug",
os: macos-latest,
artifact: "gfxreconstruct-dev-macOS-debug",
test_failure_artifact: "gfxreconstruct-dev-test-failure-macOS-debug",
type: "debug",
build_dir: "dbuild"
}
steps:
- name: Clone repository
uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Cache dependencies
id: cache-deps
uses: actions/cache@v3
with:
path: ~/deps
key: ${{ matrix.config.os }} deps ${{ hashFiles('.github/workflows/scripts/build-dependencies-macos.sh') }}
- name: Build dependencies
if: steps.cache-deps.outputs.cache-hit != 'true'
run: .github/workflows/scripts/build-dependencies-macos.sh
- name: Run build script
run: |
python3 scripts/build.py --skip-check-code-style --config ${{ matrix.config.type }} --cmake-extra "CMAKE_PREFIX_PATH=$HOME/deps" --cmake-extra CMAKE_OSX_DEPLOYMENT_TARGET=11.0 --parallel 0
- name: Run test app test cases
id: test_apps
run: |
WORKING_PATH="$(pwd)/${{matrix.config.build_dir}}/darwin/universal/output/test"
cd $WORKING_PATH
curl https://sdk.lunarg.com/sdk/download/1.4.304.0/mac/vulkansdk-macos-1.4.304.0.zip -o ./vulkan-sdk.zip
unzip ./vulkan-sdk.zip -d ./vulkan-sdk
sudo ./vulkan-sdk/InstallVulkan.app/Contents/MacOS/InstallVulkan --root $(pwd)/VulkanSDK/1.3.304.0 --accept-licenses --default-answer --confirm-command install
DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$(pwd)/VulkanSDK/1.3.304.0/macOS/lib
sudo dscl . -create /Users/test
sudo dscl . append /Groups/staff GroupMembership test
sudo dscl . -create /Users/test UserShell /bin/bash
sudo dscl . -create /Users/test RealName "Test"
sudo dscl . -create /Users/test UniqueID "1001"
sudo dscl . -create /Users/test PrimaryGroupID 80
sudo dscl . -create /Users/test NFSHomeDirectory /Users/test
sudo mkdir -p /Users/test
sudo chown -R test:staff /Users/test
sudo chmod -R g+w .
sudo su - test -c "./run-tests_macos.sh"
- name: Upload test failure artifacts
uses: actions/upload-artifact@v4
if: ${{ failure() && steps.test_apps.conclusion == 'failure' }}
with:
name: ${{ matrix.config.test_failure_artifact }}
path: ${{matrix.config.build_dir}}/darwin/universal/output/test
- name: Prepare artifacts
run: |
cp LICENSE.txt ${{ matrix.config.build_dir }}/darwin/universal/output/bin/
cp LICENSE_ThirdParty.txt ${{ matrix.config.build_dir }}/darwin/universal/output/bin/
cp USAGE_desktop_Vulkan.md ${{ matrix.config.build_dir }}/darwin/universal/output/bin/
cp layer/vk_layer_settings.txt ${{ matrix.config.build_dir }}/darwin/universal/output/bin/
mv ${{ matrix.config.build_dir }}/darwin/universal/output/bin gfxreconstruct-dev
mv ${{ matrix.config.build_dir }}/darwin/universal/output/lib*/*.dylib gfxreconstruct-dev/
mv ${{ matrix.config.build_dir }}/darwin/universal/output/share/vulkan/explicit_layer.d/*.json gfxreconstruct-dev/
# GitHub's artifact uploader doesn't preserve permissions, so zip everything ourselves
# This will result in a zip in a zip, but Finder's unzip will conveniently unzip both at once, so it's not too bad
cd gfxreconstruct-dev
zip -r9 "../${{ matrix.config.artifact }}.zip" *
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.config.artifact }}
path: ${{ matrix.config.artifact }}.zip
android:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- {
name: "Android Debug",
os: ubuntu-latest,
type: "debug",
artifact: "gfxreconstruct-dev-android-debug",
test_failure_artifact: "gfxreconstruct-dev-test-failure-android-debug"
}
- {
name: "Android Release",
os: ubuntu-latest,
type: "release",
artifact: "gfxreconstruct-dev-android-release",
test_failure_artifact: "gfxreconstruct-dev-test-failure-android-release"
}
steps:
- name: Clone repository
uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Update submodules
run: |
git submodule update --init
- name: Set up Java
uses: "actions/setup-java@v4"
with:
java-version: 17
distribution: "temurin"
- name: Gradle build
run: |
cd android
if [ "${{ matrix.config.type }}" == "release" ]
then
sh gradlew assembleRelease -Parm64-v8a
else
sh gradlew assembleDebug -Parm64-v8a
fi
- name: Prepare artifacts
run: |
mkdir gfxreconstruct-dev
mkdir gfxreconstruct-dev/layer
mkdir gfxreconstruct-dev/tools
cp LICENSE.txt gfxreconstruct-dev/
cp LICENSE_ThirdParty.txt gfxreconstruct-dev/
cp USAGE_android.md gfxreconstruct-dev/
cp layer/vk_layer_settings.txt gfxreconstruct-dev/
if [ "${{ matrix.config.type }}" == "release" ]
then
cp -r android/layer/build/intermediates/cxx/RelWithDebInfo/*/obj/arm64-v8a gfxreconstruct-dev/layer/
else
cp android/tools/replay/build/outputs/apk/debug/replay-debug.apk gfxreconstruct-dev/tools/
fi
cp android/scripts/gfxrecon.py gfxreconstruct-dev/tools/
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.config.artifact }}
path: ./gfxreconstruct-dev