]> git.lizzy.rs Git - minetest.git/blob - .github/workflows/build.yml
fix(ci): ensure we build on docker only modifications
[minetest.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   # This is our minor gcc compiler
34   gcc_6:
35     runs-on: ubuntu-18.04
36     steps:
37       - uses: actions/checkout@v2
38       - name: Install deps
39         run: |
40           source ./util/ci/common.sh
41           install_linux_deps g++-6
42
43       - name: Build
44         run: |
45           ./util/ci/build.sh
46         env:
47           CC: gcc-6
48           CXX: g++-6
49
50       - name: Test
51         run: |
52           ./bin/minetest --run-unittests
53
54   # This is the current gcc compiler (available in bionic)
55   gcc_8:
56     runs-on: ubuntu-18.04
57     steps:
58       - uses: actions/checkout@v2
59       - name: Install deps
60         run: |
61           source ./util/ci/common.sh
62           install_linux_deps g++-8
63
64       - name: Build
65         run: |
66           ./util/ci/build.sh
67         env:
68           CC: gcc-8
69           CXX: g++-8
70
71       - name: Test
72         run: |
73           ./bin/minetest --run-unittests
74
75   # This is our minor clang compiler
76   clang_3_9:
77     runs-on: ubuntu-18.04
78     steps:
79       - uses: actions/checkout@v2
80       - name: Install deps
81         run: |
82           source ./util/ci/common.sh
83           install_linux_deps clang-3.9
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: Test
93         run: |
94           ./bin/minetest --run-unittests
95
96   # This is the current clang version
97   clang_9:
98     runs-on: ubuntu-18.04
99     steps:
100       - uses: actions/checkout@v2
101       - name: Install deps
102         run: |
103           source ./util/ci/common.sh
104           install_linux_deps clang-9 valgrind libluajit-5.1-dev
105
106       - name: Build
107         run: |
108           ./util/ci/build.sh
109         env:
110           CC: clang-9
111           CXX: clang++-9
112           CMAKE_FLAGS: "-DREQUIRE_LUAJIT=1"
113
114       - name: Test
115         run: |
116           ./bin/minetest --run-unittests
117
118       - name: Valgrind
119         run: |
120           valgrind --leak-check=full --leak-check-heuristics=all --undef-value-errors=no --error-exitcode=9 ./bin/minetest --run-unittests
121
122   # Build with prometheus-cpp (server-only)
123   clang_9_prometheus:
124     name: "clang_9 (PROMETHEUS=1)"
125     runs-on: ubuntu-18.04
126     steps:
127       - uses: actions/checkout@v2
128       - name: Install deps
129         run: |
130           source ./util/ci/common.sh
131           install_linux_deps --old-irr clang-9
132
133       - name: Build prometheus-cpp
134         run: |
135           ./util/ci/build_prometheus_cpp.sh
136
137       - name: Build
138         run: |
139           ./util/ci/build.sh
140         env:
141           CC: clang-9
142           CXX: clang++-9
143           CMAKE_FLAGS: "-DENABLE_PROMETHEUS=1 -DBUILD_CLIENT=0"
144
145       - name: Test
146         run: |
147           ./bin/minetestserver --run-unittests
148
149   # Build without freetype (client-only)
150   clang_9_no_freetype:
151     name: "clang_9 (FREETYPE=0)"
152     runs-on: ubuntu-18.04
153     steps:
154       - uses: actions/checkout@v2
155       - name: Install deps
156         run: |
157           source ./util/ci/common.sh
158           install_linux_deps clang-9
159
160       - name: Build
161         run: |
162           ./util/ci/build.sh
163         env:
164           CC: clang-9
165           CXX: clang++-9
166           CMAKE_FLAGS: "-DENABLE_FREETYPE=0 -DBUILD_SERVER=0"
167
168       - name: Test
169         run: |
170           ./bin/minetest --run-unittests
171
172   docker:
173     name: "Docker image"
174     runs-on: ubuntu-18.04
175     steps:
176       - uses: actions/checkout@v2
177       - name: Build docker image
178         run: |
179           docker build .
180
181   win32:
182     name: "MinGW cross-compiler (32-bit)"
183     runs-on: ubuntu-18.04
184     steps:
185       - uses: actions/checkout@v2
186       - name: Install compiler
187         run: |
188           sudo apt-get update -q && sudo apt-get install gettext -qyy
189           wget http://minetest.kitsunemimi.pw/mingw-w64-i686_9.2.0_ubuntu18.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/buildwin32.sh winbuild
195         env:
196           NO_MINETEST_GAME: 1
197           NO_PACKAGE: 1
198
199   win64:
200     name: "MinGW cross-compiler (64-bit)"
201     runs-on: ubuntu-18.04
202     steps:
203       - uses: actions/checkout@v2
204       - name: Install compiler
205         run: |
206           sudo apt-get update -q && sudo apt-get install gettext -qyy
207           wget http://minetest.kitsunemimi.pw/mingw-w64-x86_64_9.2.0_ubuntu18.04.tar.xz -O mingw.tar.xz
208           sudo tar -xaf mingw.tar.xz -C /usr
209
210       - name: Build
211         run: |
212           EXISTING_MINETEST_DIR=$PWD ./util/buildbot/buildwin64.sh winbuild
213         env:
214           NO_MINETEST_GAME: 1
215           NO_PACKAGE: 1
216
217   msvc:
218     name: VS 2019 ${{ matrix.config.arch }}-${{ matrix.type }}
219     runs-on: windows-2019
220     #### Disabled due to Irrlicht switch
221     if: false
222     #### Disabled due to Irrlicht switch
223     env:
224       VCPKG_VERSION: 0bf3923f9fab4001c00f0f429682a0853b5749e0
225 #                    2020.11
226       vcpkg_packages: irrlicht zlib curl[winssl] openal-soft libvorbis libogg sqlite3 freetype luajit
227     strategy:
228       fail-fast: false
229       matrix:
230         config:
231           - {
232               arch: x86,
233               generator: "-G'Visual Studio 16 2019' -A Win32",
234               vcpkg_triplet: x86-windows
235             }
236           - {
237               arch: x64,
238               generator: "-G'Visual Studio 16 2019' -A x64",
239               vcpkg_triplet: x64-windows
240             }
241         type: [portable]
242 #        type: [portable, installer]
243 # The installer type is working, but disabled, to save runner jobs.
244 # Enable it, when working on the installer.
245
246     steps:
247       - name: Checkout
248         uses: actions/checkout@v2
249
250       - name: Restore from cache and run vcpkg
251         uses: lukka/run-vcpkg@v5
252         with:
253           vcpkgArguments: ${{env.vcpkg_packages}}
254           vcpkgDirectory: '${{ github.workspace }}\vcpkg'
255           appendedCacheKey: ${{ matrix.config.vcpkg_triplet }}
256           vcpkgGitCommitId: ${{ env.VCPKG_VERSION }}
257           vcpkgTriplet: ${{ matrix.config.vcpkg_triplet }}
258
259       - name: CMake
260         run: |
261           cmake ${{matrix.config.generator}}  `
262           -DCMAKE_TOOLCHAIN_FILE="${{ github.workspace }}\vcpkg\scripts\buildsystems\vcpkg.cmake"  `
263           -DCMAKE_BUILD_TYPE=Release  `
264           -DENABLE_POSTGRESQL=OFF  `
265           -DRUN_IN_PLACE=${{ contains(matrix.type, 'portable') }} .
266
267       - name: Build
268         run: cmake --build . --config Release
269
270       - name: CPack
271         run: |
272           If ($env:TYPE -eq "installer")
273           {
274             cpack -G WIX -B "$env:GITHUB_WORKSPACE\Package"
275           }
276           ElseIf($env:TYPE -eq "portable")
277           {
278             cpack -G ZIP -B "$env:GITHUB_WORKSPACE\Package"
279           }
280         env:
281           TYPE: ${{matrix.type}}
282
283       - name: Package Clean
284         run: rm -r $env:GITHUB_WORKSPACE\Package\_CPack_Packages
285
286       - uses: actions/upload-artifact@v1
287         with:
288           name: msvc-${{ matrix.config.arch }}-${{ matrix.type }}
289           path: .\Package\