2
0

windows.yml 4.2 KB

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