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