CI #153
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| schedule: | |
| - cron: "17 3 * * 4" | |
| permissions: | |
| contents: read | |
| jobs: | |
| build: | |
| name: Build | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| preset: | |
| - Clang | |
| - GCC | |
| - MSVC | |
| build_type: | |
| - Debug | |
| - Release | |
| sanitizer: | |
| - "" | |
| - ASan | |
| #- Tsan | |
| - UBSan | |
| include: | |
| - preset: Clang | |
| os: ubuntu-latest | |
| - preset: GCC | |
| os: ubuntu-latest | |
| - preset: MSVC | |
| os: windows-latest | |
| - preset: Clang | |
| build_type: Debug | |
| sanitizer: "" | |
| report: true | |
| exclude: | |
| - preset: MSVC | |
| sanitizer: ASan | |
| - preset: MSVC | |
| sanitizer: UBSan | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: actions/github-script@v8 | |
| id: strings | |
| with: | |
| script: | | |
| const path = require("path"); | |
| const workspace = process.env.GITHUB_WORKSPACE; | |
| const preset = "${{ matrix.preset }}"; | |
| const sanitizer = "${{ matrix.sanitizer }}"; | |
| const report = "${{ matrix.report }}"; | |
| core.setOutput("build-output-dir", path.join(workspace, "build")); | |
| core.setOutput("preset", preset.toLowerCase()); | |
| core.setOutput("sanitizer", sanitizer ? `-DCOROFX_ENABLE_${sanitizer.toUpperCase()}=ON` : ""); | |
| core.setOutput("coverage", report ? "-DCOROFX_ENABLE_COVERAGE=ON" : ""); | |
| - name: Configure CMake | |
| run: > | |
| cmake | |
| -L | |
| -S ${{ github.workspace }} | |
| -B ${{ steps.strings.outputs.build-output-dir }} | |
| --preset=${{ steps.strings.outputs.preset }} | |
| -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} | |
| ${{ steps.strings.outputs.sanitizer }} | |
| ${{ steps.strings.outputs.coverage }} | |
| - name: Build | |
| run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} | |
| - name: Test | |
| working-directory: ${{ steps.strings.outputs.build-output-dir }} | |
| run: ctest --build-config ${{ matrix.build_type }} --output-on-failure | |
| - uses: actions/setup-python@v6 | |
| if: ${{ matrix.report }} | |
| with: | |
| python-version: "3.12" | |
| - name: Report | |
| if: ${{ matrix.report }} | |
| working-directory: ${{ steps.strings.outputs.build-output-dir }} | |
| run: > | |
| sudo apt-get update && | |
| sudo apt-get -y install --no-install-recommends llvm && | |
| python ${{ github.workspace }}/tools/ci_report.py tests "$GITHUB_STEP_SUMMARY" |