|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main, master] |
| 6 | + pull_request: |
| 7 | + branches: [main, master] |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | +env: |
| 11 | + CTEST_TIMEOUT: 120 |
| 12 | + CLANG_VERSION: "20" |
| 13 | + |
| 14 | +jobs: |
| 15 | + build-and-test: |
| 16 | + name: Build & Test (${{ matrix.os }}, C++${{ matrix.cxx_standard }}) |
| 17 | + runs-on: ${{ matrix.os }} |
| 18 | + |
| 19 | + strategy: |
| 20 | + fail-fast: false |
| 21 | + matrix: |
| 22 | + os: [ubuntu-22.04, ubuntu-24.04] |
| 23 | + cxx_standard: [17, 20] |
| 24 | + |
| 25 | + steps: |
| 26 | + - name: Checkout code |
| 27 | + uses: actions/checkout@v4 |
| 28 | + |
| 29 | + - name: Install dependencies |
| 30 | + uses: ./.github/actions/install-dependencies |
| 31 | + |
| 32 | + - name: Setup Clang |
| 33 | + uses: ./.github/actions/setup-clang |
| 34 | + with: |
| 35 | + clang-version: ${{ env.CLANG_VERSION }} |
| 36 | + |
| 37 | + - name: Build |
| 38 | + run: | |
| 39 | + CMAKE_CXX_STANDARD=${{ matrix.cxx_standard }} \ |
| 40 | + CMAKE_C_COMPILER=clang-${{ env.CLANG_VERSION }} \ |
| 41 | + CMAKE_CXX_COMPILER=clang++-${{ env.CLANG_VERSION }} \ |
| 42 | + make debug |
| 43 | +
|
| 44 | + - name: Run tests |
| 45 | + run: | |
| 46 | + cd ${{github.workspace}}/build |
| 47 | + xvfb-run -a --server-args="-screen 0 1024x768x24 -ac +extension GLX +render -noreset" ctest --output-on-failure --verbose --timeout ${{ env.CTEST_TIMEOUT }} |
| 48 | +
|
| 49 | + - name: Upload test results |
| 50 | + if: always() |
| 51 | + uses: actions/upload-artifact@v4 |
| 52 | + with: |
| 53 | + name: test-results-${{ matrix.os }}-cpp${{ matrix.cxx_standard }} |
| 54 | + path: | |
| 55 | + ${{github.workspace}}/build/Testing/ |
| 56 | + ${{github.workspace}}/build/test/ |
| 57 | +
|
| 58 | + sanitizer-analysis: |
| 59 | + name: Sanitizer Analysis (${{ matrix.sanitizer }}) |
| 60 | + runs-on: ubuntu-24.04 |
| 61 | + |
| 62 | + strategy: |
| 63 | + fail-fast: false |
| 64 | + matrix: |
| 65 | + sanitizer: [asan, tsan] |
| 66 | + |
| 67 | + steps: |
| 68 | + - name: Checkout code |
| 69 | + uses: actions/checkout@v4 |
| 70 | + |
| 71 | + - name: Install dependencies |
| 72 | + uses: ./.github/actions/install-dependencies |
| 73 | + |
| 74 | + - name: Setup Clang |
| 75 | + uses: ./.github/actions/setup-clang |
| 76 | + with: |
| 77 | + clang-version: ${{ env.CLANG_VERSION }} |
| 78 | + |
| 79 | + - name: Build with sanitizer |
| 80 | + run: | |
| 81 | + CMAKE_C_COMPILER=clang-${{ env.CLANG_VERSION }} \ |
| 82 | + CMAKE_CXX_COMPILER=clang++-${{ env.CLANG_VERSION }} \ |
| 83 | + make ${{ matrix.sanitizer }} |
| 84 | +
|
| 85 | + - name: Run tests with sanitizer |
| 86 | + run: | |
| 87 | + build_dir="build-${{ matrix.sanitizer }}" |
| 88 | + cd $build_dir |
| 89 | + # Set sanitizer options |
| 90 | + if [ "${{ matrix.sanitizer }}" = "asan" ]; then |
| 91 | + export ASAN_OPTIONS="detect_leaks=1:abort_on_error=1" |
| 92 | + elif [ "${{ matrix.sanitizer }}" = "tsan" ]; then |
| 93 | + export TSAN_OPTIONS="abort_on_error=1" |
| 94 | + fi |
| 95 | + xvfb-run -a --server-args="-screen 0 1024x768x24 -ac +extension GLX +render -noreset" ctest --output-on-failure --verbose --timeout ${{ env.CTEST_TIMEOUT }} |
| 96 | +
|
| 97 | + - name: Upload sanitizer results |
| 98 | + if: always() |
| 99 | + uses: actions/upload-artifact@v4 |
| 100 | + with: |
| 101 | + name: sanitizer-results-${{ matrix.sanitizer }} |
| 102 | + path: | |
| 103 | + build-${{ matrix.sanitizer }}/Testing/ |
| 104 | + build-${{ matrix.sanitizer }}/test/ |
| 105 | +
|
| 106 | + coverage-analysis: |
| 107 | + name: Coverage Analysis |
| 108 | + runs-on: ubuntu-22.04 |
| 109 | + |
| 110 | + steps: |
| 111 | + - name: Checkout code |
| 112 | + uses: actions/checkout@v4 |
| 113 | + |
| 114 | + - name: Install dependencies |
| 115 | + uses: ./.github/actions/install-dependencies |
| 116 | + |
| 117 | + - name: Generate coverage report |
| 118 | + run: | |
| 119 | + xvfb-run -a --server-args="-screen 0 1024x768x24 -ac +extension GLX +render -noreset" make coverage |
| 120 | +
|
| 121 | + - name: Upload coverage to Codecov |
| 122 | + uses: codecov/codecov-action@v4 |
| 123 | + with: |
| 124 | + file: ./build-coverage/coverage_filtered.info |
| 125 | + fail_ci_if_error: true |
| 126 | + |
| 127 | + - name: Upload HTML coverage reports |
| 128 | + uses: actions/upload-artifact@v4 |
| 129 | + with: |
| 130 | + name: coverage-report |
| 131 | + path: | |
| 132 | + build-coverage/coverage_filtered.info |
| 133 | + coverage/ |
0 commit comments