1name: build-and-test 2 3on: 4 push: 5 branches: [ main ] 6 pull_request: 7 branches: [ main ] 8 9jobs: 10 # TODO: add 32-bit builds (g++ and clang++) for ubuntu 11 # (requires g++-multilib and libc6:i386) 12 # TODO: add coverage build (requires lcov) 13 # TODO: add clang + libc++ builds for ubuntu 14 job: 15 name: ${{ matrix.os }}.${{ matrix.build_type }}.${{ matrix.lib }}.${{ matrix.compiler }} 16 runs-on: ${{ matrix.os }} 17 strategy: 18 fail-fast: false 19 matrix: 20 os: [ubuntu-22.04, ubuntu-20.04, macos-latest] 21 build_type: ['Release', 'Debug'] 22 compiler: ['g++', 'clang++'] 23 lib: ['shared', 'static'] 24 25 steps: 26 - uses: actions/checkout@v3 27 28 - uses: lukka/get-cmake@latest 29 30 - name: create build environment 31 run: cmake -E make_directory ${{ runner.workspace }}/_build 32 33 - name: setup cmake initial cache 34 run: touch compiler-cache.cmake 35 36 - name: configure cmake 37 env: 38 CXX: ${{ matrix.compiler }} 39 shell: bash 40 working-directory: ${{ runner.workspace }}/_build 41 run: > 42 cmake -C ${{ github.workspace }}/compiler-cache.cmake 43 $GITHUB_WORKSPACE 44 -DBENCHMARK_DOWNLOAD_DEPENDENCIES=ON 45 -DBUILD_SHARED_LIBS=${{ matrix.lib == 'shared' }} 46 -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} 47 -DCMAKE_CXX_COMPILER=${{ env.CXX }} 48 -DCMAKE_CXX_VISIBILITY_PRESET=hidden 49 -DCMAKE_VISIBILITY_INLINES_HIDDEN=ON 50 51 - name: build 52 shell: bash 53 working-directory: ${{ runner.workspace }}/_build 54 run: cmake --build . --config ${{ matrix.build_type }} 55 56 - name: test 57 shell: bash 58 working-directory: ${{ runner.workspace }}/_build 59 run: ctest -C ${{ matrix.build_type }} -VV 60 61 msvc: 62 name: ${{ matrix.os }}.${{ matrix.build_type }}.${{ matrix.lib }}.${{ matrix.msvc }} 63 runs-on: ${{ matrix.os }} 64 defaults: 65 run: 66 shell: powershell 67 strategy: 68 fail-fast: false 69 matrix: 70 msvc: 71 - VS-16-2019 72 - VS-17-2022 73 arch: 74 - x64 75 build_type: 76 - Debug 77 - Release 78 lib: 79 - shared 80 - static 81 include: 82 - msvc: VS-16-2019 83 os: windows-2019 84 generator: 'Visual Studio 16 2019' 85 - msvc: VS-17-2022 86 os: windows-2022 87 generator: 'Visual Studio 17 2022' 88 89 steps: 90 - uses: actions/checkout@v2 91 92 - uses: lukka/get-cmake@latest 93 94 - name: configure cmake 95 run: > 96 cmake -S . -B _build/ 97 -A ${{ matrix.arch }} 98 -G "${{ matrix.generator }}" 99 -DBENCHMARK_DOWNLOAD_DEPENDENCIES=ON 100 -DBUILD_SHARED_LIBS=${{ matrix.lib == 'shared' }} 101 102 - name: build 103 run: cmake --build _build/ --config ${{ matrix.build_type }} 104 105 - name: test 106 run: ctest --test-dir _build/ -C ${{ matrix.build_type }} -VV 107 108 msys2: 109 name: ${{ matrix.os }}.${{ matrix.build_type }}.${{ matrix.lib }}.${{ matrix.msys2.msystem }} 110 runs-on: ${{ matrix.os }} 111 defaults: 112 run: 113 shell: msys2 {0} 114 strategy: 115 fail-fast: false 116 matrix: 117 os: [ windows-latest ] 118 msys2: 119 - { msystem: MINGW64, arch: x86_64, family: GNU, compiler: g++ } 120 - { msystem: MINGW32, arch: i686, family: GNU, compiler: g++ } 121 - { msystem: CLANG64, arch: x86_64, family: LLVM, compiler: clang++ } 122 - { msystem: CLANG32, arch: i686, family: LLVM, compiler: clang++ } 123 - { msystem: UCRT64, arch: x86_64, family: GNU, compiler: g++ } 124 build_type: 125 - Debug 126 - Release 127 lib: 128 - shared 129 - static 130 131 steps: 132 - uses: actions/checkout@v2 133 134 - name: Install Base Dependencies 135 uses: msys2/setup-msys2@v2 136 with: 137 cache: false 138 msystem: ${{ matrix.msys2.msystem }} 139 update: true 140 install: >- 141 git 142 base-devel 143 pacboy: >- 144 cc:p 145 cmake:p 146 ninja:p 147 148 - name: configure cmake 149 env: 150 CXX: ${{ matrix.msys2.compiler }} 151 run: > 152 cmake -S . -B _build/ 153 -GNinja 154 -DBENCHMARK_DOWNLOAD_DEPENDENCIES=ON 155 -DBUILD_SHARED_LIBS=${{ matrix.lib == 'shared' }} 156 157 - name: build 158 run: cmake --build _build/ --config ${{ matrix.build_type }} 159 160 - name: test 161 run: ctest --test-dir _build/ -C ${{ matrix.build_type }} -VV 162