]> git.lizzy.rs Git - dragonfireclient.git/blob - .github/workflows/build.yml
70340d82d584b3b417d985f48eb5dd4e6a5ea971
[dragonfireclient.git] / .github / workflows / build.yml
1 name: build
2
3 # build on c/cpp changes or workflow changes
4 on:
5   push:
6     paths:
7       - 'lib/**.[ch]'
8       - 'lib/**.cpp'
9       - 'src/**.[ch]'
10       - 'src/**.cpp'
11       - '**/CMakeLists.txt'
12       - 'cmake/Modules/**'
13       - 'util/buildbot/**'
14       - 'util/ci/**'
15       - '.github/workflows/**.yml'
16       - 'Dockerfile'
17       - '.dockerignore'
18   pull_request:
19     paths:
20       - 'lib/**.[ch]'
21       - 'lib/**.cpp'
22       - 'src/**.[ch]'
23       - 'src/**.cpp'
24       - '**/CMakeLists.txt'
25       - 'cmake/Modules/**'
26       - 'util/buildbot/**'
27       - 'util/ci/**'
28       - '.github/workflows/**.yml'
29       - 'Dockerfile'
30       - '.dockerignore'
31
32 jobs:
33   # Older gcc version (should be close to our minimum supported version)
34   gcc_5:
35     runs-on: ubuntu-18.04
36     steps:
37       - uses: actions/checkout@v3
38       - name: Install deps
39         run: |
40           source ./util/ci/common.sh
41           install_linux_deps g++-5
42
43       - name: Build
44         run: |
45           ./util/ci/build.sh
46         env:
47           CC: gcc-5
48           CXX: g++-5
49
50       - name: Test
51         run: |
52           ./bin/minetest --run-unittests
53
54   # Current gcc version
55   gcc_10:
56     runs-on: ubuntu-20.04
57     steps:
58       - uses: actions/checkout@v3
59       - name: Install deps
60         run: |
61           source ./util/ci/common.sh
62           install_linux_deps g++-10
63
64       - name: Build
65         run: |
66           ./util/ci/build.sh
67         env:
68           CC: gcc-10
69           CXX: g++-10
70
71       - name: Test
72         run: |
73           ./bin/minetest --run-unittests
74
75   # Older clang version (should be close to our minimum supported version)
76   clang_3_9:
77     runs-on: ubuntu-18.04
78     steps:
79       - uses: actions/checkout@v3
80       - name: Install deps
81         run: |
82           source ./util/ci/common.sh
83           install_linux_deps clang-3.9 gdb
84
85       - name: Build
86         run: |
87           ./util/ci/build.sh
88         env:
89           CC: clang-3.9
90           CXX: clang++-3.9
91
92       - name: Unittest
93         run: |
94           ./bin/minetest --run-unittests
95
96       - name: Integration test + devtest
97         run: |
98           ./util/test_multiplayer.sh
99
100   # Current clang version
101   clang_10:
102     runs-on: ubuntu-20.04
103     steps:
104       - uses: actions/checkout@v3
105       - name: Install deps
106         run: |
107           source ./util/ci/common.sh
108           install_linux_deps clang-10 valgrind libluajit-5.1-dev
109
110       - name: Build
111         run: |
112           ./util/ci/build.sh
113         env:
114           CC: clang-10
115           CXX: clang++-10
116           CMAKE_FLAGS: "-DREQUIRE_LUAJIT=1"
117
118       - name: Test
119         run: |
120           ./bin/minetest --run-unittests
121
122       - name: Valgrind
123         run: |
124           valgrind --leak-check=full --leak-check-heuristics=all --undef-value-errors=no --error-exitcode=9 ./bin/minetest --run-unittests
125
126   # Build with prometheus-cpp (server-only)
127   clang_9_prometheus:
128     name: "clang_9 (PROMETHEUS=1)"
129     runs-on: ubuntu-20.04
130     steps:
131       - uses: actions/checkout@v3
132       - name: Install deps
133         run: |
134           source ./util/ci/common.sh
135           install_linux_deps --old-irr clang-9
136
137       - name: Build prometheus-cpp
138         run: |
139           ./util/ci/build_prometheus_cpp.sh
140
141       - name: Build
142         run: |
143           ./util/ci/build.sh
144         env:
145           CC: clang-9
146           CXX: clang++-9
147           CMAKE_FLAGS: "-DENABLE_PROMETHEUS=1 -DBUILD_CLIENT=0"
148
149       - name: Test
150         run: |
151           ./bin/minetestserver --run-unittests
152
153   docker:
154     name: "Docker image"
155     runs-on: ubuntu-20.04
156     steps:
157       - uses: actions/checkout@v3
158       - name: Build docker image
159         run: |
160           docker build . -t minetest:latest
161           docker run --rm minetest:latest /usr/local/bin/minetestserver --version
162
163   win32:
164     name: "MinGW cross-compiler (32-bit)"
165     runs-on: ubuntu-20.04
166     steps:
167       - uses: actions/checkout@v3
168       - name: Install compiler
169         run: |
170           sudo apt-get update && sudo apt-get install -y gettext
171           wget http://minetest.kitsunemimi.pw/mingw-w64-i686_11.2.0_ubuntu20.04.tar.xz -O mingw.tar.xz
172           sudo tar -xaf mingw.tar.xz -C /usr
173
174       - name: Build
175         run: |
176            EXISTING_MINETEST_DIR=$PWD ./util/buildbot/buildwin32.sh winbuild
177         env:
178           NO_MINETEST_GAME: 1
179           NO_PACKAGE: 1
180
181   win64:
182     name: "MinGW cross-compiler (64-bit)"
183     runs-on: ubuntu-20.04
184     steps:
185       - uses: actions/checkout@v3
186       - name: Install compiler
187         run: |
188           sudo apt-get update && sudo apt-get install -y gettext
189           wget http://minetest.kitsunemimi.pw/mingw-w64-x86_64_11.2.0_ubuntu20.04.tar.xz -O mingw.tar.xz
190           sudo tar -xaf mingw.tar.xz -C /usr
191
192       - name: Build
193         run: |
194           EXISTING_MINETEST_DIR=$PWD ./util/buildbot/buildwin64.sh winbuild
195         env:
196           NO_MINETEST_GAME: 1
197           NO_PACKAGE: 1
198
199   msvc:
200     name: VS 2019 ${{ matrix.config.arch }}-${{ matrix.type }}
201     runs-on: windows-2019
202     env:
203       VCPKG_VERSION: 5cf60186a241e84e8232641ee973395d4fde90e1
204       # 2022.02
205       vcpkg_packages: zlib zstd curl[winssl] openal-soft libvorbis libogg libjpeg-turbo sqlite3 freetype luajit gmp jsoncpp opengl-registry
206     strategy:
207       fail-fast: false
208       matrix:
209         config:
210           - {
211               arch: x86,
212               generator: "-G'Visual Studio 16 2019' -A Win32",
213               vcpkg_triplet: x86-windows
214             }
215           - {
216               arch: x64,
217               generator: "-G'Visual Studio 16 2019' -A x64",
218               vcpkg_triplet: x64-windows
219             }
220         type: [portable]
221 #        type: [portable, installer]
222 # The installer type is working, but disabled, to save runner jobs.
223 # Enable it, when working on the installer.
224
225     steps:
226       - uses: actions/checkout@v3
227
228       - name: Checkout IrrlichtMt
229         uses: actions/checkout@v3
230         with:
231           repository: minetest/irrlicht
232           path: lib/irrlichtmt/
233           ref: "1.9.0mt6"
234
235       - name: Restore from cache and run vcpkg
236         uses: lukka/run-vcpkg@v7
237         with:
238           vcpkgArguments: ${{env.vcpkg_packages}}
239           vcpkgDirectory: '${{ github.workspace }}\vcpkg'
240           appendedCacheKey: ${{ matrix.config.vcpkg_triplet }}
241           vcpkgGitCommitId: ${{ env.VCPKG_VERSION }}
242           vcpkgTriplet: ${{ matrix.config.vcpkg_triplet }}
243
244       - name: Minetest CMake
245         run: |
246           cmake ${{matrix.config.generator}}  `
247           -DCMAKE_TOOLCHAIN_FILE="${{ github.workspace }}\vcpkg\scripts\buildsystems\vcpkg.cmake"  `
248           -DCMAKE_BUILD_TYPE=Release  `
249           -DENABLE_POSTGRESQL=OFF  `
250           -DRUN_IN_PLACE=${{ contains(matrix.type, 'portable') }} .
251
252       - name: Build Minetest
253         run: cmake --build . --config Release
254
255       - name: CPack
256         run: |
257           If ($env:TYPE -eq "installer")
258           {
259             cpack -G WIX -B "$env:GITHUB_WORKSPACE\Package"
260           }
261           ElseIf($env:TYPE -eq "portable")
262           {
263             cpack -G ZIP -B "$env:GITHUB_WORKSPACE\Package"
264           }
265         env:
266           TYPE: ${{matrix.type}}
267
268       - name: Package Clean
269         run: rm -r $env:GITHUB_WORKSPACE\Package\_CPack_Packages
270
271       - uses: actions/upload-artifact@v3
272         with:
273           name: msvc-${{ matrix.config.arch }}-${{ matrix.type }}
274           path: .\Package\