Skip to content

Add erase_if

Add erase_if #5

Workflow file for this run

# 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: 6
strategy:
fail-fast: false
matrix:
include:
# ── Linux / GCC 14 ──
- os: ubuntu-24.04
compiler: gcc-14
preset: dev-gcc
# ── Linux / GCC 16 ──
- os: ubuntu-24.04
compiler: gcc-16
preset: dev-gcc
# ── Linux / Clang 18 ──
- os: ubuntu-24.04
compiler: clang-18
preset: dev-clang
# ── Linux / Clang 18 + libc++ ──
- os: ubuntu-24.04
compiler: clang-18+libc++
preset: dev-clang-libcxx
# ── Linux / Clang 22 ──
- os: ubuntu-24.04
compiler: clang-22
preset: dev-clang
# ── Linux / Clang 22 + libc++ ──
- os: ubuntu-24.04
compiler: clang-22+libc++
preset: dev-clang-libcxx
# ── Windows 2022 / MSVC 2022 ──
- os: windows-2022
compiler: msvc-2022
preset: dev-msvc
# ── Windows 2025 / MSVC 2026 ──
- os: windows-2025-vs2026
compiler: msvc-2026
preset: dev-msvc
# ── Windows 2025 / Clang-CL 20 ──
- os: windows-2025-vs2026
compiler: clang-cl-20
preset: dev-clang-cl
steps:
- uses: actions/checkout@v5
- name: Set up MSVC environment
if: startsWith(matrix.compiler, 'msvc') || startsWith(matrix.compiler, 'clang-cl')
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: 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 GCC 16
if: matrix.compiler == '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 Clang 18
if: startsWith(matrix.compiler, 'clang-18')
run: |
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-18 200
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-18 200
- name: Install libc++-18
if: matrix.compiler == 'clang-18+libc++'
run: sudo apt-get install -y libc++-18-dev libc++abi-18-dev
- name: Install Clang 22
if: startsWith(matrix.compiler, 'clang-22')
run: |
wget -q https://apt.llvm.org/llvm.sh
sudo bash llvm.sh 22
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 libc++-22
if: matrix.compiler == 'clang-22+libc++'
run: sudo apt-get install -y libc++-22-dev libc++abi-22-dev
- 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
# -----------------------------------------------------------------------
# Main project
# -----------------------------------------------------------------------
- name: Configure
run: cmake --preset ${{ matrix.preset }} -B build/${{ matrix.preset }}
- name: Build tests (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
--output-on-failure
--no-compress-output
--output-junit test-results-${{ matrix.compiler }}-debug-example.xml
- name: Build tests (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
--output-on-failure
--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 variant — simulates embedding via FetchContent_MakeAvailable
# (main only)
# -----------------------------------------------------------------------
- name: Copy Preset (FetchContent)
if: github.ref == 'refs/heads/main'
run: |
cp ./CMakePresets.json test/cmake-fetch_content
cp ./example/main.cpp test/cmake-fetch_content
- 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_KEYED_SET_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
# -----------------------------------------------------------------------
# Install variant — simulates a real end-user find_package workflow
# (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-keyed_set-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-keyed_set-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-keyed_set-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 ./build
- name: Copy Preset (find_package)
if: github.ref == 'refs/heads/main'
run: |
cp ./CMakePresets.json test/cmake-find_package
cp ./example/main.cpp test/cmake-find_package
- 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-keyed_set-install
--debug-find-pkg=Eggs.KeyedSet
- 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