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