-
Notifications
You must be signed in to change notification settings - Fork 101
303 lines (266 loc) · 10.3 KB
/
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
name: Build
on:
workflow_dispatch:
push:
branches:
- "master"
- "stable_master"
- "dev"
paths:
- "**.hpp"
- "**.cpp"
- "**.h"
- "**.c"
- "**CMakeLists.txt"
- "**.cmake"
- ".github/workflows/build.yml"
- "docker/**"
pull_request:
branches:
- "master"
- "stable_master"
paths:
- "**.hpp"
- "**.cpp"
- "**.h"
- "**.c"
- "**CMakeLists.txt"
- "**.cmake"
- ".github/workflows/build.yml"
- "docker/**"
jobs:
build-windows:
name: Windows build
runs-on: windows-2019
strategy:
matrix:
arch: [Win32, x64]
steps:
- uses: actions/checkout@v3
with:
clean: true
submodules: recursive
fetch-depth: 0
- name: Declare build output variables
id: vars
shell: bash
env:
HEAD_REF: ${{ github.head_ref || github.ref_name }}
run: |
echo "build_version=$(git describe --always --tags "refs/remotes/origin/${HEAD_REF}")" >> $GITHUB_OUTPUT
echo "build_config=RelWithDebInfo" >> $GITHUB_OUTPUT
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install CMake
uses: lukka/get-cmake@latest
with:
cmakeVersion: "3.23.2"
- name: Install latest conan
run: |
python -m pip install --upgrade pip
pip install -v "conan==1.57.0"
- name: Try to restore conan cache
id: conan-cache-restore
uses: actions/cache/restore@v3
env:
cache-name: cache-conan-modules
with:
path: ~/.conan/data
key: conan-windows-${{ matrix.arch }}-${{ hashFiles('CMakeLists.txt', 'lib/CMakeLists.txt', 'SDK/CMakeLists.txt', 'SDK/lib/cmake-conan/conan.cmake', 'SDK/lib/cmake-conan/conan-omp.cmake') }}
- name: Generate build files
run: |
$env:OMP_BUILD_VERSION=$(git rev-list $(git rev-list --max-parents=0 HEAD) HEAD | Measure-Object -Line).Lines
$env:OMP_BUILD_COMMIT=$(git rev-parse HEAD)
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=${{ steps.vars.outputs.build_config }} .. -A ${{ matrix.arch }} -T "ClangCL"
- name: Try to save conan cache
if: steps.conan-cache-restore.outputs.cache-hit != 'true'
uses: actions/cache/save@v3
env:
cache-name: cache-conan-modules
with:
path: ~/.conan/data
key: ${{ steps.conan-cache-restore.outputs.cache-primary-key }}
- name: Build
run: |
cd build
cmake --build . --config ${{ steps.vars.outputs.build_config }}
- name: Create a build archive
id: build
shell: bash
env:
HEAD_REF: ${{ github.head_ref || github.ref_name }}
run: |
version=${{ steps.vars.outputs.build_version }}
artifact_name="open.mp-win-${{ matrix.arch }}-${version}"
echo "artifact_name=${artifact_name}" >> $GITHUB_OUTPUT
cd build/Output/*
powershell -NoLogo -NoProfile -Command Compress-Archive -DestinationPath "${artifact_name}.zip" -Path "Server"
- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ steps.build.outputs.artifact_name }}
path: build/Output/${{ steps.vars.outputs.build_config }}/${{ steps.build.outputs.artifact_name }}.zip
if-no-files-found: error
build-linux:
name: Linux build
runs-on: ubuntu-latest
strategy:
matrix:
arch: [x86, x86_64]
ssl: [dynamic, static]
steps:
- uses: actions/checkout@v3
with:
clean: true
submodules: recursive
fetch-depth: 0
- name: Declare build output variables
id: vars
shell: bash
env:
HEAD_REF: ${{ github.head_ref || github.ref_name }}
run: |
echo "build_version=$(git describe --always --tags "refs/remotes/origin/${HEAD_REF}")" >> $GITHUB_OUTPUT
echo "build_config=RelWithDebInfo" >> $GITHUB_OUTPUT
echo "build_ubuntu_version=18.04" >> $GITHUB_OUTPUT
echo "build_shared=${{ matrix.ssl == 'dynamic' }}" >> $GITHUB_OUTPUT
echo "build_server=1" >> $GITHUB_OUTPUT
echo "build_tools=0" >> $GITHUB_OUTPUT
echo "build_target_arch=${{ matrix.arch }}" >> $GITHUB_OUTPUT
- name: Set ownership
run: |
# this is to fix GIT not liking owner of the checkout dir
chown -R $(id -u):$(id -g) $PWD
- name: Try to restore conan cache
id: conan-cache-restore
uses: actions/cache/restore@v3
env:
cache-name: cache-conan-modules
with:
path: docker/conan/data
key: conan-linux-${{ matrix.arch }}-${{ matrix.ssl }}-${{ hashFiles('CMakeLists.txt', 'lib/CMakeLists.txt', 'SDK/CMakeLists.txt', 'SDK/lib/cmake-conan/conan.cmake', 'SDK/lib/cmake-conan/conan-omp.cmake') }}
- name: Build
run: |
cd docker
CONFIG=${{ steps.vars.outputs.build_config }} UBUNTU_VERSION=${{ steps.vars.outputs.build_ubuntu_version }} BUILD_SHARED=${{ steps.vars.outputs.build_shared }} BUILD_SERVER=${{ steps.vars.outputs.build_server }} BUILD_TOOLS=${{ steps.vars.outputs.build_tools }} TARGET_BUILD_ARCH=${{ steps.vars.outputs.build_target_arch }} ./build.sh
- name: Try to save conan cache
if: steps.conan-cache-restore.outputs.cache-hit != 'true'
uses: actions/cache/save@v3
env:
cache-name: cache-conan-modules
with:
path: docker/conan/data
key: ${{ steps.conan-cache-restore.outputs.cache-primary-key }}
- name: Create a build archive
id: build
env:
HEAD_REF: ${{ github.head_ref || github.ref_name }}
run: |
version=${{ steps.vars.outputs.build_version }}
artifact_name="open.mp-linux-${{ matrix.arch }}${{ matrix.ssl == 'dynamic' && '-dynssl' || '' }}-${version}"
echo "artifact_name=${artifact_name}" >> $GITHUB_OUTPUT
cd docker/build/Output/*
sudo tar -cJvf "${artifact_name}.tar.xz" "Server"
- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ steps.build.outputs.artifact_name }}
path: docker/build/Output/${{ steps.vars.outputs.build_config }}/${{ steps.build.outputs.artifact_name }}.tar.xz
if-no-files-found: error
abi-check:
if: github.event_name == 'pull_request'
name: SDK ABI check
needs: build-linux
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
clean: true
submodules: recursive
fetch-depth: 0
- name: Declare build variables
id: vars
shell: bash
env:
HEAD_REF: ${{ github.head_ref || github.ref_name }}
run: |
echo "build_version=$(git describe --always --tags "refs/remotes/origin/${HEAD_REF}")" >> $GITHUB_OUTPUT
- uses: actions/download-artifact@v3
id: download
with:
name: open.mp-linux-x86-dynssl-${{ steps.vars.outputs.build_version }}
path: docker/ref
- name: Build & run abi-check
shell: bash
run: |
cd docker
chmod +x ./abicheck.sh
chmod +x ./abicheck_ubuntu-18.04/docker-entrypoint.sh
CONFIG=RelWithDebInfo NIGHTLY_REPO="${{ github.repository }}" REF_ARCHIVE="open.mp-linux-x86-dynssl-${{ steps.vars.outputs.build_version }}.tar.xz" UBUNTU_VERSION=18.04 BUILD_SERVER=0 BUILD_TOOLS=1 ./abicheck.sh
build-arm-gnu:
name: ARM build (GNU)
runs-on: ubuntu-latest
strategy:
matrix:
arch: [arm32, aarch64]
ssl: [dynamic, static]
steps:
- uses: actions/checkout@v3
with:
clean: true
submodules: recursive
fetch-depth: 0
- name: Declare build output variables
id: vars
shell: bash
env:
HEAD_REF: ${{ github.head_ref || github.ref_name }}
run: |
echo "build_version=$(git describe --always --tags "refs/remotes/origin/${HEAD_REF}")" >> $GITHUB_OUTPUT
echo "build_config=RelWithDebInfo" >> $GITHUB_OUTPUT
- name: Try to restore conan cache
id: conan-cache-restore
uses: actions/cache/restore@v3
env:
cache-name: cache-conan-modules
with:
path: docker/conan/data
key: conan-linux-${{ matrix.arch }}-${{ matrix.ssl }}-${{ hashFiles('CMakeLists.txt', 'lib/CMakeLists.txt', 'SDK/CMakeLists.txt', 'SDK/lib/cmake-conan/conan.cmake', 'SDK/lib/cmake-conan/conan-omp.cmake') }}
- name: Run ARM build
uses: pguyot/[email protected]
with:
base_image: ${{ matrix.arch == 'arm32' && 'raspios_lite' || 'raspios_lite_arm64' }}:2022-04-04
image_additional_mb: 10000
bind_mount_repository: true
cpu: cortex-a7
commands: |
apt update && apt install -y ninja-build clang-11 python3-pip libstdc++6 libc6
pip3 install --user -v "conan==1.57.0"
pip3 install --user -v "cmake==3.23.3"
export CC=/usr/bin/clang-11
export CXX=/usr/bin/clang++-11
export PATH=~/.local/bin:${PATH}
mkdir -p docker/conan/data
mkdir ~/.conan
mv docker/conan/data ~/.conan
cmake -S . -B build -G Ninja -DTARGET_BUILD_ARCH=${{ matrix.arch == 'arm32' && 'armv7' || 'armv8' }} -DCMAKE_BUILD_TYPE=${{ steps.vars.outputs.build_config }} -DSHARED_OPENSSL=${{ matrix.ssl == 'dynamic' }} -DSTATIC_STDCXX=true -DBUILD_SERVER=1 -DBUILD_ABI_CHECK_TOOL=0
cmake --build build --config ${{ steps.vars.outputs.build_config }} --parallel $(nproc)
mv ~/.conan/data docker/conan
- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: open.mp-linux-${{ matrix.arch }}${{ matrix.ssl == 'dynamic' && '-dynssl' || '' }}-${{ steps.vars.outputs.build_version }}
path: build/Output/${{ steps.vars.outputs.build_config }}/Server
if-no-files-found: error
- name: Try to save conan cache
if: steps.conan-cache-restore.outputs.cache-hit != 'true'
uses: actions/cache/save@v3
env:
cache-name: cache-conan-modules
with:
path: docker/conan/data
key: ${{ steps.conan-cache-restore.outputs.cache-primary-key }}