perf(event_dispatcher): lock-free emit via atomic shared_ptr snapshot #97
Workflow file for this run
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: PR Check - Tests & Coverage | |
| on: | |
| pull_request: | |
| branches: [main] | |
| paths: | |
| - 'CMakeLists.txt' | |
| - 'CMakePresets.json' | |
| - 'external/**' | |
| - 'include/**' | |
| - 'src/**' | |
| - 'tests/**' | |
| - '.github/workflows/pr-check.yml' | |
| workflow_dispatch: | |
| env: | |
| MINGW_BIN: C:\mingw64\bin | |
| jobs: | |
| build-test: | |
| name: Build, Test & Coverage | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: "recursive" | |
| - name: Add MinGW to PATH | |
| run: echo "${{ env.MINGW_BIN }}" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | |
| shell: powershell | |
| - name: Cache pip packages | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~\AppData\Local\pip\Cache | |
| key: pip-gcovr-${{ runner.os }} | |
| restore-keys: pip-gcovr- | |
| - name: Install gcovr | |
| run: pip install gcovr | |
| shell: powershell | |
| - name: Cache CMake build | |
| uses: actions/cache@v4 | |
| with: | |
| path: build/mingw-debug | |
| key: cmake-build-${{ runner.os }}-${{ hashFiles('CMakeLists.txt', 'CMakePresets.json', 'external/**', 'src/**', 'include/**', 'tests/**') }} | |
| restore-keys: | | |
| cmake-build-${{ runner.os }}- | |
| - name: Verify Tools | |
| run: | | |
| echo "--- g++ ---" && g++ --version | |
| echo "--- ninja ---" && ninja --version | |
| echo "--- cmake ---" && cmake --version | |
| echo "--- gcovr ---" && gcovr --version | |
| shell: bash | |
| - name: Configure (Debug + Tests + Coverage) | |
| run: cmake --preset mingw-debug -DDMK_ENABLE_COVERAGE=ON -DDMK_WARNINGS_AS_ERRORS=ON | |
| shell: bash | |
| - name: Build | |
| run: cmake --build --preset mingw-debug --parallel | |
| shell: bash | |
| - name: Copy MinGW runtime DLLs | |
| run: | | |
| $testDir = "build\mingw-debug\tests" | |
| Get-ChildItem "${{ env.MINGW_BIN }}\lib*.dll" | ForEach-Object { | |
| Copy-Item $_.FullName "$testDir\" | |
| } | |
| shell: powershell | |
| - name: Run Tests | |
| timeout-minutes: 5 | |
| run: | | |
| & ".\build\mingw-debug\tests\DetourModKit_tests.exe" --gtest_output=xml:test-results.xml | |
| if ($LASTEXITCODE -ne 0) { throw "Tests failed with exit code $LASTEXITCODE" } | |
| shell: powershell | |
| - name: Generate Coverage Report | |
| run: | | |
| gcovr \ | |
| --root . \ | |
| --filter "src/" \ | |
| --filter "include/" \ | |
| --exclude "external/" \ | |
| --exclude "build/" \ | |
| --exclude "tests/" \ | |
| --gcov-ignore-parse-errors=negative_hits.warn_once_per_file \ | |
| --print-summary \ | |
| --xml coverage.xml \ | |
| build/mingw-debug | |
| shell: bash | |
| - name: Check Coverage Threshold (80%) | |
| run: | | |
| LINE_RATE=$(python -c " | |
| import xml.etree.ElementTree as ET | |
| tree = ET.parse('coverage.xml') | |
| root = tree.getroot() | |
| rate = float(root.attrib.get('line-rate', 0)) | |
| print(f'{rate * 100:.2f}') | |
| ") | |
| echo "Line coverage: ${LINE_RATE}%" | |
| python -c " | |
| rate = float('${LINE_RATE}') | |
| if rate < 80.0: | |
| print(f'FAIL: Coverage {rate:.2f}% is below 80% threshold') | |
| exit(1) | |
| else: | |
| print(f'PASS: Coverage {rate:.2f}% meets 80% threshold') | |
| " | |
| shell: bash | |
| - name: Upload Coverage Report | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-report | |
| path: coverage.xml |