windows.yml 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  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. mingw:
  30. name: "MinGW cross-compiler (${{ matrix.bits }}-bit)"
  31. runs-on: ubuntu-22.04
  32. strategy:
  33. fail-fast: false
  34. matrix:
  35. bits: [32, 64]
  36. steps:
  37. - uses: actions/checkout@v4
  38. - name: Install compiler
  39. run: |
  40. sudo dpkg --add-architecture i386
  41. sudo apt-get update
  42. sudo apt-get install -y --no-install-recommends gettext wine wine${{ matrix.bits }}
  43. sudo ./util/buildbot/download_toolchain.sh /usr
  44. - name: Build
  45. run: |
  46. EXISTING_MINETEST_DIR=$PWD \
  47. ./util/buildbot/buildwin${{ matrix.bits }}.sh B
  48. # Check that the resulting binary can run (DLLs etc.)
  49. - name: Runtime test
  50. run: |
  51. dest=$(mktemp -d)
  52. unzip -q -d "$dest" B/build/*.zip
  53. cd "$dest"/minetest-*-win*
  54. wine bin/minetest.exe --version
  55. - uses: actions/upload-artifact@v4
  56. with:
  57. name: "mingw${{ matrix.bits }}"
  58. path: B/build/*.zip
  59. if-no-files-found: error
  60. msvc:
  61. name: VS 2019 ${{ matrix.config.arch }}-${{ matrix.type }}
  62. runs-on: windows-2019
  63. env:
  64. VCPKG_VERSION: 8eb57355a4ffb410a2e94c07b4dca2dffbee8e50
  65. # 2023.10.19
  66. vcpkg_packages: zlib zstd curl[winssl] openal-soft libvorbis libogg libjpeg-turbo sqlite3 freetype luajit gmp jsoncpp sdl2
  67. strategy:
  68. fail-fast: false
  69. matrix:
  70. config:
  71. - {
  72. arch: x86,
  73. generator: "-G'Visual Studio 16 2019' -A Win32",
  74. vcpkg_triplet: x86-windows
  75. }
  76. - {
  77. arch: x64,
  78. generator: "-G'Visual Studio 16 2019' -A x64",
  79. vcpkg_triplet: x64-windows
  80. }
  81. type: [portable]
  82. # type: [portable, installer]
  83. # The installer type is working, but disabled, to save runner jobs.
  84. # Enable it, when working on the installer.
  85. steps:
  86. - uses: actions/checkout@v4
  87. # Workaround for regression, see https://github.com/minetest/minetest/pull/14536
  88. - name: Pin CMake to 3.28
  89. uses: lukka/get-cmake@latest
  90. with:
  91. cmakeVersion: "~3.28.0"
  92. - name: Restore from cache and run vcpkg
  93. uses: lukka/run-vcpkg@v7
  94. with:
  95. vcpkgArguments: ${{env.vcpkg_packages}}
  96. vcpkgDirectory: '${{ github.workspace }}\vcpkg'
  97. appendedCacheKey: ${{ matrix.config.vcpkg_triplet }}
  98. vcpkgGitCommitId: ${{ env.VCPKG_VERSION }}
  99. vcpkgTriplet: ${{ matrix.config.vcpkg_triplet }}
  100. - name: Minetest CMake
  101. run: |
  102. cmake ${{matrix.config.generator}} `
  103. -DCMAKE_TOOLCHAIN_FILE="${{ github.workspace }}\vcpkg\scripts\buildsystems\vcpkg.cmake" `
  104. -DCMAKE_BUILD_TYPE=Release `
  105. -DENABLE_POSTGRESQL=OFF `
  106. -DENABLE_LUAJIT=TRUE `
  107. -DREQUIRE_LUAJIT=TRUE `
  108. -DRUN_IN_PLACE=${{ contains(matrix.type, 'portable') }} .
  109. - name: Build Minetest
  110. run: cmake --build . --config Release
  111. - name: Unittests
  112. # need this workaround for stdout to work
  113. run: |
  114. $proc = start .\bin\Release\minetest.exe --run-unittests -NoNewWindow -Wait -PassThru
  115. exit $proc.ExitCode
  116. continue-on-error: true # FIXME!!
  117. - name: CPack
  118. run: |
  119. If ($env:TYPE -eq "installer")
  120. {
  121. cpack -G WIX -B "$env:GITHUB_WORKSPACE\Package"
  122. }
  123. ElseIf($env:TYPE -eq "portable")
  124. {
  125. cpack -G ZIP -B "$env:GITHUB_WORKSPACE\Package"
  126. }
  127. rm -r $env:GITHUB_WORKSPACE\Package\_CPack_Packages
  128. env:
  129. TYPE: ${{matrix.type}}
  130. - uses: actions/upload-artifact@v4
  131. with:
  132. name: msvc-${{ matrix.config.arch }}-${{ matrix.type }}
  133. path: .\Package\
  134. if-no-files-found: error