test.yml 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. name: Test
  2. on: [ push, pull_request, workflow_dispatch ]
  3. jobs:
  4. test:
  5. name: ${{ matrix.os }}, ${{ matrix.cmake_name }}
  6. strategy:
  7. fail-fast: false
  8. matrix:
  9. os: [ windows-2019, macos-latest, ubuntu-20.04 ]
  10. cmake: [ 3.15, 3.x ]
  11. include:
  12. - os: windows-2019
  13. static_postfix: _static
  14. tree: tree /F
  15. CXX: cl
  16. - os: ubuntu-20.04
  17. tree: tree
  18. - os: macos-latest
  19. tree: find
  20. - cmake: 3.15
  21. cmake_name: CMake 3.15
  22. - cmake: 3.x
  23. cmake_name: Latest CMake
  24. env:
  25. # CMake 3.15 doesn't detect Visual Studio correctly without these.
  26. CXX: ${{ matrix.CXX }}
  27. CC: ${{ matrix.CXX }}
  28. runs-on: ${{ matrix.os }}
  29. steps:
  30. # System set-up
  31. - uses: actions/checkout@v2
  32. - uses: ilammy/msvc-dev-cmd@v1
  33. - uses: seanmiddleditch/gha-setup-ninja@master
  34. - uses: jwlawson/[email protected]
  35. with:
  36. cmake-version: ${{ matrix.cmake }}
  37. # Static Debug
  38. - name: "Static Debug: Configure"
  39. run: cmake -G Ninja -S . -B build-static-dbg -DCMAKE_BUILD_TYPE=Debug "-DCMAKE_DEBUG_POSTFIX=d${{matrix.static_postfix}}"
  40. - name: "Static Debug: Build"
  41. run: cmake --build build-static-dbg
  42. - name: "Static Debug: Test"
  43. run: ctest --output-on-failure
  44. working-directory: build-static-dbg
  45. # Shared Debug
  46. - name: "Shared Debug: Configure"
  47. run: cmake -G Ninja -S . -B build-shared-dbg -DCMAKE_BUILD_TYPE=Debug -DCMAKE_DEBUG_POSTFIX=d -DBUILD_SHARED_LIBS=ON
  48. - name: "Shared Debug: Build"
  49. run: cmake --build build-shared-dbg
  50. - name: "Shared Debug: Test"
  51. run: ctest --output-on-failure
  52. working-directory: build-shared-dbg
  53. # Static Release
  54. - name: "Static Release: Configure"
  55. run: cmake -G Ninja -S . -B build-static-rel -DCMAKE_BUILD_TYPE=Release "-DCMAKE_RELEASE_POSTFIX=${{matrix.static_postfix}}"
  56. - name: "Static Release: Build"
  57. run: cmake --build build-static-rel
  58. - name: "Static Release: Test"
  59. run: ctest --output-on-failure
  60. working-directory: build-static-rel
  61. # Shared Release
  62. - name: "Shared Release: Configure"
  63. run: cmake -G Ninja -S . -B build-shared-rel -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON
  64. - name: "Shared Release: Build"
  65. run: cmake --build build-shared-rel
  66. - name: "Shared Release: Test"
  67. run: ctest --output-on-failure
  68. working-directory: build-shared-rel
  69. # Joint install
  70. - name: Install
  71. run: |
  72. cmake --install build-shared-dbg --prefix install
  73. cmake --install build-static-dbg --prefix install
  74. cmake --install build-shared-rel --prefix install
  75. cmake --install build-static-rel --prefix install
  76. - name: List install tree
  77. run: ${{matrix.tree}} install
  78. # Test find_package
  79. - name: "Test find_package: Static Debug"
  80. run: >-
  81. ctest --build-and-test test test-static-dbg
  82. --build-generator Ninja
  83. --build-options -DCMAKE_BUILD_TYPE=Debug -Dtinyxml2_SHARED_LIBS=NO -DCMAKE_PREFIX_PATH=${{github.workspace}}/install
  84. --test-command ctest --output-on-failure
  85. - name: "Test find_package: Static Release"
  86. run: >-
  87. ctest --build-and-test test test-static-rel
  88. --build-generator Ninja
  89. --build-options -DCMAKE_BUILD_TYPE=Release -Dtinyxml2_SHARED_LIBS=NO -DCMAKE_PREFIX_PATH=${{github.workspace}}/install
  90. --test-command ctest --output-on-failure
  91. - name: "Test find_package: Shared Debug"
  92. run: >-
  93. ctest --build-and-test test test-shared-dbg
  94. --build-generator Ninja
  95. --build-options -DCMAKE_BUILD_TYPE=Debug -Dtinyxml2_SHARED_LIBS=YES -DCMAKE_PREFIX_PATH=${{github.workspace}}/install
  96. --test-command ctest --output-on-failure
  97. - name: "Test find_package: Shared Release"
  98. run: >-
  99. ctest --build-and-test test test-shared-rel
  100. --build-generator Ninja
  101. --build-options -DCMAKE_BUILD_TYPE=Release -Dtinyxml2_SHARED_LIBS=YES -DCMAKE_PREFIX_PATH=${{github.workspace}}/install
  102. --test-command ctest --output-on-failure