build-linux.yml (1426B)
1 name: Build on Linux 2 on: 3 push: 4 branches: [ "**" ] 5 pull_request: 6 branches: [ "**" ] 7 jobs: 8 build: 9 runs-on: ${{ matrix.os }} 10 strategy: 11 fail-fast: false 12 matrix: 13 os: [ubuntu-22.04, ubuntu-20.04] 14 build_type: [Release] 15 c_compiler: [gcc, clang] 16 sanitizers: [address, OFF] 17 steps: 18 - uses: actions/checkout@v3 19 - name: Set reusable strings 20 id: strings 21 shell: bash 22 run: | 23 echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" 24 - name: Configure CMake 25 run: > 26 cmake -B ${{ steps.strings.outputs.build-output-dir }} 27 -DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} 28 -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} 29 -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} 30 -DENABLE_TESTS=1 31 -DENABLE_COVERAGE=1 32 -DENABLE_SANITIZER=${{ matrix.sanitizers }} 33 -S ${{ github.workspace }} 34 - name: Build 35 run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} 36 - name: Test 37 working-directory: ${{ steps.strings.outputs.build-output-dir }} 38 run: ctest --build-config ${{ matrix.build_type }} 39 - name: Coverage 40 if: ${{ matrix.c_compiler == 'gcc' && matrix.sanitizers == 'OFF' }} 41 working-directory: ${{ steps.strings.outputs.build-output-dir }} 42 run: bash <(curl -s https://codecov.io/bash)