-
Notifications
You must be signed in to change notification settings - Fork 13
242 lines (226 loc) · 8.36 KB
/
continuous-integration.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
name: Continuous Integration
on:
push:
branches: ["*"]
tags-ignore: ["*"]
pull_request:
branches: ["*"]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
Cmake:
name: ${{ matrix.config.display_name }}
runs-on: ${{ matrix.config.runner }}
strategy:
fail-fast: false
matrix:
config:
-
display_name: "Windows | x86 | GCC"
runner: "windows-2022"
shell: "msys2 {0}"
msys_msystem: "MINGW32"
msys_prefix: "i686"
compiler_name: "gcc"
cmake_gen: "Ninja"
build_suffix: "x86-gcc"
-
display_name: "Windows | x64 | GCC"
runner: "windows-2022"
shell: "msys2 {0}"
msys_msystem: "UCRT64"
msys_prefix: "ucrt-x86_64"
compiler_name: "gcc"
cmake_gen: "Ninja"
build_suffix: "x64-gcc"
-
display_name: "Windows | x86 | GCC - msvcrt"
runner: "windows-2022"
shell: "msys2 {0}"
msys_msystem: "MINGW32"
msys_prefix: "i686"
compiler_name: "gcc"
cmake_gen: "Ninja"
cmake_opts: "-D RD_UCRT32=OFF"
build_suffix: "x86-gcc-msvcrt"
# -
# display_name: "Windows | x64 | GCC - msvcrt"
# runner: "windows-2022"
# shell: "msys2 {0}"
# msys_msystem: "MINGW64"
# msys_prefix: "x86_64"
# compiler_name: "gcc"
# cmake_gen: "Ninja"
# build_suffix: "x64-gcc-msvcrt"
# -
# display_name: "Windows | x86 | Clang"
# runner: "windows-2022"
# shell: "msys2 {0}"
# msys_msystem: "CLANG32"
# msys_prefix: "clang-i686"
# compiler_name: "clang"
# cmake_gen: "Ninja"
# build_suffix: "x86-clang"
-
display_name: "Windows | x64 | Clang"
runner: "windows-2022"
shell: "msys2 {0}"
msys_msystem: "CLANG64"
msys_prefix: "clang-x86_64"
compiler_name: "clang"
cmake_gen: "Ninja"
build_suffix: "x64-clang"
# -
# display_name: "Windows | x86 | MSVC"
# runner: "windows-2019" # windows-2022
# shell: "bash"
# msvc_triplet: "x86-windows"
# compiler_name: "cl"
# cmake_gen: "Visual Studio 16 2019" # Visual Studio 17 2022
# cmake_opts: "-T v141_xp -A Win32"
# build_suffix: "x86-msvc"
-
display_name: "Windows | x64 | MSVC"
runner: "windows-2022"
shell: "bash"
msvc_triplet: "x64-windows"
compiler_name: "cl"
cmake_gen: "Visual Studio 17 2022"
cmake_opts: "-A x64"
build_suffix: "x64-msvc"
-
display_name: "Linux | x64 | GCC"
runner: "ubuntu-22.04"
shell: "bash"
compiler_name: "gcc"
cmake_gen: "Ninja"
cmake_opts: "-D RD_BUILD_PORTABLE=ON"
# -
# display_name: "Linux | x64 | Clang"
# runner: "ubuntu-22.04"
# shell: "bash"
# compiler_name: "clang"
# cmake_gen: "Ninja"
# cmake_opts: "-D RD_BUILD_PORTABLE=ON"
defaults:
run:
shell: ${{ matrix.config.shell }}
env:
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
steps:
- name: Setup MSYS env
if: |
runner.os == 'Windows' &&
matrix.config.compiler_name != 'cl'
timeout-minutes: 10
uses: msys2/setup-msys2@v2
with:
msystem: ${{ matrix.config.msys_msystem }}
update: true
install: >-
mingw-w64-${{ matrix.config.msys_prefix }}-pkgconf
mingw-w64-${{ matrix.config.msys_prefix }}-${{ matrix.config.compiler_name }}
mingw-w64-${{ matrix.config.msys_prefix }}-gdb
mingw-w64-${{ matrix.config.msys_prefix }}-ninja
mingw-w64-${{ matrix.config.msys_prefix }}-cmake
mingw-w64-${{ matrix.config.msys_prefix }}-SDL2
mingw-w64-${{ matrix.config.msys_prefix }}-SDL2_net
mingw-w64-${{ matrix.config.msys_prefix }}-SDL2_mixer
mingw-w64-${{ matrix.config.msys_prefix }}-libsamplerate
git
- name: Install MSVC XP toolset
if: |
runner.name == 'windows-2022' &&
runner.arch == 'X86' &&
matrix.config.compiler_name == 'cl'
run: |
echo "Installing Microsoft.VisualStudio.Component.WinXP"
"C:\Program Files (x86)\Microsoft Visual Studio\Installer\vs_installer" modify \
--installPath "C:\Program Files\Microsoft Visual Studio\2022\Enterprise" \
--add Microsoft.VisualStudio.Component.WinXP \
--nocache --norestart --quiet
echo "Installation of Microsoft.VisualStudio.Component.WinXP finished"
- name: Get GitHub Action Cache url and token
if: |
runner.os == 'Windows' &&
matrix.config.compiler_name == 'cl'
uses: actions/github-script@v7
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- name: Setup MSVC env
if: |
runner.os == 'Windows' &&
matrix.config.compiler_name == 'cl'
run: |
cd $VCPKG_INSTALLATION_ROOT
./bootstrap-vcpkg.sh -disableMetrics
# For classic mode:
# vcpkg integrate install
# vcpkg install --triplet=${{ matrix.arch.msvc_triplet }} sdl2 sdl2-mixer[libflac,libmodplug,mpg123,opusfile] sdl2-net libsamplerate
- name: Setup Linux env
if: runner.os == 'Linux'
run: |
sudo apt-get update --fix-missing
sudo apt-get full-upgrade --fix-missing
sudo apt-get install ${{ matrix.config.compiler_name }} gdb ninja-build python3 cmake \
libsdl2-dev libsdl2-net-dev libsdl2-mixer-dev libsamplerate-dev
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Configure
id: configure
env:
CC: ${{ matrix.config.compiler_name }}
run: |
if [[ '${{ matrix.config.compiler_name }}' == 'cl' ]]
then
msvc_cmake_toolchain="-D CMAKE_TOOLCHAIN_FILE=$VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake"
fi
rev_number=$(git rev-list --count HEAD)
cmake -G "${{ matrix.config.cmake_gen }}" ${{ matrix.config.cmake_opts }} \
$msvc_cmake_toolchain \
-D RD_BUILD_VERSION_OVERWRITE="r$rev_number" \
-D RD_GIT_FORCE_HASH_SUFFIX=ON \
-D CMAKE_BUILD_TYPE=RelWithDebInfo \
-D RD_TEST_WITH_GDB="ON"\
-S . -B build
sha_short=$(echo ${{ github.sha }} | cut -c1-7)
echo "sha_short=$sha_short" >> $GITHUB_OUTPUT
echo "rev_number=r$rev_number" >> $GITHUB_OUTPUT
- name: Build
run: |
export MAKEFLAGS=--keep-going
cmake --build build --config RelWithDebInfo --parallel 2
- name: Test Windows
if: runner.os == 'Windows'
run: |
cd build
ctest --output-on-failure -C RelWithDebInfo
- name: Test Linux
if: runner.os == 'Linux'
env:
SDL_VIDEODRIVER: dummy
run: |
cd build
ctest --output-on-failure
- name: Install
if: |
github.repository == 'Russian-Doom/russian-doom' &&
github.event_name == 'push' &&
github.ref == 'refs/heads/master' &&
runner.os == 'Windows'
run: |
cmake --install build --config RelWithDebInfo --prefix "./build/install"
- name: Package Zip
if: |
github.repository == 'Russian-Doom/russian-doom' &&
github.event_name == 'push' &&
github.ref == 'refs/heads/master' &&
runner.os == 'Windows'
uses: actions/upload-artifact@v4
with:
name: russian-doom-${{ steps.configure.outputs.rev_number }}-${{ steps.configure.outputs.sha_short }}-windows-${{ matrix.config.build_suffix }}
path: ./build/install/