other.yml 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. # SuperTux
  2. # Copyright (C) 2021 A. Semphris <semphris@protonmail.com>
  3. #
  4. # This program is free software; you can redistribute it and/or
  5. # modify it under the terms of the GNU General Public License
  6. # as published by the Free Software Foundation; either version 3
  7. # of the License, or (at your option) any later version.
  8. #
  9. # This program is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. # GNU General Public License for more details.
  13. #
  14. # You should have received a copy of the GNU General Public License
  15. # along with this program; if not, write to the Free Software
  16. # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  17. # This is for platforms that aren't officially supported, but for which buils can be interesting
  18. name: Additional platforms
  19. on:
  20. push:
  21. branches:
  22. - master
  23. tags:
  24. - '*'
  25. pull_request: {}
  26. # TODO the glbinding build
  27. jobs:
  28. bsd-solaris:
  29. strategy:
  30. fail-fast: false
  31. matrix:
  32. # TODO: Add the OpenBSD, NetBSD and Solaris VMs whenever possible
  33. vm_os: [freebsd]
  34. build_type: [Debug, Release]
  35. runs-on: macos-latest
  36. steps:
  37. - uses: actions/checkout@v2
  38. with:
  39. # Fetch the whole tree so git describe works
  40. fetch-depth: 0
  41. submodules: true
  42. - name: Build in FreeBSD
  43. if: ${{ matrix.vm_os == 'freebsd' }}
  44. env:
  45. BUILD_TYPE: ${{ matrix.build_type }}
  46. uses: vmactions/freebsd-vm@v0.1.4
  47. with:
  48. envs: 'BUILD_TYPE'
  49. sync: rsync
  50. usesh: true
  51. prepare: |
  52. pkg install -y pkgconf
  53. pkg install -y git
  54. pkg install -y cmake
  55. pkg install -y googletest
  56. pkg install -y sdl2
  57. pkg install -y sdl2_image
  58. pkg install -y openal-soft
  59. pkg install -y glew
  60. pkg install -y boost-all
  61. pkg install -y curl
  62. pkg install -y libogg
  63. pkg install -y libvorbis
  64. pkg install -y freetype
  65. pkg install -y libraqm
  66. pkg install -y glm
  67. run: |
  68. mkdir build && cd build
  69. cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DWARNINGS=ON -DWERROR=ON -DBUILD_TESTS=ON -DCMAKE_INSTALL_MESSAGE=NEVER -DCMAKE_INSTALL_PREFIX=/usr -DINSTALL_SUBDIR_BIN=bin -DINSTALL_SUBDIR_SHARE=share/supertux2
  70. make -j3 VERBOSE=1
  71. make install DESTDIR="/tmp/supertux" VERBOSE=1
  72. ./test_supertux2
  73. clickable:
  74. strategy:
  75. fail-fast: false
  76. matrix:
  77. build_type: [Debug, Release]
  78. arch: [amd64, arm64, armhf]
  79. exclude:
  80. # For some reason, this specific build fails without any error message.
  81. - build_type: Debug
  82. arch: arm64
  83. runs-on: ubuntu-20.04
  84. steps:
  85. - uses: actions/checkout@v2
  86. with:
  87. # Fetch the whole tree so git describe works
  88. fetch-depth: 0
  89. submodules: true
  90. - name: Install clickable
  91. run: |
  92. # For whatever reason, I have to manually install runc before docker.io or containerd, else it fails because of broken dependency
  93. # Using apt-get because apt complains it shouldn't be used in scripts
  94. sudo apt-get update
  95. sudo apt-get install -y runc
  96. sudo apt-get install -y docker.io adb git python3 python3-pip
  97. pip3 install --user git+https://gitlab.com/clickable/clickable.git@master
  98. # Clickable requires a reboot/logout. This is a sneaky way to bypass that :^)
  99. sudo systemctl unmask docker.service
  100. sudo systemctl start docker.service
  101. - name: Build
  102. env:
  103. BUILD_TYPE: ${{ (matrix.build_type == 'Debug') && '--debug' || '' }}
  104. ARCH: ${{ matrix.arch }}
  105. run: ~/.local/bin/clickable build --verbose ${BUILD_TYPE} --arch ${ARCH} --config mk/clickable/clickable.json
  106. - uses: actions/upload-artifact@v2
  107. with:
  108. name: "clickable-${{ matrix.arch }}-${{ matrix.build_type }}-click"
  109. path: build.clickable/*.click
  110. if-no-files-found: ignore
  111. - name: Publish to Open Store
  112. if: ${{ github.ref == 'refs/heads/master' && matrix.build_type == 'Release' }}
  113. env:
  114. ARCH: ${{ matrix.arch }}
  115. OPENSTORE_KEY: ${{ secrets.OPENSTORE_KEY }}
  116. run: ~/.local/bin/clickable publish "* $(git log -1 --pretty=%B | head -1)" --apikey ${OPENSTORE_KEY} --config mk/clickable/clickable.json --arch ${ARCH}
  117. wasm:
  118. strategy:
  119. fail-fast: false
  120. matrix:
  121. build_type: ["Release", "Debug"]
  122. runs-on: ubuntu-20.04
  123. steps:
  124. - uses: actions/checkout@v2
  125. with:
  126. # Fetch the whole tree so git describe works
  127. fetch-depth: 0
  128. submodules: true
  129. - name: Install emscripten tools
  130. run: |
  131. cd ~
  132. sudo apt-get update
  133. sudo apt-get install -y git cmake build-essential curl zip
  134. git clone https://github.com/emscripten-core/emsdk.git
  135. cd emsdk
  136. ./emsdk install 1.40.1
  137. ./emsdk activate 1.40.1
  138. # Fixes a bug in emscripten - see https://github.com/emscripten-core/emscripten/issues/13590
  139. sed -i "s/\#define MALLOC_ALIGNMENT ((size_t)(2 \* sizeof(void \*)))/#define MALLOC_ALIGNMENT 16/g" upstream/emscripten/system/lib/dlmalloc.c
  140. # Fixes a bug with the libjpeg port - see https://github.com/emscripten-core/emscripten/pull/13878
  141. sed -i 's/2b581c60ae401a79bbbe748ff2deeda5acd50bfd2ea22e5926e36d34b9ebcffb6580b0ff48e972c1441583e30e21e1ea821ca0423f9c67ce08a31dffabdbe6b7/b2affe9a1688bd49fc033f4682c4a242d4ee612f1affaef532f5adcb4602efc4433c4a52a4b3d69e7440ff1f6413b1b041b419bc90efd6d697999961a9a6afb7/g' upstream/emscripten/tools/ports/libjpeg.py
  142. sed -i 's/https:\/\/dl.bintray.com\/homebrew\/mirror\/jpeg-9c.tar.gz/https:\/\/storage.googleapis.com\/webassembly\/emscripten-ports\/jpegsrc.v9c.tar.gz/g' upstream/emscripten/tools/ports/libjpeg.py
  143. - name: Install vcpkg and dependencies
  144. run: |
  145. source ~/emsdk/emsdk_env.sh
  146. cd ~
  147. git clone https://github.com/microsoft/vcpkg
  148. ./vcpkg/bootstrap-vcpkg.sh
  149. ./vcpkg/vcpkg integrate install
  150. ./vcpkg/vcpkg install boost-date-time:wasm32-emscripten
  151. ./vcpkg/vcpkg install boost-filesystem:wasm32-emscripten
  152. ./vcpkg/vcpkg install boost-format:wasm32-emscripten
  153. ./vcpkg/vcpkg install boost-locale:wasm32-emscripten
  154. ./vcpkg/vcpkg install boost-optional:wasm32-emscripten
  155. ./vcpkg/vcpkg install boost-system:wasm32-emscripten
  156. ./vcpkg/vcpkg install glbinding:wasm32-emscripten
  157. ./vcpkg/vcpkg install libpng:wasm32-emscripten
  158. ./vcpkg/vcpkg install libogg:wasm32-emscripten
  159. ./vcpkg/vcpkg install libvorbis:wasm32-emscripten
  160. ./vcpkg/vcpkg install glm:wasm32-emscripten
  161. ./vcpkg/vcpkg install zlib:wasm32-emscripten
  162. - name: Patch SDL_ttf
  163. working-directory: external/SDL_ttf
  164. run: git apply ../../mk/emscripten/SDL_ttf.patch
  165. - name: Build
  166. env:
  167. BUILD_TYPE: ${{ matrix.build_type }}
  168. run: |
  169. source ~/emsdk/emsdk_env.sh
  170. mkdir build
  171. cd build
  172. # TODO: Add -DWARNINGS=ON -DWERROR=ON (when the warnings will be fixed)
  173. emcmake cmake -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DENABLE_OPENGLES2=ON -DCMAKE_TOOLCHAIN_FILE=~/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=wasm32-emscripten -DGLBINDING_ENABLED=ON -DEMSCRIPTEN=1 -DWARNINGS=ON -DWERROR=ON ..
  174. rsync -aP ../data/ data/
  175. emmake make -j$(nproc)
  176. rm supertux2.html && cp template.html supertux2.html
  177. mkdir upload/
  178. mv supertux2* upload/
  179. # Now you can run a local server with: `emrun supertux2.html`
  180. # Or any traditional web server will do the job
  181. # Note: opening the html file manually (file:///) won't work
  182. - uses: actions/upload-artifact@v2
  183. with:
  184. name: "wasm32-emscripten-${{ matrix.build_type }}-html"
  185. path: build/upload/*
  186. if-no-files-found: ignore
  187. - name: Upload to server
  188. if: ${{ github.ref == 'refs/heads/master' && matrix.build_type == 'Release' }}
  189. env:
  190. UPLOAD_URL: ${{ secrets.UPLOAD_URL }}
  191. run: |
  192. cd build/upload/
  193. mv supertux2.html index.html
  194. zip supertux2.zip *
  195. curl -F "archive=@$(pwd)/supertux2.zip" -F "message=$(git log --format=%B -n 1 | head -1)" $UPLOAD_URL