windows.yml 4.2 KB

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