windows.yml 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. name: windows
  2. on: [push, pull_request]
  3. permissions:
  4. contents: read
  5. jobs:
  6. build:
  7. runs-on: ${{matrix.os}}
  8. strategy:
  9. matrix:
  10. # windows-2019 has MSVC 2019 installed;
  11. # windows-2022 has MSVC 2022 installed:
  12. # https://github.com/actions/virtual-environments.
  13. os: [windows-2019]
  14. platform: [Win32, x64]
  15. toolset: [v141, v142]
  16. standard: [14, 17, 20]
  17. shared: ["", -DBUILD_SHARED_LIBS=ON]
  18. build_type: [Debug, Release]
  19. exclude:
  20. - { toolset: v141, standard: 20 }
  21. - { toolset: v142, standard: 14 }
  22. - { platform: Win32, toolset: v141 }
  23. - { platform: Win32, standard: 14 }
  24. - { platform: Win32, standard: 20 }
  25. - { platform: x64, toolset: v141, shared: -DBUILD_SHARED_LIBS=ON }
  26. - { platform: x64, standard: 14, shared: -DBUILD_SHARED_LIBS=ON }
  27. - { platform: x64, standard: 20, shared: -DBUILD_SHARED_LIBS=ON }
  28. include:
  29. - os: windows-2022
  30. platform: x64
  31. toolset: v143
  32. build_type: Debug
  33. standard: 20
  34. steps:
  35. - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
  36. - name: Set timezone
  37. run: tzutil /s "Ekaterinburg Standard Time"
  38. - name: Create Build Environment
  39. run: cmake -E make_directory ${{runner.workspace}}/build
  40. - name: Configure
  41. # Use a bash shell for $GITHUB_WORKSPACE.
  42. shell: bash
  43. working-directory: ${{runner.workspace}}/build
  44. run: |
  45. cmake -A ${{matrix.platform}} -T ${{matrix.toolset}} \
  46. -DCMAKE_CXX_STANDARD=${{matrix.standard}} \
  47. ${{matrix.shared}} -DCMAKE_BUILD_TYPE=${{matrix.build_type}} \
  48. $GITHUB_WORKSPACE
  49. - name: Build
  50. working-directory: ${{runner.workspace}}/build
  51. run: |
  52. $threads = (Get-CimInstance Win32_ComputerSystem).NumberOfLogicalProcessors
  53. cmake --build . --config ${{matrix.build_type}} --parallel $threads
  54. - name: Test
  55. working-directory: ${{runner.workspace}}/build
  56. run: ctest -C ${{matrix.build_type}} -V
  57. env:
  58. CTEST_OUTPUT_ON_FAILURE: True
  59. mingw:
  60. runs-on: windows-latest
  61. defaults:
  62. run:
  63. shell: msys2 {0}
  64. strategy:
  65. matrix:
  66. sys: [ mingw64, ucrt64 ]
  67. steps:
  68. - name: Set timezone
  69. run: tzutil /s "Ekaterinburg Standard Time"
  70. shell: cmd
  71. - uses: msys2/setup-msys2@61f9e5e925871ba6c9e3e8da24ede83ea27fa91f # v2.27.0
  72. with:
  73. release: false
  74. msystem: ${{matrix.sys}}
  75. pacboy: cc:p cmake:p ninja:p lld:p
  76. - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
  77. - name: Configure
  78. run: cmake -B ../build -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Debug
  79. env: { LDFLAGS: -fuse-ld=lld }
  80. - name: Build
  81. run: cmake --build ../build
  82. - name: Test
  83. run: ctest -j `nproc` --test-dir ../build
  84. env:
  85. CTEST_OUTPUT_ON_FAILURE: True