windows.yml 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. name: windows
  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. - '**/CMakeLists.txt'
  13. - 'cmake/Modules/**'
  14. - 'util/buildbot/**'
  15. - 'misc/*.manifest'
  16. - '.github/workflows/windows.yml'
  17. pull_request:
  18. paths:
  19. - 'lib/**.[ch]'
  20. - 'lib/**.cpp'
  21. - 'src/**.[ch]'
  22. - 'src/**.cpp'
  23. - '**/CMakeLists.txt'
  24. - 'cmake/Modules/**'
  25. - 'util/buildbot/**'
  26. - 'misc/*.manifest'
  27. - '.github/workflows/windows.yml'
  28. jobs:
  29. mingw32:
  30. name: "MinGW cross-compiler (32-bit)"
  31. runs-on: ubuntu-22.04
  32. steps:
  33. - uses: actions/checkout@v4
  34. - name: Install compiler
  35. run: |
  36. sudo apt-get update && sudo apt-get install -y gettext
  37. sudo ./util/buildbot/download_toolchain.sh /usr
  38. - name: Build
  39. run: |
  40. EXISTING_MINETEST_DIR=$PWD ./util/buildbot/buildwin32.sh B
  41. - uses: actions/upload-artifact@v4
  42. with:
  43. name: mingw32
  44. path: B/build/*.zip
  45. if-no-files-found: error
  46. mingw64:
  47. name: "MinGW cross-compiler (64-bit)"
  48. runs-on: ubuntu-22.04
  49. steps:
  50. - uses: actions/checkout@v4
  51. - name: Install compiler
  52. run: |
  53. sudo apt-get update && sudo apt-get install -y gettext
  54. sudo ./util/buildbot/download_toolchain.sh /usr
  55. - name: Build
  56. run: |
  57. EXISTING_MINETEST_DIR=$PWD ./util/buildbot/buildwin64.sh B
  58. - uses: actions/upload-artifact@v4
  59. with:
  60. name: mingw64
  61. path: B/build/*.zip
  62. if-no-files-found: error
  63. msvc:
  64. name: VS 2019 ${{ matrix.config.arch }}-${{ matrix.type }}
  65. runs-on: windows-2019
  66. env:
  67. VCPKG_VERSION: 8eb57355a4ffb410a2e94c07b4dca2dffbee8e50
  68. # 2023.10.19
  69. vcpkg_packages: zlib zstd curl[winssl] openal-soft libvorbis libogg libjpeg-turbo sqlite3 freetype luajit gmp jsoncpp sdl2
  70. strategy:
  71. fail-fast: false
  72. matrix:
  73. config:
  74. - {
  75. arch: x86,
  76. generator: "-G'Visual Studio 16 2019' -A Win32",
  77. vcpkg_triplet: x86-windows
  78. }
  79. - {
  80. arch: x64,
  81. generator: "-G'Visual Studio 16 2019' -A x64",
  82. vcpkg_triplet: x64-windows
  83. }
  84. type: [portable]
  85. # type: [portable, installer]
  86. # The installer type is working, but disabled, to save runner jobs.
  87. # Enable it, when working on the installer.
  88. steps:
  89. - uses: actions/checkout@v4
  90. - name: Restore from cache and run vcpkg
  91. uses: lukka/run-vcpkg@v7
  92. with:
  93. vcpkgArguments: ${{env.vcpkg_packages}}
  94. vcpkgDirectory: '${{ github.workspace }}\vcpkg'
  95. appendedCacheKey: ${{ matrix.config.vcpkg_triplet }}
  96. vcpkgGitCommitId: ${{ env.VCPKG_VERSION }}
  97. vcpkgTriplet: ${{ matrix.config.vcpkg_triplet }}
  98. - name: Minetest CMake
  99. run: |
  100. cmake ${{matrix.config.generator}} `
  101. -DCMAKE_TOOLCHAIN_FILE="${{ github.workspace }}\vcpkg\scripts\buildsystems\vcpkg.cmake" `
  102. -DCMAKE_BUILD_TYPE=Release `
  103. -DENABLE_POSTGRESQL=OFF `
  104. -DENABLE_LUAJIT=TRUE `
  105. -DREQUIRE_LUAJIT=TRUE `
  106. -DRUN_IN_PLACE=${{ contains(matrix.type, 'portable') }} .
  107. - name: Build Minetest
  108. run: cmake --build . --config Release
  109. - name: Unittests
  110. # need this workaround for stdout to work
  111. run: |
  112. $proc = start .\bin\Release\minetest.exe --run-unittests -NoNewWindow -Wait -PassThru
  113. exit $proc.ExitCode
  114. continue-on-error: true # FIXME!!
  115. - name: CPack
  116. run: |
  117. If ($env:TYPE -eq "installer")
  118. {
  119. cpack -G WIX -B "$env:GITHUB_WORKSPACE\Package"
  120. }
  121. ElseIf($env:TYPE -eq "portable")
  122. {
  123. cpack -G ZIP -B "$env:GITHUB_WORKSPACE\Package"
  124. }
  125. rm -r $env:GITHUB_WORKSPACE\Package\_CPack_Packages
  126. env:
  127. TYPE: ${{matrix.type}}
  128. - uses: actions/upload-artifact@v4
  129. with:
  130. name: msvc-${{ matrix.config.arch }}-${{ matrix.type }}
  131. path: .\Package\
  132. if-no-files-found: error