macos.yml 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. # SuperTux
  2. # Copyright (C) 2020-2021 Jacob Burroughs <maths22@gmail.com>
  3. # 2020-2022 A. Semphris <semphris@protonmail.com>
  4. #
  5. # This program is free software: you can redistribute it and/or modify
  6. # it under the terms of the GNU General Public License as published by
  7. # the Free Software Foundation, either version 3 of the License, or
  8. # (at your option) any later version.
  9. #
  10. # This program is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. # GNU General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU General Public License
  16. # along with this program. If not, see <https://www.gnu.org/licenses/>.
  17. name: MacOS
  18. on:
  19. push:
  20. branches:
  21. - master
  22. tags:
  23. - '*'
  24. pull_request: {}
  25. jobs:
  26. macos:
  27. strategy:
  28. fail-fast: false
  29. matrix:
  30. os: [macos-11]
  31. build_type: [Debug, Release]
  32. glbinding: [ON, OFF]
  33. include:
  34. - os: macos-11
  35. build_type: Release
  36. glbinding: OFF
  37. release: ON
  38. runs-on: ${{ matrix.os }}
  39. steps:
  40. - uses: actions/checkout@v2
  41. with:
  42. # Fetch the whole tree so git describe works
  43. fetch-depth: 0
  44. submodules: true
  45. - name: Install macos dependencies
  46. if: ${{ matrix.os == 'macos-11' }}
  47. run: |
  48. brew install cmake googletest bash rename libogg libvorbis glew \
  49. openal-soft sdl2 sdl2_image sdl2_ttf freetype harfbuzz \
  50. fribidi glib gtk-doc glbinding libraqm glm zlib
  51. install_name_tool -change \
  52. '@rpath/libsharpyuv.0.dylib' \
  53. /usr/local/opt/webp/lib/libsharpyuv.0.dylib \
  54. /usr/local/opt/webp/lib/libwebp.7.dylib
  55. # Something funky happens with freetype if mono is left
  56. sudo mv /Library/Frameworks/Mono.framework \
  57. /Library/Frameworks/Mono.framework-disabled
  58. - name: Set compiler
  59. run: |
  60. # This ensures for now we use clang11
  61. # Clang12 runs into a bunch of fun with `include location
  62. # '/usr/local/include' is unsafe for cross-compilation` that we don't
  63. # care about for now
  64. echo "CXX=clang++" >> $GITHUB_ENV
  65. echo "CC=clang" >> $GITHUB_ENV
  66. - name: Configure build
  67. env:
  68. BUILD_TYPE: ${{ matrix.build_type }}
  69. GLBINDING: ${{ matrix.glbinding }}
  70. run: |
  71. cmake --version
  72. $CXX --version
  73. mkdir "build"
  74. cd "build"
  75. # TODO add -DGLBINDING_ENABLED=$USE_GLBINDING
  76. cmake .. -DCMAKE_BUILD_TYPE=$BUILD_TYPE $ARCH -DBUILD_TESTS=ON \
  77. -DWARNINGS=ON -DWERROR=ON -DGLBINDING_ENABLED=$GLBINDING \
  78. -DENABLE_DISCORD=ON -DCMAKE_INSTALL_MESSAGE=NEVER \
  79. -DCMAKE_INSTALL_PREFIX=/usr -DINSTALL_SUBDIR_BIN=bin \
  80. -DINSTALL_SUBDIR_SHARE=share/supertux2
  81. - name: Build and install
  82. working-directory: build
  83. run: |
  84. make -j3 VERBOSE=1
  85. make install DESTDIR="/tmp/supertux" VERBOSE=1
  86. - name: Run tests
  87. working-directory: build
  88. run: ./test_supertux2
  89. - name: Package
  90. env:
  91. OS_NAME: ${{ matrix.os }}
  92. ARCH: 64
  93. COMPILER_NAME: ${{ matrix.compiler }}
  94. BUILD_NAME: ${{ matrix.build_type }}
  95. PACKAGE: 'ON'
  96. working-directory: build
  97. run: ../.ci_scripts/package.sh
  98. - uses: actions/upload-artifact@v2
  99. with:
  100. name: "${{ matrix.os }}-${{ matrix.build_type }}${{ matrix.glbinding == 'ON' && '-glbinding' || '' }}-dmg"
  101. path: build/upload/*.dmg
  102. if-no-files-found: ignore
  103. - uses: anshulrgoyal/upload-s3-action@master
  104. if: matrix.release && env.CI_KEY != null
  105. env:
  106. CI_KEY: ${{ secrets.CI_DOWNLOAD_ACCESS_KEY_ID }}
  107. with:
  108. aws_bucket: supertux-ci-downloads
  109. aws_key_id: ${{ secrets.CI_DOWNLOAD_ACCESS_KEY_ID }}
  110. aws_secret_access_key: ${{ secrets.CI_DOWNLOAD_SECRET_ACCESS_KEY }}
  111. source_dir: 'build/upload'
  112. destination_dir: "${{ github.sha }}/gh-actions/${{ matrix.os }}-${{ matrix.arch }}/${{ github.run_id }}"
  113. - name: Post uploaded file
  114. if: matrix.release && env.DOWNLOAD_APIKEY != null
  115. working-directory: build
  116. run: ../.ci_scripts/deploy.sh
  117. env:
  118. PREFIX: "${{ github.sha }}/gh-actions/${{ matrix.os }}-${{ matrix.arch }}/${{ github.run_id }}"
  119. DOWNLOAD_APIKEY: ${{ secrets.DOWNLOAD_APIKEY }}
  120. - name: Prepare Release
  121. if: startsWith(github.ref, 'refs/tags/') && matrix.release && github.repository_owner == 'supertux'
  122. env:
  123. OS: ${{ matrix.os }}
  124. run: |
  125. if [ "$OS" = "macos-11" ]; then
  126. rename 's/.dmg/-11.dmg/' build/upload/SuperTux-*
  127. fi
  128. - name: Create Release
  129. if: startsWith(github.ref, 'refs/tags/') && matrix.release && github.repository_owner == 'supertux'
  130. uses: softprops/action-gh-release@v1
  131. env:
  132. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  133. with:
  134. files: 'build/upload/SuperTux-*'
  135. draft: true