forked from skyrim-multiplayer/skymp
-
Notifications
You must be signed in to change notification settings - Fork 0
179 lines (161 loc) · 7.08 KB
/
pr-ubuntu-docker.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
name: PR Ubuntu Docker
on:
pull_request:
# any
push:
branches:
- main
env:
BUILD_TYPE: RelWithDebInfo
jobs:
pr-ubuntu-docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Get image to build upon
run: |
cat ${{github.workspace}}/misc/github_env_linux >> "$GITHUB_ENV"
- name: Store SP types from commit
run: |
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: ${{ env.SKYMP_VCPKG_DEPS_IMAGE }}
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: ${{ env.SKYMP_VCPKG_DEPS_IMAGE }}
options: |
-v ${{github.workspace}}:/src
-u skymp
--name configure_container
run: |
cd /src \
&& ./build.sh --configure \
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \
-DUNIT_DATA_DIR="/src/skyrim_data_files"
- name: Copy log file from container to workspace
if: failure()
run: |
sudo docker cp configure_container:/src/vcpkg/buildtrees/rsm-bsa/install-x64-linux-dbg-out.log ${{github.workspace}}/install-x64-linux-dbg-out.log
- name: Upload vcpkg failure logs
if: failure()
uses: actions/upload-artifact@v4
with:
name: install-x64-linux-dbg-out.log
path: ${{github.workspace}}/install-x64-linux-dbg-out.log
- name: Upload compile_commands.json
uses: actions/upload-artifact@v4
with:
name: compile_commands.json
path: ${{github.workspace}}/build/compile_commands.json
- name: Build
uses: addnab/docker-run-action@v3
with:
image: ${{ env.SKYMP_VCPKG_DEPS_IMAGE }}
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: ${{ env.SKYMP_VCPKG_DEPS_IMAGE }}
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: 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: ${{ env.SKYMP_VCPKG_DEPS_IMAGE }}
options: |
-v ${{github.workspace}}:/src
-u skymp
run: |
cd /src/build \
&& ctest -C ${{env.BUILD_TYPE}} --verbose --output-on-failure