]> git.lizzy.rs Git - minetest.git/blob - .github/workflows/macos.yml
edc6630c04d12d9f32a692a68913e106fa52178c
[minetest.git] / .github / workflows / macos.yml
1 name: macos
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       - '.github/workflows/macos.yml'
14   pull_request:
15     paths:
16       - 'lib/**.[ch]'
17       - 'lib/**.cpp'
18       - 'src/**.[ch]'
19       - 'src/**.cpp'
20       - '**/CMakeLists.txt'
21       - 'cmake/Modules/**'
22       - '.github/workflows/macos.yml'
23
24 env:
25   MINETEST_GAME_REPO: https://github.com/minetest/minetest_game.git
26   MINETEST_GAME_BRANCH: master
27   MINETEST_GAME_NAME: minetest_game
28
29 jobs:
30   build:
31     runs-on: macos-11
32     steps:
33       - uses: actions/checkout@v3
34       - name: Install deps
35         run: |
36           source ./util/ci/common.sh
37           install_macos_deps
38
39       - name: Build
40         run: |
41           git clone -b $MINETEST_GAME_BRANCH $MINETEST_GAME_REPO games/$MINETEST_GAME_NAME
42           git clone https://github.com/minetest/irrlicht lib/irrlichtmt --depth 1 -b $(cat misc/irrlichtmt_tag.txt)
43           mkdir build
44           cd build
45           cmake .. \
46             -DCMAKE_OSX_DEPLOYMENT_TARGET=10.14 \
47             -DCMAKE_FIND_FRAMEWORK=LAST \
48             -DCMAKE_INSTALL_PREFIX=../build/macos/ \
49             -DRUN_IN_PLACE=FALSE -DENABLE_GETTEXT=TRUE
50           make -j2
51           make install
52
53       - name: Test
54         run: |
55           ./build/macos/minetest.app/Contents/MacOS/minetest --run-unittests
56
57       # Zipping the built .app preserves permissions on the contained files,
58       #   which the GitHub artifact pipeline would otherwise strip away.
59       - name: CPack
60         run: |
61           cd build
62           cpack -G ZIP -B macos
63
64       - uses: actions/upload-artifact@v3
65         with:
66           name: minetest-macos
67           path: ./build/macos/*.zip