forked from skyrim-multiplayer/skymp
-
Notifications
You must be signed in to change notification settings - Fork 0
272 lines (240 loc) · 9.91 KB
/
pr-linux-variants.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
# TODO(#2280): rename from PR to something else (also applies to Windows etc)
# TODO(#2280): keep in line with deploy.yml
name: PR Linux
on:
pull_request:
# any
push:
branches:
- main
env:
BUILD_TYPE: RelWithDebInfo
jobs:
pr-docker:
strategy:
matrix:
base_system:
# The usual container used for all builds within the CI and the one
# we use as the base for server builds with preinstalled/cached deps
- ubuntu-vcpkg-deps
# Distros that our contributors are likely to run
- ubuntu-2204
- ubuntu-2404
- ubuntu-2410 # latest non-LTS
- debian-12
- archlinux
# TODO(#2280): add Fedora
# TODO(#2280): test gcc build, test build w/o ninja
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Debug - print env
run: env
- name: Get/build image to use for building & testing
run: |
set -x # print executed commands
echo Some debug data
id
uname -a
lsb_release -a
# cat ${{github.workspace}}/misc/github_env_linux >> "$GITHUB_ENV"
# get base image for this distro (or build configuration, in case with skymp-deps)
base_image="`misc/deps_linux/${{ matrix.base_system }}.sh --get-image-uri`"
docker run \
--name prepare_deps_container \
-v "${{github.workspace}}:/src" \
-w "/src" \
-e "CI=$CI" \
-e "CREATE_UID=`id -u`" \
"$base_image" \
'misc/deps_linux/${{ matrix.base_system }}.sh' '--ensure-deps-noninteractive'
docker commit prepare_deps_container localhost/buildimage
- name: Debug - check build tools
uses: addnab/docker-run-action@v3
with:
image: localhost/buildimage
options: |
-v ${{github.workspace}}:/src
-w /src
-u skymp
run: |
print_info_unsafe() {
echo .
echo .
echo "=== Checking $1 ==="
out="`which $1`"
ret="$?"
if [ "$ret" != 0 -o -z "$out" ]; then
echo "Which exited with $ret $out"
return
fi
ls -lh "$out"
echo "version call:"
"$out" --version
}
print_info() {
print_info_unsafe "$@" || true
}
print_info clang++
print_info clang++-15
print_info cmake
print_info ninja
print_info node
print_info yarn
print_info git
print_info zip
print_info unzip
print_info curl
echo .
echo .
echo === misc ===
echo "current dir is $PWD"
echo /src:
ls -lh /src
echo .
echo .
echo === env ===
./build.sh --print-env
- name: Store SP types from commit
run: |
id
ls -lh ${{github.workspace}}/skyrim-platform/src/platform_se/codegen/convert-files
commit=$(< ${{github.workspace}}/skyrim-platform/src/platform_se/codegen/convert-files/skyrimPlatform.ts)
chmod 777 ${{github.workspace}}/skyrim-platform/src/platform_se/codegen/convert-files
echo "$commit" > ${{github.workspace}}/skyrim-platform/src/platform_se/codegen/convert-files/temp.txt
# Download Skyrim SE data files
- uses: suisei-cn/actions-download-file@v1
name: Download Skyrim.esm
with:
url: "https://gitlab.com/pospelov/se-data/-/raw/main/Skyrim.esm"
target: ${{github.workspace}}/skyrim_data_files/
- uses: suisei-cn/actions-download-file@v1
name: Download Update.esm
with:
url: "https://gitlab.com/pospelov/se-data/-/raw/main/Update.esm"
target: ${{github.workspace}}/skyrim_data_files/
- uses: suisei-cn/actions-download-file@v1
name: Download Dawnguard.esm
with:
url: "https://gitlab.com/pospelov/se-data/-/raw/main/Dawnguard.esm"
target: ${{github.workspace}}/skyrim_data_files/
- uses: suisei-cn/actions-download-file@v1
name: Download HearthFires.esm
with:
url: "https://gitlab.com/pospelov/se-data/-/raw/main/HearthFires.esm"
target: ${{github.workspace}}/skyrim_data_files/
- uses: suisei-cn/actions-download-file@v1
name: Download Dragonborn.esm
with:
url: "https://gitlab.com/pospelov/se-data/-/raw/main/Dragonborn.esm"
target: ${{github.workspace}}/skyrim_data_files/
- name: Prepare
uses: addnab/docker-run-action@v3
with:
image: localhost/buildimage
options: |
-v ${{github.workspace}}:/src
run: |
chown -R skymp:skymp /src
- name: CMake Configure
id: cmake_configure
uses: addnab/docker-run-action@v3
with:
image: localhost/buildimage
options: |
-v ${{github.workspace}}:/src
-u skymp
run: |
cd /src \
&& ./build.sh --configure \
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \
-DUNIT_DATA_DIR="/src/skyrim_data_files"
- name: Upload vcpkg logs
if: always()
uses: actions/upload-artifact@v4
with:
name: ${{matrix.base_system}}_vcpkg_logs
path: |
${{github.workspace}}/build/vcpkg-bootstrap.log
${{github.workspace}}/vcpkg/buildtrees/**/*.log
- name: Upload compile_commands.json
uses: actions/upload-artifact@v4
with:
name: ${{matrix.base_system}}_compile_commands.json
path: ${{github.workspace}}/build/compile_commands.json
- name: Build
uses: addnab/docker-run-action@v3
with:
image: localhost/buildimage
options: |
-v ${{github.workspace}}:/src
-u skymp
run: |
cd /src \
&& ./build.sh --build
- name: Prepare dist.tar.gz
uses: addnab/docker-run-action@v3
with:
image: localhost/buildimage
options: |
-v ${{github.workspace}}:/src
-u skymp
run: |
cd /src/build \
&& tar czf dist.tar.gz dist
- name: Upload dist.tar.gz
uses: actions/upload-artifact@v4
with:
name: ${{matrix.base_system}}_dist.tar.gz
path: ${{github.workspace}}/build/dist.tar.gz
- name: SP Types Check
id: sp_types_check
run: |
commit=$(< ${{github.workspace}}/skyrim-platform/src/platform_se/codegen/convert-files/temp.txt)
build=$(< ${{github.workspace}}/build/dist/client/Data/Platform/Modules/skyrimPlatform.ts)
difference=$(diff -u <(echo "$commit") <(echo "$build"))
size=$(echo -n $difference | wc -m)
echo "Size $size"
if [ $size != 0 ] ; then
echo "SP Types in codegen and build dist not equal"
echo "Difference:"
echo $difference
exit 1
fi
echo "SP Types in codegen and build dist equal"
- name: SP Const Enums Check
id: sp_const_enums_check
run: |
cd skyrim-platform/tools/const_enum_extractor
sudo yarn install
sudo node ./index.js
# Checking if ConstEnumApi.cpp has changed
cd ../../../
git diff --exit-code skyrim-platform/src/platform_se/skyrim_platform/ConstEnumApi.cpp
if [ $? -ne 0 ]; then
echo "ConstEnumApi.cpp has changed after running const_enum_extractor. Please re-run it locally and commit changes"
exit 1
fi
- name: SP Types Check failed - Here is what you can do
if: ${{ failure() && steps.sp_types_check.outcome == 'failure' }}
run: |
echo "skyrimPlatform.ts and Definitions.txt do not match."
echo "You can fix this manually or simply build the project locally and commit the changes."
- name: SP Const Enums Check failed - Here is what you can do
if: ${{ failure() && steps.sp_const_enums_check.outcome == 'failure' }}
run: |
echo "ConstEnumApi.cpp has changed after running const_enum_extractor. Please re-run it locally and commit changes."
echo "In folder skyrim-platform/tools/const_enum_extractor run 'yarn install' and then 'node ./index.js'"
- name: Test
uses: addnab/docker-run-action@v3
with:
image: localhost/buildimage
options: |
-v ${{github.workspace}}:/src
-u skymp
run: |
cd /src/build \
&& ctest -C ${{env.BUILD_TYPE}} --verbose --output-on-failure