aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/macos.yml
blob: 346e4f300cf2472534f7ddc4b8af17ced336996a (plain)
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
name: macos

# build on c/cpp changes or workflow changes
on:
  push:
    paths:
      - 'lib/**.[ch]'
      - 'lib/**.cpp'
      - 'src/**.[ch]'
      - 'src/**.cpp'
      - '**/CMakeLists.txt'
      - 'cmake/Modules/**'
      - '.github/workflows/macos.yml'
  pull_request:
    paths:
      - 'lib/**.[ch]'
      - 'lib/**.cpp'
      - 'src/**.[ch]'
      - 'src/**.cpp'
      - '**/CMakeLists.txt'
      - 'cmake/Modules/**'
      - '.github/workflows/macos.yml'

env:
  IRRLICHT_TAG: 1.9.0mt6
  MINETEST_GAME_REPO: https://github.com/minetest/minetest_game.git
  MINETEST_GAME_BRANCH: master
  MINETEST_GAME_NAME: minetest_game

jobs:
  build:
    runs-on: macos-10.15
    steps:
      - uses: actions/checkout@v3
      - name: Install deps
        run: |
          pkgs=(cmake freetype gettext gmp hiredis jpeg jsoncpp leveldb libogg libpng libvorbis luajit zstd)
          brew update
          brew install ${pkgs[@]}
          brew unlink $(brew ls --formula)
          brew link ${pkgs[@]}

      - name: Build
        run: |
          git clone -b $MINETEST_GAME_BRANCH $MINETEST_GAME_REPO games/$MINETEST_GAME_NAME
          rm -rvf games/$MINETEST_GAME_NAME/.git
          git clone https://github.com/minetest/irrlicht -b $IRRLICHT_TAG lib/irrlichtmt
          mkdir build
          cd build
          cmake .. \
            -DCMAKE_OSX_DEPLOYMENT_TARGET=10.14 \
            -DCMAKE_FIND_FRAMEWORK=LAST \
            -DCMAKE_INSTALL_PREFIX=../build/macos/ \
            -DRUN_IN_PLACE=FALSE \
            -DENABLE_FREETYPE=TRUE -DENABLE_GETTEXT=TRUE
          make -j2
          make install

      - name: Test
        run: |
          ./build/macos/minetest.app/Contents/MacOS/minetest --run-unittests

      - uses: actions/upload-artifact@v3
        with:
          name: minetest-macos
          path: ./build/macos/