1
0

macos.yml 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. name: macos
  2. # build on c/cpp changes or workflow changes
  3. on:
  4. push:
  5. paths:
  6. - 'lib/**.[ch]'
  7. - 'lib/**.cpp'
  8. - 'src/**.[ch]'
  9. - 'src/**.cpp'
  10. - 'irr/**.[ch]'
  11. - 'irr/**.cpp'
  12. - 'irr/**.mm' # Objective-C(++)
  13. - '**/CMakeLists.txt'
  14. - 'cmake/Modules/**'
  15. - 'po/**.po'
  16. - '.github/workflows/macos.yml'
  17. pull_request:
  18. paths:
  19. - 'lib/**.[ch]'
  20. - 'lib/**.cpp'
  21. - 'src/**.[ch]'
  22. - 'src/**.cpp'
  23. - 'irr/**.[ch]'
  24. - 'irr/**.cpp'
  25. - 'irr/**.mm' # Objective-C(++)
  26. - '**/CMakeLists.txt'
  27. - 'cmake/Modules/**'
  28. - 'po/**.po'
  29. - '.github/workflows/macos.yml'
  30. jobs:
  31. build-intel-macos:
  32. # use lowest possible macOS running on x86_64 supported by brew to support more users
  33. runs-on: macos-13
  34. steps:
  35. - uses: actions/checkout@v4
  36. - name: Install deps
  37. run: |
  38. source ./util/ci/common.sh
  39. install_macos_deps
  40. - name: Build
  41. run: |
  42. mkdir build
  43. cd build
  44. cmake .. \
  45. -DCMAKE_OSX_DEPLOYMENT_TARGET=10.14 \
  46. -DCMAKE_FIND_FRAMEWORK=LAST \
  47. -DCMAKE_INSTALL_PREFIX=../build/macos/ \
  48. -DRUN_IN_PLACE=FALSE -DENABLE_GETTEXT=TRUE \
  49. -DINSTALL_DEVTEST=TRUE
  50. cmake --build . -j$(sysctl -n hw.logicalcpu)
  51. make install
  52. - name: Test
  53. run: |
  54. ./build/macos/luanti.app/Contents/MacOS/luanti --run-unittests
  55. # Zipping the built .app preserves permissions on the contained files,
  56. # which the GitHub artifact pipeline would otherwise strip away.
  57. - name: CPack
  58. run: |
  59. cd build
  60. rm -rf macos
  61. cmake .. -DINSTALL_DEVTEST=FALSE
  62. cpack -G ZIP -B macos
  63. - uses: actions/upload-artifact@v4
  64. with:
  65. name: luanti-macos
  66. path: ./build/macos/*.zip
  67. build-arm-macos-xcode:
  68. runs-on: macos-14
  69. steps:
  70. - uses: actions/checkout@v4
  71. - name: Install deps
  72. run: |
  73. source ./util/ci/common.sh
  74. install_macos_deps
  75. # brew jsoncpp do not include libjsoncpp.a, and if installed header conflict caused build failure
  76. brew uninstall jsoncpp
  77. - name: Build with Cmake
  78. run: |
  79. mkdir build
  80. cd build
  81. cmake .. \
  82. -DCMAKE_OSX_DEPLOYMENT_TARGET=14 \
  83. -DCMAKE_FIND_FRAMEWORK=LAST \
  84. -DCMAKE_INSTALL_PREFIX=../build/macos/ \
  85. -DRUN_IN_PLACE=FALSE -DENABLE_GETTEXT=TRUE \
  86. -DENABLE_SYSTEM_JSONCPP=OFF
  87. cmake --build . -j$(sysctl -n hw.logicalcpu)
  88. make install
  89. - name: Build and Archive with Xcode
  90. run: |
  91. mkdir build_xcode
  92. cd build_xcode
  93. ../util/ci/build_xcode.sh
  94. - name: Tests
  95. run: |
  96. mkdir -p "${HOME}/Library/Application Support/minetest/games/"
  97. ln -s "${PWD}/games/devtest" "${HOME}/Library/Application Support/minetest/games/"
  98. ./build/macos/luanti.app/Contents/MacOS/luanti --run-unittests
  99. ./build_xcode/luanti.xcarchive/Products/Applications/luanti.app/Contents/MacOS/luanti --run-unittests
  100. - name: Diff Resources
  101. run: |
  102. diff -rd ./build/macos/luanti.app/Contents/Resources ./build_xcode/build/Release/luanti.app/Contents/Resources || exit 1
  103. diff -rd ./build/macos/luanti.app/Contents/Resources ./build_xcode/luanti.xcarchive/Products/Applications/luanti.app/Contents/Resources || exit 1