Repository navigation
Bump version to 1.0.0 #36
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
| # Eggs.Stacktrace | |
| # | |
| # Copyright (c) 2026 Agustin Berge | |
| # | |
| name: coverage | |
| on: | |
| push: | |
| branches: [ main, feature/** ] | |
| pull_request: | |
| types: [opened, synchronize, reopened] | |
| workflow_dispatch: | |
| jobs: | |
| coverage: | |
| name: ubuntu-24.04 / llvm-cov | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 6 | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Install CMake | |
| uses: lukka/get-cmake@latest | |
| with: | |
| cmakeVersion: "4.4.0" | |
| - name: Set up APT package cache | |
| run: | | |
| mkdir -p ~/.cache/apt/archives/partial | |
| echo "Dir::Cache::archives \"$HOME/.cache/apt/archives\";" \ | |
| | sudo tee /etc/apt/apt.conf.d/99user-cache | |
| - name: Cache APT packages | |
| uses: actions/cache@v5 | |
| with: | |
| path: ~/.cache/apt/archives | |
| key: apt-ubuntu-24.04-clang-22-${{ hashFiles('.github/workflows/coverage.yml') }} | |
| restore-keys: apt-ubuntu-24.04-clang-22- | |
| - name: Install Clang 22 | |
| run: | | |
| wget -q https://apt.llvm.org/llvm.sh | |
| sudo bash llvm.sh 22 all | |
| sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-22 200 | |
| sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-22 200 | |
| - name: Install libstdc++-16 | |
| run: | | |
| sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test | |
| sudo apt-get update | |
| sudo apt-get install -y g++-16 | |
| - name: Fix APT cache permissions | |
| if: always() | |
| run: sudo rm -rf ~/.cache/apt/archives/lock ~/.cache/apt/archives/partial | |
| - name: Configure (coverage) | |
| run: | | |
| cmake --preset dev-clang -B build/coverage \ | |
| -DCMAKE_CXX_FLAGS_INIT="--gcc-install-dir=/usr/lib/gcc/x86_64-linux-gnu/16 -fprofile-instr-generate -fcoverage-mapping" \ | |
| -DCMAKE_EXE_LINKER_FLAGS_INIT="-fprofile-instr-generate" | |
| - name: Build | |
| run: cmake --build build/coverage --config Debug | |
| - name: Test | |
| run: | | |
| LLVM_PROFILE_FILE="${GITHUB_WORKSPACE}/build/coverage/cov-%p.profraw" \ | |
| ctest --test-dir build/coverage --build-config Debug \ | |
| --output-on-failure --no-compress-output | |
| - name: Merge profile data | |
| run: | | |
| llvm-profdata-22 merge -sparse build/coverage/cov-*.profraw \ | |
| -o build/coverage/coverage.profdata | |
| - name: Coverage report | |
| run: | | |
| mapfile -t objects < <(find build/coverage -path "*/Debug/*" -type f -perm /111) | |
| first="${objects[0]}" | |
| obj_args=() | |
| for o in "${objects[@]:1}"; do obj_args+=("-object=$o"); done | |
| report=$(llvm-cov-22 report "$first" "${obj_args[@]}" \ | |
| -instr-profile=build/coverage/coverage.profdata \ | |
| -path-equivalence=".,${GITHUB_WORKSPACE}" \ | |
| -use-color=false src include/eggs 2>/dev/null) | |
| echo "$report" | |
| if [ -n "$GITHUB_STEP_SUMMARY" ]; then | |
| { | |
| echo "## Coverage report (llvm-cov)" | |
| echo | |
| echo '```' | |
| echo "$report" | |
| echo '```' | |
| } >> "$GITHUB_STEP_SUMMARY" | |
| fi | |
| - name: Generate HTML report | |
| run: | | |
| mapfile -t objects < <(find build/coverage -path "*/Debug/*" -type f -perm /111) | |
| first="${objects[0]}" | |
| obj_args=() | |
| for o in "${objects[@]:1}"; do obj_args+=("-object=$o"); done | |
| llvm-cov-22 show "$first" "${obj_args[@]}" \ | |
| -instr-profile=build/coverage/coverage.profdata \ | |
| -path-equivalence=".,${GITHUB_WORKSPACE}" \ | |
| -format=html \ | |
| -output-dir=build/coverage/html \ | |
| -show-line-counts-or-regions \ | |
| src include/eggs 2>/dev/null | |
| - name: Upload coverage report | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: coverage-report-llvm-cov | |
| path: build/coverage/html/ | |
| retention-days: 7 | |
| coverage-gcov: | |
| name: ubuntu-24.04 / gcov | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 6 | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Install CMake | |
| uses: lukka/get-cmake@latest | |
| with: | |
| cmakeVersion: "4.4.0" | |
| - name: Set up APT package cache | |
| run: | | |
| mkdir -p ~/.cache/apt/archives/partial | |
| echo "Dir::Cache::archives \"$HOME/.cache/apt/archives\";" \ | |
| | sudo tee /etc/apt/apt.conf.d/99user-cache | |
| - name: Cache APT packages | |
| uses: actions/cache@v5 | |
| with: | |
| path: ~/.cache/apt/archives | |
| key: apt-ubuntu-24.04-gcc-16-${{ hashFiles('.github/workflows/coverage.yml') }} | |
| restore-keys: apt-ubuntu-24.04-gcc-16- | |
| - name: Install GCC 16 | |
| run: | | |
| sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y | |
| sudo apt-get update -q | |
| sudo apt-get install -y gcc-16 g++-16 | |
| sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-16 100 \ | |
| --slave /usr/bin/g++ g++ /usr/bin/g++-16 | |
| - name: Install lcov | |
| run: | | |
| sudo apt-get install -y libcapture-tiny-perl libdatetime-perl libtimedate-perl | |
| curl -sL https://github.com/linux-test-project/lcov/releases/download/v2.4/lcov-2.4.tar.gz \ | |
| | tar xz -C "$HOME" | |
| echo "$HOME/lcov-2.4/bin" >> "$GITHUB_PATH" | |
| - name: Fix APT cache permissions | |
| if: always() | |
| run: sudo rm -rf ~/.cache/apt/archives/lock ~/.cache/apt/archives/partial | |
| - name: Configure (coverage) | |
| run: | | |
| cmake --preset dev-gcc -B build/coverage-gcc \ | |
| -DCMAKE_CXX_FLAGS_INIT="--coverage" \ | |
| -DCMAKE_EXE_LINKER_FLAGS_INIT="--coverage" | |
| - name: Build | |
| run: cmake --build build/coverage-gcc --config Debug | |
| - name: Test | |
| run: | | |
| find build/coverage-gcc -name "*.gcda" -delete | |
| ctest --test-dir build/coverage-gcc --build-config Debug \ | |
| --output-on-failure --no-compress-output | |
| - name: Collect coverage | |
| run: | | |
| lcov --capture \ | |
| --gcov-tool gcov-16 \ | |
| --rc branch_coverage=1 \ | |
| --ignore-errors mismatch,inconsistent \ | |
| --base-directory . \ | |
| --directory build/coverage-gcc \ | |
| --output-file build/coverage-gcc/coverage.info | |
| lcov --extract build/coverage-gcc/coverage.info \ | |
| '*/src/*' '*/include/eggs/*' \ | |
| --rc branch_coverage=1 \ | |
| --ignore-errors unused \ | |
| --output-file build/coverage-gcc/coverage.info | |
| - name: Coverage report | |
| run: | | |
| report=$(lcov --list build/coverage-gcc/coverage.info --rc branch_coverage=1) | |
| echo "$report" | |
| if [ -n "$GITHUB_STEP_SUMMARY" ]; then | |
| { | |
| echo "## Coverage report (gcov)" | |
| echo | |
| echo '```' | |
| echo "$report" | |
| echo '```' | |
| } >> "$GITHUB_STEP_SUMMARY" | |
| fi | |
| - name: Generate HTML report | |
| run: | | |
| genhtml build/coverage-gcc/coverage.info \ | |
| --output-directory build/coverage-gcc/html \ | |
| --rc branch_coverage=1 \ | |
| --quiet | |
| - name: Upload coverage report | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: coverage-report-gcov | |
| path: build/coverage-gcc/html/ | |
| retention-days: 7 | |
| coverage-win32: | |
| name: windows-2025-vs2026 / clang-cl / llvm-cov | |
| runs-on: windows-2025-vs2026 | |
| timeout-minutes: 20 | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Install CMake | |
| uses: lukka/get-cmake@latest | |
| with: | |
| cmakeVersion: "4.4.0" | |
| - name: Set up MSVC environment | |
| shell: pwsh | |
| run: | | |
| $vsPath = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" ` | |
| -latest -property installationPath | |
| $vcvars = "$vsPath\VC\Auxiliary\Build\vcvars64.bat" | |
| cmd /c "`"$vcvars`" && set" | ForEach-Object { | |
| if ($_ -match '^([^=]+)=(.*)$') { | |
| "$($Matches[1])=$($Matches[2])" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
| } | |
| } | |
| - name: Locate LLVM coverage tools | |
| shell: pwsh | |
| run: | | |
| $clangPath = (Get-Command clang-cl).Source | |
| $llvmBin = Split-Path $clangPath | |
| $llvmRoot = Split-Path $llvmBin | |
| "LLVM_PROFDATA=$llvmBin\llvm-profdata.exe" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
| "LLVM_COV=$llvmBin\llvm-cov.exe" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
| $profileLib = Get-ChildItem -Path "$llvmRoot\lib\clang" -Recurse ` | |
| -Filter "clang_rt.profile-x86_64.lib" -ErrorAction SilentlyContinue | | |
| Select-Object -First 1 -ExpandProperty FullName | |
| if (-not $profileLib) { | |
| throw "Could not locate clang_rt.profile-x86_64.lib under $llvmRoot" | |
| } | |
| # Use forward slashes: CMake's -D argument parsing treats a bare | |
| # backslash as an escape character and silently drops it. | |
| $profileLib = $profileLib -replace '\\', '/' | |
| "LLVM_PROFILE_LIB=$profileLib" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
| - name: Configure (coverage) | |
| shell: pwsh | |
| run: | | |
| cmake --preset dev-clang-cl -B build/coverage-win32 ` | |
| -DCMAKE_CXX_FLAGS_INIT="-fprofile-instr-generate -fcoverage-mapping" ` | |
| "-DCMAKE_EXE_LINKER_FLAGS_INIT=`"$env:LLVM_PROFILE_LIB`"" | |
| - name: Build | |
| shell: pwsh | |
| run: cmake --build build/coverage-win32 --config Debug | |
| - name: Test | |
| shell: pwsh | |
| run: | | |
| $env:LLVM_PROFILE_FILE = "$PWD\build\coverage-win32\cov-%p.profraw" | |
| ctest --test-dir build/coverage-win32 --build-config Debug --output-on-failure --no-compress-output | |
| - name: Merge profile data | |
| shell: pwsh | |
| run: | | |
| $profraws = Get-ChildItem -Recurse build/coverage-win32 -Filter *.profraw | | |
| Select-Object -ExpandProperty FullName | |
| & "$env:LLVM_PROFDATA" merge -sparse $profraws -o build/coverage-win32/coverage.profdata | |
| - name: Coverage report | |
| shell: pwsh | |
| run: | | |
| $objects = Get-ChildItem -Recurse build/coverage-win32 -Include *.exe,*.dll | | |
| Where-Object { $_.FullName -match '\\Debug\\' } | | |
| Select-Object -ExpandProperty FullName | |
| $first = $objects[0] | |
| $objArgs = @() | |
| if ($objects.Length -gt 1) { | |
| $objArgs = $objects[1..($objects.Length - 1)] | ForEach-Object { "-object=$_" } | |
| } | |
| $report = & "$env:LLVM_COV" report $first @objArgs ` | |
| "-instr-profile=build/coverage-win32/coverage.profdata" ` | |
| "-path-equivalence=.,$PWD" ` | |
| -use-color=false src include/eggs | |
| $report | |
| if ($env:GITHUB_STEP_SUMMARY) { | |
| "## Coverage report (llvm-cov, win32)" | Out-File -FilePath $env:GITHUB_STEP_SUMMARY -Encoding utf8 -Append | |
| "" | Out-File -FilePath $env:GITHUB_STEP_SUMMARY -Encoding utf8 -Append | |
| '```' | Out-File -FilePath $env:GITHUB_STEP_SUMMARY -Encoding utf8 -Append | |
| $report | Out-File -FilePath $env:GITHUB_STEP_SUMMARY -Encoding utf8 -Append | |
| '```' | Out-File -FilePath $env:GITHUB_STEP_SUMMARY -Encoding utf8 -Append | |
| } | |
| - name: Generate HTML report | |
| shell: pwsh | |
| run: | | |
| $objects = Get-ChildItem -Recurse build/coverage-win32 -Include *.exe,*.dll | | |
| Where-Object { $_.FullName -match '\\Debug\\' } | | |
| Select-Object -ExpandProperty FullName | |
| $first = $objects[0] | |
| $objArgs = @() | |
| if ($objects.Length -gt 1) { | |
| $objArgs = $objects[1..($objects.Length - 1)] | ForEach-Object { "-object=$_" } | |
| } | |
| & "$env:LLVM_COV" show $first @objArgs ` | |
| "-instr-profile=build/coverage-win32/coverage.profdata" ` | |
| "-path-equivalence=.,$PWD" ` | |
| -format=html ` | |
| -output-dir=build/coverage-win32/html ` | |
| -show-line-counts-or-regions ` | |
| src include/eggs | |
| - name: Upload coverage report | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: coverage-report-win32-llvm-cov | |
| path: build/coverage-win32/html/ | |
| retention-days: 7 |