minetest/.github/workflows/macos.yml

114 lines
3.5 KiB
YAML
Raw Normal View History

2021-08-28 12:14:55 +02:00
name: macos
# build on c/cpp changes or workflow changes
on:
push:
paths:
- 'lib/**.[ch]'
- 'lib/**.cpp'
- 'src/**.[ch]'
- 'src/**.cpp'
- 'irr/**.[ch]'
- 'irr/**.cpp'
- 'irr/**.mm' # Objective-C(++)
2021-08-28 12:14:55 +02:00
- '**/CMakeLists.txt'
- 'cmake/Modules/**'
- 'po/**.po'
2021-08-28 12:14:55 +02:00
- '.github/workflows/macos.yml'
pull_request:
paths:
- 'lib/**.[ch]'
- 'lib/**.cpp'
- 'src/**.[ch]'
- 'src/**.cpp'
- 'irr/**.[ch]'
- 'irr/**.cpp'
- 'irr/**.mm' # Objective-C(++)
2021-08-28 12:14:55 +02:00
- '**/CMakeLists.txt'
- 'cmake/Modules/**'
- 'po/**.po'
2021-08-28 12:14:55 +02:00
- '.github/workflows/macos.yml'
jobs:
build-intel-macos:
# use lowest possible macOS running on x86_64 supported by brew to support more users
runs-on: macos-13
2021-08-28 12:14:55 +02:00
steps:
2024-02-17 15:34:40 +01:00
- uses: actions/checkout@v4
2021-08-28 12:14:55 +02:00
- name: Install deps
run: |
source ./util/ci/common.sh
install_macos_deps
2021-08-28 12:14:55 +02:00
- name: Build
run: |
2021-12-02 00:32:41 +01:00
mkdir build
cd build
2021-08-28 12:14:55 +02:00
cmake .. \
-DCMAKE_OSX_DEPLOYMENT_TARGET=10.14 \
-DCMAKE_FIND_FRAMEWORK=LAST \
-DCMAKE_INSTALL_PREFIX=../build/macos/ \
-DRUN_IN_PLACE=FALSE -DENABLE_GETTEXT=TRUE \
-DINSTALL_DEVTEST=TRUE
cmake --build . -j$(sysctl -n hw.logicalcpu)
2021-08-28 12:14:55 +02:00
make install
- name: Test
run: |
./build/macos/luanti.app/Contents/MacOS/luanti --run-unittests
2021-08-28 12:14:55 +02:00
# Zipping the built .app preserves permissions on the contained files,
# which the GitHub artifact pipeline would otherwise strip away.
- name: CPack
run: |
cd build
rm -rf macos
2024-05-15 19:56:41 +02:00
cmake .. -DINSTALL_DEVTEST=FALSE
cpack -G ZIP -B macos
2024-02-17 15:34:40 +01:00
- uses: actions/upload-artifact@v4
2021-08-28 12:14:55 +02:00
with:
name: luanti-macos
path: ./build/macos/*.zip
build-arm-macos-xcode:
runs-on: macos-14
steps:
- uses: actions/checkout@v4
- name: Install deps
run: |
source ./util/ci/common.sh
install_macos_deps
# brew jsoncpp do not include libjsoncpp.a, and if installed header conflict caused build failure
brew uninstall jsoncpp
- name: Build with Cmake
run: |
mkdir build
cd build
cmake .. \
-DCMAKE_OSX_DEPLOYMENT_TARGET=14 \
-DCMAKE_FIND_FRAMEWORK=LAST \
-DCMAKE_INSTALL_PREFIX=../build/macos/ \
-DRUN_IN_PLACE=FALSE -DENABLE_GETTEXT=TRUE \
-DENABLE_SYSTEM_JSONCPP=OFF
cmake --build . -j$(sysctl -n hw.logicalcpu)
make install
- name: Build and Archive with Xcode
run: |
mkdir build_xcode
cd build_xcode
../util/ci/build_xcode.sh
- name: Tests
run: |
mkdir -p "${HOME}/Library/Application Support/minetest/games/"
ln -s "${PWD}/games/devtest" "${HOME}/Library/Application Support/minetest/games/"
./build/macos/luanti.app/Contents/MacOS/luanti --run-unittests
./build_xcode/luanti.xcarchive/Products/Applications/luanti.app/Contents/MacOS/luanti --run-unittests
- name: Diff Resources
run: |
diff -rd ./build/macos/luanti.app/Contents/Resources ./build_xcode/build/Release/luanti.app/Contents/Resources || exit 1
diff -rd ./build/macos/luanti.app/Contents/Resources ./build_xcode/luanti.xcarchive/Products/Applications/luanti.app/Contents/Resources || exit 1