Skip to content

Initial commit

Initial commit #2

Workflow file for this run

# Eggs.Stacktrace
#
# Copyright Agustin K-ballo Berge, Fusion Fenix 2026
#
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
name: test
on:
push:
branches: [ main, feature/** ]
pull_request:
types: [opened, synchronize, reopened]
jobs:
build:
name: ${{ matrix.os }} / ${{ matrix.compiler }}
runs-on: ${{ matrix.os }}
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
include:
# ── Linux / GCC 14 ──
- os: ubuntu-24.04
compiler: gcc-14
preset: dev-gcc
steps:
- uses: actions/checkout@v5
- name: Set up APT package cache
if: runner.os == 'Linux'
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
if: runner.os == 'Linux'
uses: actions/cache@v5
with:
path: ~/.cache/apt/archives
key: apt-${{ matrix.os }}-${{ matrix.compiler }}-${{ hashFiles('.github/workflows/test.yml') }}
restore-keys: apt-${{ matrix.os }}-${{ matrix.compiler }}-
- name: Install Ninja
if: runner.os == 'Linux'
run: sudo apt-get install -y ninja-build
- name: Fix APT cache permissions
if: always() && runner.os == 'Linux'
run: sudo rm -rf ~/.cache/apt/archives/lock ~/.cache/apt/archives/partial
- name: Check CMake version
run: cmake --version
- name: Configure
run: >-
cmake --preset ${{ matrix.preset }} -B build/${{ matrix.preset }}
-DBUILD_DOCS=OFF -DBUILD_EXAMPLES=ON -DBUILD_TESTING=ON
- name: Build (Debug)
id: build_debug
run: cmake --build build/${{ matrix.preset }} --config Debug -- -k 0
- name: Run header tests (Debug)
if: steps.build_debug.outcome == 'success'
run: >-
ctest --test-dir build/${{ matrix.preset }} --build-config Debug
--label-regex header --output-on-failure --no-compress-output
--output-junit test-results-${{ matrix.compiler }}-debug-header.xml
- name: Run unit tests (Debug)
if: steps.build_debug.outcome == 'success'
run: >-
ctest --test-dir build/${{ matrix.preset }} --build-config Debug
--label-regex unit --output-on-failure --no-compress-output
--output-junit test-results-${{ matrix.compiler }}-debug-unit.xml
- name: Run examples (Debug)
if: steps.build_debug.outcome == 'success'
run: >-
ctest --test-dir build/${{ matrix.preset }} --build-config Debug
--label-regex example --verbose --no-compress-output
--output-junit test-results-${{ matrix.compiler }}-debug-example.xml
- name: Build (Release)
id: build_release
if: always()
run: cmake --build build/${{ matrix.preset }} --config Release -- -k 0
- name: Run header tests (Release)
if: steps.build_release.outcome == 'success'
run: >-
ctest --test-dir build/${{ matrix.preset }} --build-config Release
--label-regex header --output-on-failure --no-compress-output
--output-junit test-results-${{ matrix.compiler }}-release-header.xml
- name: Run unit tests (Release)
if: steps.build_release.outcome == 'success'
run: >-
ctest --test-dir build/${{ matrix.preset }} --build-config Release
--label-regex unit --output-on-failure --no-compress-output
--output-junit test-results-${{ matrix.compiler }}-release-unit.xml
- name: Run examples (Release)
if: steps.build_release.outcome == 'success'
run: >-
ctest --test-dir build/${{ matrix.preset }} --build-config Release
--label-regex example --verbose --no-compress-output
--output-junit test-results-${{ matrix.compiler }}-release-example.xml
- name: Upload test results
if: always()
uses: actions/upload-artifact@v6
with:
name: test-results-${{ matrix.compiler }}
path: build/${{ matrix.preset }}/test-results-*.xml
if-no-files-found: ignore
retention-days: 7
# ── FetchContent consumer test (main only) ─────────────────────────────
- name: Copy Preset (FetchContent)
if: github.ref == 'refs/heads/main'
run: |
cp ./CMakePresets.json test/cmake-fetch_content
cp ./example/basic.cpp test/cmake-fetch_content/main.cpp
- name: Test Consumer (FetchContent) — Configure
id: fc_configure
if: github.ref == 'refs/heads/main'
working-directory: test/cmake-fetch_content
run: >-
cmake --preset ${{ matrix.preset }} -B build-consumer-fetch_content
-DEGGS_STACKTRACE_SOURCE_DIR=${{ github.workspace }}
- name: Test Consumer (FetchContent) — Build (Debug)
if: >-
github.ref == 'refs/heads/main'
&& steps.fc_configure.outcome == 'success'
working-directory: test/cmake-fetch_content
run: cmake --build build-consumer-fetch_content --config Debug
- name: Test Consumer (FetchContent) — Test (Debug)
if: >-
github.ref == 'refs/heads/main'
&& steps.fc_configure.outcome == 'success'
working-directory: test/cmake-fetch_content
run: >-
ctest --test-dir build-consumer-fetch_content --build-config Debug -V
- name: Test Consumer (FetchContent) — Build (Release)
if: >-
github.ref == 'refs/heads/main'
&& steps.fc_configure.outcome == 'success'
working-directory: test/cmake-fetch_content
run: cmake --build build-consumer-fetch_content --config Release
- name: Test Consumer (FetchContent) — Test (Release)
if: >-
github.ref == 'refs/heads/main'
&& steps.fc_configure.outcome == 'success'
working-directory: test/cmake-fetch_content
run: >-
ctest --test-dir build-consumer-fetch_content --build-config Release -V
# ── find_package consumer test (main only) ─────────────────────────────
- name: Test Install (Debug)
id: install_debug
if: github.ref == 'refs/heads/main'
run: >-
cmake --install build/${{ matrix.preset }}
--prefix ${{ runner.temp }}/eggs-stacktrace-install --config Debug
- name: Test Install (Release)
id: install_release
if: github.ref == 'refs/heads/main'
run: >-
cmake --install build/${{ matrix.preset }}
--prefix ${{ runner.temp }}/eggs-stacktrace-install --config Release
- name: Upload installed package
if: >-
github.ref == 'refs/heads/main'
&& steps.install_debug.outcome == 'success'
&& steps.install_release.outcome == 'success'
uses: actions/upload-artifact@v6
with:
name: installed-package-${{ matrix.compiler }}
path: ${{ runner.temp }}/eggs-stacktrace-install
if-no-files-found: error
retention-days: 7
- name: Clean Source and Build Tree
if: github.ref == 'refs/heads/main'
run: cmake -E rm -rf ./include ./src ./build
- name: Copy Preset (find_package)
if: github.ref == 'refs/heads/main'
run: |
cp ./CMakePresets.json test/cmake-find_package
cp ./example/basic.cpp test/cmake-find_package/main.cpp
- name: Test Consumer (find_package) — Configure
id: fp_configure
if: >-
github.ref == 'refs/heads/main'
&& steps.install_debug.outcome == 'success'
&& steps.install_release.outcome == 'success'
working-directory: test/cmake-find_package
run: >-
cmake --preset ${{ matrix.preset }} -B build-consumer-find_package
-DCMAKE_PREFIX_PATH=${{ runner.temp }}/eggs-stacktrace-install
--debug-find-pkg=Eggs.Stacktrace
- name: Test Consumer (find_package) — Build (Debug)
if: >-
github.ref == 'refs/heads/main'
&& steps.fp_configure.outcome == 'success'
working-directory: test/cmake-find_package
run: cmake --build build-consumer-find_package --config Debug
- name: Test Consumer (find_package) — Test (Debug)
if: >-
github.ref == 'refs/heads/main'
&& steps.fp_configure.outcome == 'success'
working-directory: test/cmake-find_package
run: >-
ctest --test-dir build-consumer-find_package --build-config Debug -V
- name: Test Consumer (find_package) — Build (Release)
if: >-
github.ref == 'refs/heads/main'
&& steps.fp_configure.outcome == 'success'
working-directory: test/cmake-find_package
run: cmake --build build-consumer-find_package --config Release
- name: Test Consumer (find_package) — Test (Release)
if: >-
github.ref == 'refs/heads/main'
&& steps.fp_configure.outcome == 'success'
working-directory: test/cmake-find_package
run: >-
ctest --test-dir build-consumer-find_package --build-config Release -V
# ── Documentation ────────────────────────────────────────────────────────────
docs:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v5
- name: Configure
run: >-
cmake --preset dev-gcc -B build/docs
-DBUILD_DOCS=ON -DENABLE_INSTALL=ON
- name: Build docs
run: cmake --build build/docs --target docs
- name: Upload docs
uses: actions/upload-artifact@v6
with:
name: docs
path: build/docs/docs/html/
if-no-files-found: error
retention-days: 7