Disable pgsql in VS 2019 workflow
[oweals/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   pull_request:
17     paths:
18       - 'lib/**.[ch]'
19       - 'lib/**.cpp'
20       - 'src/**.[ch]'
21       - 'src/**.cpp'
22       - '**/CMakeLists.txt'
23       - 'cmake/Modules/**'
24       - 'util/buildbot/**'
25       - 'util/ci/**'
26       - '.github/workflows/**.yml'
27
28 jobs:
29   # This is our minor gcc compiler
30   gcc_6:
31     runs-on: ubuntu-18.04
32     steps:
33       - uses: actions/checkout@v2
34       - name: Install deps
35         run: |
36           sudo apt-get install g++-6 gcc-6 -qyy
37           source ./util/ci/common.sh
38           install_linux_deps
39
40       - name: Build
41         run: |
42           ./util/ci/build.sh
43         env:
44           CC: gcc-6
45           CXX: g++-6
46
47       - name: Test
48         run: |
49           ./bin/minetest --run-unittests
50
51   # This is the current gcc compiler (available in bionic)
52   gcc_8:
53     runs-on: ubuntu-18.04
54     steps:
55       - uses: actions/checkout@v2
56       - name: Install deps
57         run: |
58           sudo apt-get install g++-8 gcc-8 -qyy
59           source ./util/ci/common.sh
60           install_linux_deps
61
62       - name: Build
63         run: |
64           ./util/ci/build.sh
65         env:
66           CC: gcc-8
67           CXX: g++-8
68
69       - name: Test
70         run: |
71           ./bin/minetest --run-unittests
72
73   # This is our minor clang compiler
74   clang_3_9:
75     runs-on: ubuntu-18.04
76     steps:
77       - uses: actions/checkout@v2
78       - name: Install deps
79         run: |
80           sudo apt-get install clang-3.9 -qyy
81           source ./util/ci/common.sh
82           install_linux_deps
83
84       - name: Build
85         run: |
86           ./util/ci/build.sh
87         env:
88           CC: clang-3.9
89           CXX: clang++-3.9
90
91       - name: Test
92         run: |
93           ./bin/minetest --run-unittests
94
95   # This is the current clang version
96   clang_9:
97     runs-on: ubuntu-18.04
98     steps:
99       - uses: actions/checkout@v2
100       - name: Install deps
101         run: |
102           sudo apt-get install clang-9 valgrind -qyy
103           source ./util/ci/common.sh
104           install_linux_deps
105         env:
106           WITH_LUAJIT: 1
107
108       - name: Build
109         run: |
110           ./util/ci/build.sh
111         env:
112           CC: clang-9
113           CXX: clang++-9
114
115       - name: Test
116         run: |
117           ./bin/minetest --run-unittests
118
119       - name: Valgrind
120         run: |
121           valgrind --leak-check=full --leak-check-heuristics=all --undef-value-errors=no --error-exitcode=9 ./bin/minetest --run-unittests
122
123   # Build with prometheus-cpp (server-only)
124   clang_9_prometheus:
125     name: "clang_9 (PROMETHEUS=1)"
126     runs-on: ubuntu-18.04
127     steps:
128       - uses: actions/checkout@v2
129       - name: Install deps
130         run: |
131           sudo apt-get install clang-9 -qyy
132           source ./util/ci/common.sh
133           install_linux_deps
134
135       - name: Build prometheus-cpp
136         run: |
137           ./util/ci/build_prometheus_cpp.sh
138
139       - name: Build
140         run: |
141           ./util/ci/build.sh
142         env:
143           CC: clang-9
144           CXX: clang++-9
145           CMAKE_FLAGS: "-DENABLE_PROMETHEUS=1 -DBUILD_CLIENT=0"
146
147       - name: Test
148         run: |
149           ./bin/minetestserver --run-unittests
150
151   # Build without freetype (client-only)
152   clang_9_no_freetype:
153     name: "clang_9 (FREETYPE=0)"
154     runs-on: ubuntu-18.04
155     steps:
156       - uses: actions/checkout@v2
157       - name: Install deps
158         run: |
159           sudo apt-get install clang-9 -qyy
160           source ./util/ci/common.sh
161           install_linux_deps
162
163       - name: Build
164         run: |
165           ./util/ci/build.sh
166         env:
167           CC: clang-9
168           CXX: clang++-9
169           CMAKE_FLAGS: "-DENABLE_FREETYPE=0 -DBUILD_SERVER=0"
170
171       - name: Test
172         run: |
173           ./bin/minetest --run-unittests
174
175   docker:
176     name: "Docker image"
177     runs-on: ubuntu-18.04
178     steps:
179       - uses: actions/checkout@v2
180       - name: Build docker image
181         run: |
182           docker build .
183
184   win32:
185     name: "MinGW cross-compiler (32-bit)"
186     runs-on: ubuntu-18.04
187     steps:
188       - uses: actions/checkout@v2
189       - name: Install compiler
190         run: |
191           sudo apt-get install gettext -qyy
192           wget http://minetest.kitsunemimi.pw/mingw-w64-i686_9.2.0_ubuntu18.04.tar.xz -O mingw.tar.xz
193           sudo tar -xaf mingw.tar.xz -C /usr
194
195       - name: Build
196         run: |
197            EXISTING_MINETEST_DIR=$PWD ./util/buildbot/buildwin32.sh winbuild
198         env:
199           NO_MINETEST_GAME: 1
200           NO_PACKAGE: 1
201
202   win64:
203     name: "MinGW cross-compiler (64-bit)"
204     runs-on: ubuntu-18.04
205     steps:
206       - uses: actions/checkout@v2
207       - name: Install compiler
208         run: |
209           sudo apt-get install gettext -qyy
210           wget http://minetest.kitsunemimi.pw/mingw-w64-x86_64_9.2.0_ubuntu18.04.tar.xz -O mingw.tar.xz
211           sudo tar -xaf mingw.tar.xz -C /usr
212
213       - name: Build
214         run: |
215           EXISTING_MINETEST_DIR=$PWD ./util/buildbot/buildwin64.sh winbuild
216         env:
217           NO_MINETEST_GAME: 1
218           NO_PACKAGE: 1
219
220   msvc:
221     name: VS 2019 ${{ matrix.config.arch }}-${{ matrix.type }}
222     runs-on: windows-2019 
223     env:
224       VCPKG_VERSION: c7ab9d3110813979a873b2dbac630a9ab79850dc
225 #                    2020.04
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@v2
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\