windows.yml 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  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: Windows
  18. on:
  19. push:
  20. branches:
  21. - master
  22. tags:
  23. - '*'
  24. pull_request: {}
  25. jobs:
  26. windows:
  27. strategy:
  28. fail-fast: false
  29. matrix:
  30. arch: [x64, x86]
  31. build_type: [Debug, Release]
  32. glbinding: [OFF] # [ON, OFF] # FIXME: Fix Windows glbinding builds
  33. include:
  34. - build_type: Release
  35. arch: x64
  36. glbinding: OFF
  37. release: ON
  38. - build_type: Release
  39. arch: x86
  40. glbinding: OFF
  41. release: ON
  42. runs-on: windows-latest
  43. steps:
  44. - uses: actions/checkout@v2
  45. with:
  46. # Fetch the whole tree so git describe works
  47. fetch-depth: 0
  48. submodules: true
  49. - name: Use cached dependencies
  50. id: cache-dependencies
  51. uses: actions/cache@v3
  52. with:
  53. path: C:/vcpkg/installed
  54. key: ${{ runner.os }}-${{ matrix.arch }}-dependencies-${{ hashFiles('.github/workflows/windows.yml') }}
  55. - name: Install dependencies
  56. if: steps.cache-dependencies.outputs.cache-hit != 'true'
  57. env:
  58. ARCH: ${{ matrix.arch }}
  59. run: |
  60. vcpkg integrate install
  61. vcpkg install gtest:$Env:ARCH-windows
  62. vcpkg install curl:$Env:ARCH-windows
  63. vcpkg install --recurse freetype:$Env:ARCH-windows
  64. vcpkg install glew:$Env:ARCH-windows
  65. vcpkg install glbinding:$Env:ARCH-windows
  66. vcpkg install libogg:$Env:ARCH-windows
  67. vcpkg install libraqm:$Env:ARCH-windows
  68. vcpkg install libvorbis:$Env:ARCH-windows
  69. vcpkg install openal-soft:$Env:ARCH-windows
  70. vcpkg install sdl2:$Env:ARCH-windows
  71. vcpkg install sdl2-image[libjpeg-turbo]:$Env:ARCH-windows
  72. vcpkg install glm:$Env:ARCH-windows
  73. vcpkg install zlib:$Env:ARCH-windows
  74. - name: Configure bulid
  75. env:
  76. ARCH: ${{ matrix.arch }}
  77. BUILD_TYPE: ${{ matrix.build_type }}
  78. GLBINDING: ${{ matrix.glbinding }}
  79. run: |
  80. cmake --version
  81. mkdir build
  82. cd build
  83. cmake .. -G "Visual Studio 17 2022" -A $Env:ARCH.replace("x86", "Win32") "-DGLBINDING_ENABLED=$Env:GLBINDING" -DENABLE_DISCORD=ON -DVCPKG_BUILD=ON -DCMAKE_TOOLCHAIN_FILE=c:/vcpkg/scripts/buildsystems/vcpkg.cmake -DHAVE_SDL=true -DPACKAGE_VCREDIST=true "-DCMAKE_BUILD_TYPE=$Env:BUILD_TYPE" -DBUILD_TESTS=ON
  84. - name: Build and install
  85. working-directory: build
  86. env:
  87. BUILD_TYPE: ${{ matrix.build_type }}
  88. run: |
  89. cmake --build . --config $Env:BUILD_TYPE
  90. - name: Run Tests
  91. working-directory: build
  92. env:
  93. BUILD_TYPE: ${{ matrix.build_type }}
  94. run: |
  95. "./$Env:BUILD_TYPE/run_tests.exe"
  96. - name: Package
  97. working-directory: build
  98. env:
  99. BUILD_TYPE: ${{ matrix.build_type }}
  100. run: |
  101. cpack -C $Env:BUILD_TYPE
  102. mkdir upload
  103. mv *.msi upload/
  104. - uses: actions/upload-artifact@v2
  105. with:
  106. name: "windows-${{ matrix.arch }}-${{ matrix.build_type }}${{ matrix.glbinding == 'ON' && '-glbinding' || '' }}-installer"
  107. path: build/upload/*.msi
  108. if-no-files-found: ignore
  109. - uses: anshulrgoyal/upload-s3-action@master
  110. if: matrix.release && env.CI_KEY != null
  111. env:
  112. CI_KEY: ${{ secrets.CI_DOWNLOAD_ACCESS_KEY_ID }}
  113. with:
  114. aws_bucket: supertux-ci-downloads
  115. aws_key_id: ${{ secrets.CI_DOWNLOAD_ACCESS_KEY_ID }}
  116. aws_secret_access_key: ${{ secrets.CI_DOWNLOAD_SECRET_ACCESS_KEY }}
  117. source_dir: 'build/upload'
  118. destination_dir: "${{ github.sha }}/gh-actions/windows-${{ matrix.arch }}/${{ github.run_id }}"
  119. - name: Post uploaded file
  120. shell: bash
  121. if: matrix.release && env.DOWNLOAD_APIKEY != null
  122. working-directory: build
  123. run: ../.ci_scripts/deploy.sh
  124. env:
  125. PREFIX: "${{ github.sha }}/gh-actions/windows-${{ matrix.arch }}/${{ github.run_id }}"
  126. DOWNLOAD_APIKEY: ${{ secrets.DOWNLOAD_APIKEY }}
  127. IS_WINDOWS: true
  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