-
Notifications
You must be signed in to change notification settings - Fork 1
296 lines (259 loc) · 10.9 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
# Cross-platform and multi-configuration build of Methane Asteroids
name: 'CI Build'
on:
workflow_dispatch:
push:
branches: [ main, develop ]
paths:
- '.github/**/*.yml'
- 'Apps/**'
- 'Modules/**'
- 'Externals/**'
- 'CMake/**'
- 'CMakeLists.txt'
- 'CMakePresets.json'
pull_request:
branches: [ main ]
paths:
- '.github/**/*.yml'
- 'Apps/**'
- 'Modules/**'
- 'Externals/**'
- 'CMake/**'
- 'CMakeLists.txt'
- 'CMakePresets.json'
schedule:
- cron: '20 23 * * 3' # Scheduled workflow will not run in GitHub forks by default
env:
product_ver_major: 0
product_ver_minor: 7
product_ver_patch: 3
product_ver_build: ${{ github.run_number }}
tracy_release_version: "0.9.1"
vulkan_sdk_version: "1.3.250.1"
jobs:
build-asteroids:
name: Build ${{ matrix.name }}
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
os_name: Windows
name: "Win64_DX_Release"
config_preset: "VS2022-Win64-DX-Default"
build_preset: "VS2022-Win64-DX-Release"
add_tracy_app: false
install_vulkan_sdk: false
- os: windows-latest
os_name: Windows
name: "Win64_VK_Release"
config_preset: "VS2022-Win64-VK-Default"
build_preset: "VS2022-Win64-VK-Release"
add_tracy_app: false
install_vulkan_sdk: false
- os: windows-latest
os_name: Windows
name: "Win64_DX_Profile"
config_preset: "VS2022-Win64-DX-Profile"
build_preset: "VS2022-Win64-DX-Profile"
add_tracy_app: true
install_vulkan_sdk: false
- os: windows-latest
os_name: Windows
name: "Win64_VK_Profile"
config_preset: "VS2022-Win64-VK-Profile"
build_preset: "VS2022-Win64-VK-Profile"
add_tracy_app: true
install_vulkan_sdk: false
- os: windows-latest
os_name: Windows
name: "Win32_DX_Release"
config_preset: "VS2022-Win32-DX-Default"
build_preset: "VS2022-Win32-DX-Release"
add_tracy_app: false
install_vulkan_sdk: false
- os: windows-latest
os_name: Windows
name: "Win32_VK_Release"
config_preset: "VS2022-Win32-VK-Default"
build_preset: "VS2022-Win32-VK-Release"
add_tracy_app: false
install_vulkan_sdk: false
- os: windows-latest
os_name: Windows
name: "Win32_DX_Profile"
config_preset: "VS2022-Win32-DX-Profile"
build_preset: "VS2022-Win32-DX-Profile"
add_tracy_app: true
install_vulkan_sdk: false
- os: windows-latest
os_name: Windows
name: "Win32_VK_Profile"
config_preset: "VS2022-Win32-VK-Profile"
build_preset: "VS2022-Win32-VK-Profile"
add_tracy_app: true
install_vulkan_sdk: false
- os: ubuntu-latest
os_name: Ubuntu
name: "Ubuntu_VK_Release"
config_preset: "Make-Lin-VK-Release"
build_preset: "Make-Lin-VK-Release"
add_tracy_app: false
install_vulkan_sdk: false
- os: ubuntu-latest
os_name: Ubuntu
name: "Ubuntu_VK_Profile"
config_preset: "Make-Lin-VK-Profile"
build_preset: "Make-Lin-VK-Profile"
add_tracy_app: true
install_vulkan_sdk: false
- os: macos-latest
os_name: MacOS
name: "MacOS_Arm64_VK_Release"
config_preset: "Xcode-Mac-Arm64-VK-Default"
build_preset: "Xcode-Mac-Arm64-VK-Release"
add_tracy_app: false
install_vulkan_sdk: true
- os: macos-latest
os_name: MacOS
name: "MacOS_x86-64_VK_Release"
config_preset: "Xcode-Mac-x86-64-VK-Default"
build_preset: "Xcode-Mac-x86-64-VK-Release"
add_tracy_app: false
install_vulkan_sdk: true
- os: macos-latest
os_name: MacOS
name: "MacOS_Arm64_MTL_Release"
config_preset: "Xcode-Mac-Arm64-MTL-Default"
build_preset: "Xcode-Mac-Arm64-MTL-Release"
add_tracy_app: false
install_vulkan_sdk: false
- os: macos-latest
os_name: MacOS
name: "MacOS_Arm64_MTL_Profile"
config_preset: "Xcode-Mac-Arm64-MTL-Profile"
build_preset: "Xcode-Mac-Arm64-MTL-Profile"
add_tracy_app: true
install_vulkan_sdk: false
- os: macos-latest
os_name: MacOS
name: "MacOS_x86-64_MTL_Release"
config_preset: "Xcode-Mac-x86-64-MTL-Default"
build_preset: "Xcode-Mac-x86-64-MTL-Release"
add_tracy_app: false
install_vulkan_sdk: false
- os: macos-latest
os_name: MacOS
name: "MacOS_x86-64_MTL_Profile"
config_preset: "Xcode-Mac-x86-64-MTL-Profile"
build_preset: "Xcode-Mac-x86-64-MTL-Profile"
add_tracy_app: true
install_vulkan_sdk: false
- os: macos-latest
os_name: MacOS
name: "iOS_Sim_MTL_Release"
config_preset: "Xcode-iOS-Sim-MTL-Default"
build_preset: "Xcode-iOS-Sim-MTL-Release"
add_tracy_app: false
install_vulkan_sdk: false
- os: macos-latest
os_name: MacOS
name: "tvOS_Sim_MTL_Release"
config_preset: "Xcode-tvOS-Sim-MTL-Default"
build_preset: "Xcode-tvOS-Sim-MTL-Release"
add_tracy_app: false
install_vulkan_sdk: false
runs-on: ${{ matrix.os }}
env:
INSTALL_DIR: Build/Output/${{ matrix.config_preset }}/Install
BUILD_LOG_FILE: Build/Output/${{ matrix.config_preset }}/Install/Build.log
steps:
- name: Install Linux prerequisites
if: ${{ matrix.os == 'ubuntu-latest' }}
run: sudo apt install xcb libx11-dev libx11-xcb-dev libxcb-sync-dev libxcb-randr0-dev p7zip
- name: Install Vulkan SDK ${{ env.vulkan_sdk_version }}
if: ${{ matrix.install_vulkan_sdk }}
run: |
runner_os=$(uname -s)
case $runner_os in
macOS|Darwin) sdk_os=mac ; sdk_os_subdir=macOS ;;
Linux) sdk_os=linux ; sdk_os_subdir=linux ;;
Windows|MINGW*) sdk_os=windows ; sdk_os_subdir=windows ;;
*) echo "Unknown runner_os: $runner_os" ; exit 7 ; ;;
esac
sdk_ver="${{ env.vulkan_sdk_version }}"
sdk_dir="${{ runner.tool_cache }}/VulkanSDK"
sdk_ver_dir="$sdk_dir/$sdk_ver/$sdk_os_subdir"
if [ -d "$sdk_ver_dir" ]; then
echo "Vulkan SDK version directory already exists: $sdk_ver_dir"
else
test -d $sdk_dir || mkdir -pv $sdk_dir
vulkan_sdk_url=https://github.com/MethanePowered/VulkanHeaders/releases/download/sdk-$sdk_ver/vulkan_sdk_$sdk_os.7z
echo "Downloading Vulkan SDK archive $vulkan_sdk_url ..."
curl -sSLo vulkan_sdk.7z $vulkan_sdk_url
echo "Unpacking Vulkan SDK archive to $sdk_dir ..."
7z x vulkan_sdk.7z -o$sdk_dir
if [ ! -d $sdk_ver_dir ]; then
echo "Vulkan SDK subdirectory not found: $sdk_ver_dir"
exit 7
fi
fi
echo "Setting VULKAN_SDK* environment variables..."
echo "VULKAN_SDK=$sdk_ver_dir" >> $GITHUB_ENV
echo "VULKAN_SDK_VERSION=$sdk_ver" >> $GITHUB_ENV
echo "VULKAN_SDK_PLATFORM=$sdk_os" >> $GITHUB_ENV
echo "PATH=$PATH:$sdk_ver_dir/bin" >> $GITHUB_ENV
echo "DYLD_LIBRARY_PATH=$sdk_ver_dir/lib:${DYLD_LIBRARY_PATH:-}" >> $GITHUB_ENV
- name: Checkout repository
uses: actions/checkout@v4
- name: Initialize Externals Cache
id: cache-externals
uses: actions/cache@v4
env:
cache-name: cache-externals
with:
path: Build/Output/ExternalsCache
key: ExternalsCache-${{ matrix.config_preset }}-${{ hashFiles('Externals/*.cmake') }}
- name: CMake Configure Preset ${{ matrix.config_preset }}
shell: bash
run: |
set -o pipefail
mkdir -p "$INSTALL_DIR"
cmake --preset ${{ matrix.config_preset }} -DASTEROIDS_VERSION_MAJOR=${{ env.product_ver_major }} -DASTEROIDS_VERSION_MINOR=${{ env.product_ver_minor }} -DASTEROIDS_VERSION_PATCH=${{ env.product_ver_patch }} -DASTEROIDS_VERSION_BUILD=${{ env.product_ver_build }} 2>&1 | tee $BUILD_LOG_FILE
- name: CMake Build Preset ${{ matrix.build_preset }}
shell: bash
run: |
set -o pipefail
cmake --build --preset ${{ matrix.build_preset }} --target install --parallel 4 2>&1 | tee -a $BUILD_LOG_FILE
- name: Add README and BUILD files
shell: bash
run: |
cp README.md $INSTALL_DIR/README.md
echo Methane Asteroids v.${{ env.product_ver_major }}.${{ env.product_ver_minor }}.${{ env.product_ver_patch }}.${{ env.product_ver_build }} https://github.com/${{ github.repository }} > $INSTALL_DIR/Build-Info.txt
echo - Git repository: ${{ github.repositoryUrl }}, branch: ${{ github.ref_name }}, commit SHA: ${{ github.sha }} >> $INSTALL_DIR/Build-Info.txt
echo - GitHub Actions build url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} >> $INSTALL_DIR/Build-Info.txt
echo - Built with CMake configure preset ${{ matrix.config_preset }} and build preset ${{ matrix.build_preset }} >> $INSTALL_DIR/Build-Info.txt
echo - Built on agent ${{ runner.name }}, ${{ runner.os }}, ${{ runner.arch }}: >> $INSTALL_DIR/Build-Info.txt
echo - Builder agent ${{ matrix.os }} system information: >> $INSTALL_DIR/Build-Info.txt
- name: Add Windows System Information to BUILD file
if: ${{ matrix.os_name == 'Windows' }}
run: systeminfo >> ${{ env.INSTALL_DIR }}\Build-Info.txt
- name: Add Unix System Information to BUILD file
if: ${{ matrix.os_name != 'Windows' }}
run: uname -a >>$INSTALL_DIR/Build-Info.txt
- name: Download Tracy release
if: ${{ matrix.add_tracy_app }}
shell: bash
run: |
curl -sSLo Tracy.7z https://github.com/MethanePowered/Tracy/releases/download/v${{ env.tracy_release_version }}/Tracy-${{ matrix.os_name }}-v${{ env.tracy_release_version }}.7z
7z x Tracy.7z -o$INSTALL_DIR/Apps
- name: Archive Build Artifacts
shell: bash
working-directory: ${{ env.INSTALL_DIR }}
run: 7z a -t7z -mx=9 MethaneAsteroids_${{ matrix.name }}.7z -r- ./*.* Apps/*
- name: Upload Archived Build Artifacts
uses: actions/upload-artifact@v4
with:
name: MethaneAsteroids_${{ matrix.name }}_${{ env.product_ver_major }}.${{ env.product_ver_minor }}.${{ env.product_ver_patch }}.${{ env.product_ver_build }}
path: ${{ env.INSTALL_DIR }}/MethaneAsteroids_${{ matrix.name }}.7z