Repository navigation
feat(guard): anchor PTN_BIND names to members #306
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: patternia CI | |
| on: | |
| push: | |
| branches: [main] | |
| paths-ignore: | |
| - "README.md" | |
| - "CONTRIBUTING.md" | |
| - "docs/**" | |
| - "LICENSE" | |
| - ".github/ISSUE_TEMPLATE/**" | |
| pull_request: | |
| branches: [main] | |
| # NOTE: no paths-ignore here on purpose. Branch protection | |
| # requires the build-and-test/coverage checks from this | |
| # workflow; skipping docs-only PRs would leave those checks | |
| # unreported and block the merge (see PR #45). | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| build-and-test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Configure CMake | |
| run: | | |
| cmake -S . -B build \ | |
| -DCMAKE_BUILD_TYPE=Release \ | |
| -DPTN_BUILD_TESTS=ON \ | |
| -DPTN_BUILD_BENCHMARKS=OFF \ | |
| -DPTN_SKIP_COMPILER_CHECK=ON | |
| - name: Build | |
| run: cmake --build build --parallel | |
| - name: Run Tests | |
| run: ctest --test-dir build --output-on-failure | |
| - name: Upload test log (on failure) | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-log | |
| path: build/Testing/Temporary/LastTest.log | |
| coverage: | |
| needs: build-and-test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install LLVM tools | |
| run: | | |
| wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - | |
| sudo add-apt-repository -y 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-18 main' | |
| sudo apt-get update -qq | |
| sudo apt-get install -y -qq llvm-18 clang-18 | |
| - name: Configure (Clang + source-based coverage) | |
| run: | | |
| cmake -S . -B build \ | |
| -DCMAKE_BUILD_TYPE=Debug \ | |
| -DCMAKE_C_COMPILER=clang-18 \ | |
| -DCMAKE_CXX_COMPILER=clang++-18 \ | |
| -DCMAKE_CXX_FLAGS="-fprofile-instr-generate -fcoverage-mapping -O0" \ | |
| -DCMAKE_EXE_LINKER_FLAGS="-fprofile-instr-generate" \ | |
| -DPTN_BUILD_TESTS=ON \ | |
| -DPTN_BUILD_BENCHMARKS=OFF \ | |
| -DPTN_SKIP_COMPILER_CHECK=ON | |
| - name: Build | |
| run: cmake --build build --parallel | |
| - name: Run Tests | |
| env: | |
| # Give each test process its own raw profile file. | |
| # %p = PID, %m = binary module name → avoids overwrites across | |
| # the 150+ gtest_discover_tests processes. | |
| LLVM_PROFILE_FILE: ${{ github.workspace }}/build/profile/%p-%m.profraw | |
| run: | | |
| mkdir -p build/profile | |
| ctest --test-dir build --output-on-failure | |
| - name: Capture coverage | |
| run: | | |
| # Merge raw profiles from all test processes. | |
| find build/profile -name '*.profraw' > profraw_list.txt | |
| echo "Found $(wc -l < profraw_list.txt) raw profiles" | |
| llvm-profdata-18 merge \ | |
| -input-files profraw_list.txt \ | |
| -output coverage.profdata \ | |
| -sparse | |
| # Export lcov-format text for Codecov. | |
| llvm-cov-18 export \ | |
| -format=lcov \ | |
| -instr-profile=coverage.profdata \ | |
| -ignore-filename-regex='(_deps|/usr/|tests/)' \ | |
| build/tests/ptn_tests \ | |
| > coverage.info | |
| # Summary for the CI log. | |
| llvm-cov-18 report \ | |
| -instr-profile=coverage.profdata \ | |
| -use-color \ | |
| -ignore-filename-regex='(_deps|/usr/|tests/)' \ | |
| build/tests/ptn_tests | |
| - name: Upload to Codecov | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: coverage.info | |
| fail_ci_if_error: false |