This commit is contained in:
2026-09-13 13:30:21 +08:00
commit a6bbd520cf
2744 changed files with 1598795 additions and 0 deletions
+90
View File
@@ -0,0 +1,90 @@
# Contributing
Thanks for considering to write a Pull Request (PR) for CLI11! Here are a few
guidelines to get you started:
Make sure you are comfortable with the license; all contributions are licensed
under the original license.
## Adding functionality
Make sure any new functions you add are are:
- Documented by `///` documentation for Doxygen
- Mentioned in the instructions in the README, though brief mentions are okay
- Explained in your PR (or previously explained in an Issue mentioned in the PR)
- Completely covered by tests
In general, make sure the addition is well thought out and does not increase the
complexity of CLI11 needlessly.
## Things you should know
- Once you make the PR, tests will run to make sure your code works on all
supported platforms
- The test coverage is also measured, and that should remain 100%
- Formatting should be done with prek or pre-commit, otherwise the format check
will not pass. However, it is trivial to apply this to your PR, so don't worry
about this check. If you do want to run it, see below.
- Everything must pass clang-tidy as well, run with
`-DCMAKE_CXX_CLANG_TIDY="$(which clang-tidy)"` (if you set
`"$(which clang-tidy) -fix"`, make sure you use a single threaded build
process, or just build one example target).
- Your changes must also conform to most of the
[Google C++ Style Guide](https://google.github.io/styleguide/cppguide.html)
rules checked by [cpplint](https://github.com/cpplint/cpplint). For unused
cpplint filters and justifications, see [CPPLINT.cfg](/CPPLINT.cfg).
## Pre-commit
Format is handled by pre-commit / prek. You should install it (or use
[pipx](https://pypa.github.io/pipx/) or [uv](https://docs.astral.sh/uv/)):
```bash
python3 -m pip install prek
```
Then, you can run it on the items you've added to your staging area, or all
files:
```bash
prek
# OR
prek -a
```
And, if you want to always use it, you can install it as a git hook (hence the
name, pre-commit):
```bash
prek install
```
## For maintainers: remember to add contributions
In a commit to a PR, just add
"`@all-contributors please add <username> for <contributions>`" or similar (see
<https://allcontributors.org>). Use `code` for code, `bug` if an issue was
submitted, `platform` for packaging stuff, and `doc` for documentation updates.
To run locally, do:
```bash
yarn add --dev all-contributors-cli
yarn all-contributors add username code,bug
```
## For maintainers: Making a release
Remember to replace the emoji in the readme, being careful not to replace the
ones in all-contributors if any overlap.
Steps:
- Update changelog if needed
- Update the version in `include/CLI/Version.hpp`.
- Find and replace in README (new minor/major release only):
- Replace " 🆕" and "🆕 " with "" (ignores the description line)
- Check for `\/\/$` (vi syntax) to catch leftover `// 🆕`
- Replace "🚧" with "🆕" (manually ignore the description line)
- Make a release in the GitHub UI, use a name such as "Version X.Y(.Z): Title"
+25
View File
@@ -0,0 +1,25 @@
name: Quick CMake config
description: "Runs CMake 3.14+ (if already setup)"
inputs:
args:
description: "Other arguments"
required: false
default: ""
cmake-version:
description: "The CMake version to run"
required: true
runs:
using: composite
steps:
- name: CMake ${{ inputs.cmake-version }}
uses: jwlawson/actions-setup-cmake@v2.0.2
with:
cmake-version: "${{ inputs.cmake-version }}"
- run: |
mkdir -p build-tmp
touch build-tmp/tmp
rm -r build-tmp/*
(cd build-tmp && cmake .. ${{ inputs.args }})
rm -r build-tmp
shell: bash
+25
View File
@@ -0,0 +1,25 @@
# Wait for all coverage jobs before computing status
codecov:
notify:
after_n_builds: 8
# Only comment when the coverage numbers actually move
comment:
after_n_builds: 8
require_changes: true
ignore:
- "tests"
- "examples"
- "book"
- "docs"
- "test_package"
- "fuzz"
parsers:
gcov:
branch_detection:
conditional: yes
loop: yes
method: no
macro: no
+13
View File
@@ -0,0 +1,13 @@
version: 2
updates:
# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
target-branch: "main"
open-pull-requests-limit: 10
groups:
actions:
patterns:
- "*"
+4
View File
@@ -0,0 +1,4 @@
needs changelog:
- all: ["!CHANGELOG.md"]
needs README:
- all: ["!README.md"]
+75
View File
@@ -0,0 +1,75 @@
name: Build
on:
push:
branches:
- main
- v*
tags:
- "*"
pull_request:
jobs:
single-header:
name: Single header
runs-on: ubuntu-latest
permissions:
contents: write # Grant write permission for contents to upload artifacts
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Prepare CMake config
run: cmake -S . -B build -DCLI11_SINGLE_FILE=ON
- name: Make package
run: cmake --build build --target package_source
- name: Copy source packages
run: |
mkdir -p CLI11-Source
cp build/CLI11-*-Source.* CLI11-Source
- name: Make header
run: cmake --build build --target CLI11-generate-single-file
- uses: actions/upload-artifact@v4
with:
name: CLI11.hpp
path: build/single-include/CLI11.hpp
- uses: actions/upload-artifact@v4
with:
name: CLI11-Source
path: CLI11-Source
# Runs on every build, so a version bump without a changelog entry fails
# here instead of at tag time.
- name: Make release notes
id: notes
run: |
if [ "$GITHUB_REF_TYPE" = tag ]; then
version="$GITHUB_REF_NAME"
else
version="$(python3 scripts/ExtractVersion.py)"
fi
python3 scripts/ExtractReleaseNotes.py "$version" > release-notes.md
title="$(python3 scripts/ExtractReleaseNotes.py --title "$version")"
echo "title=$title" >> "$GITHUB_OUTPUT"
echo "$title"
cat release-notes.md
- name: Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
name: ${{ steps.notes.outputs.title }}
body_path: release-notes.md
files: |
build/single-include/CLI11.hpp
CLI11-Source/CLI11-*-Source.tar.gz
CLI11-Source/CLI11-*-Source.zip
+150
View File
@@ -0,0 +1,150 @@
name: Build Tests
on:
push:
branches:
- main
- v*
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
env:
CTEST_OUTPUT_ON_FAILURE: "1"
jobs:
cuda11-build:
name: CUDA 11 build only
runs-on: ubuntu-latest
container: nvidia/cuda:11.8.0-devel-ubuntu22.04
steps:
- name: Add build tools
run: apt-get update && apt-get install -y wget git cmake
- uses: actions/checkout@v4
with:
submodules: true
- name: Configure
run: cmake -S . -B build -DCLI11_CUDA_TESTS=ON
- name: Build
run: cmake --build build -j4
cuda12-single-header-repro:
name: CUDA 12.6 single-header repro
runs-on: ubuntu-latest
container: nvidia/cuda:12.6.1-devel-ubuntu24.04
steps:
- name: Add build tools
run: apt-get update && apt-get install -y cmake git python3 time
- uses: actions/checkout@v4
- name: Configure single-header build
run: cmake -S . -B build -DCLI11_SINGLE_FILE=ON -DCLI11_BUILD_TESTS=OFF -DCLI11_BUILD_EXAMPLES=OFF
- name: Generate single header
run: cmake --build build --target CLI11-generate-single-file
- name: Create reproduction source
run: |
cat <<'EOF' > test.cu
#include "CLI11.hpp"
int main() { return 0; }
EOF
- name: Show reproduction source
run: cat test.cu
- name: Try reproducing nvcc single-header compile issue
id: repro
run: |
/usr/bin/time -v timeout --signal=KILL 3m nvcc test.cu -I "${GITHUB_WORKSPACE}/build/single-include" -o test_cu -std=c++20
- name: Summarize reproduction attempt
if: always()
run: |
if [ "${{ steps.repro.outcome }}" = "success" ]; then
echo "CUDA 12.6 single-header repro did not trigger; nvcc compiled the single header generated from this branch." >> "$GITHUB_STEP_SUMMARY"
elif [ "${{ steps.repro.outcome }}" = "skipped" ]; then
echo "CUDA 12.6 single-header repro did not run because an earlier setup step failed." >> "$GITHUB_STEP_SUMMARY"
else
echo "CUDA 12.6 single-header repro triggered or timed out while compiling the single header generated from this branch." >> "$GITHUB_STEP_SUMMARY"
fi
cuda13-build:
name: CUDA 13 build only
runs-on: ubuntu-latest
container: nvidia/cuda:13.0.0-devel-ubuntu22.04
steps:
- name: Add build tools
run: apt-get update && apt-get install -y wget git cmake
- uses: actions/checkout@v4
with:
submodules: true
- name: Configure
run: cmake -S . -B build -DCLI11_CUDA_TESTS=ON
- name: Build
run: cmake --build build -j4
boost-build:
name: Boost build
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Add boost
run: sudo apt-get update && sudo apt-get install -y libboost-dev
# NOTE: If a boost version matching all requirements cannot be found,
# this build step will fail
- name: Configure
run: cmake -S . -B build -DCLI11_BOOST=ON
- name: Build
run: cmake --build build -j4
- name: Run tests
run: ctest --output-on-failure
working-directory: build
sanitizer-build:
name: sanitizer build
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
submodules: true
# this build step will fail
- name: Configure
run: cmake -S . -B build -DCLI11_SANITIZERS=ON
- name: Build
run: cmake --build build -j4
- name: Run tests
run: ctest --output-on-failure
working-directory: build
meson-build:
name: Meson build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Prepare commands
run: |
pipx install meson
pipx install ninja
- name: Configure
run: meson setup build-meson . -Dtests=enabled
- name: Build
run: meson compile -C build-meson
- name: Test
run: meson test -C build-meson
bazel-build:
name: Bazel build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build
run: bazel build //...
- name: Test
run: bazel test --test_output=errors //...
+26
View File
@@ -0,0 +1,26 @@
name: CIFuzz
on:
pull_request:
workflow_dispatch:
permissions:
contents: read
jobs:
fuzz:
runs-on: ubuntu-latest
steps:
- name: Build Fuzzers (dry run)
uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master
with:
oss-fuzz-project-name: cli11
language: 'c++'
dry-run: true
- name: Run Fuzzers (dry run)
uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master
with:
oss-fuzz-project-name: cli11
language: 'c++'
fuzz-seconds: 600
dry-run: true
+159
View File
@@ -0,0 +1,159 @@
name: CMake Tests
on:
push:
branches:
- main
- v*
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
env:
CTEST_OUTPUT_ON_FAILURE: "1"
jobs:
cmake-config-ubuntu-2204:
name: CMake config check (Ubuntu 22.04)
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Check CMake 3.14
uses: ./.github/actions/quick_cmake
with:
cmake-version: "3.14"
args: -DCLI11_SANITIZERS=ON -DCLI11_BUILD_EXAMPLES_JSON=ON
- name: Check CMake 3.15
uses: ./.github/actions/quick_cmake
with:
cmake-version: "3.15.6"
if: success() || failure()
- name: Check CMake 3.16
uses: ./.github/actions/quick_cmake
with:
cmake-version: "3.16.2"
if: success() || failure()
cmake-config-ubuntu-2404:
name: CMake config check (Ubuntu 24.04)
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Check CMake 3.17
uses: ./.github/actions/quick_cmake
with:
cmake-version: "3.17"
- name: Check CMake 3.18
uses: ./.github/actions/quick_cmake
with:
cmake-version: "3.18"
if: success() || failure()
- name: Check CMake 3.19
uses: ./.github/actions/quick_cmake
with:
cmake-version: "3.19"
if: success() || failure()
- name: Check CMake 3.20
uses: ./.github/actions/quick_cmake
with:
cmake-version: "3.20"
if: success() || failure()
- name: Check CMake 3.21
uses: ./.github/actions/quick_cmake
with:
cmake-version: "3.21"
if: success() || failure()
- name: Check CMake 3.22
uses: ./.github/actions/quick_cmake
with:
cmake-version: "3.22"
if: success() || failure()
- name: Check CMake 3.23
uses: ./.github/actions/quick_cmake
with:
cmake-version: "3.23"
if: success() || failure()
- name: Check CMake 3.24
uses: ./.github/actions/quick_cmake
with:
cmake-version: "3.24"
if: success() || failure()
- name: Check CMake 3.25
uses: ./.github/actions/quick_cmake
with:
cmake-version: "3.25"
if: success() || failure()
- name: Check CMake 3.26 (full)
uses: ./.github/actions/quick_cmake
with:
cmake-version: "3.26"
args: -DCLI11_SANITIZERS=ON -DCLI11_BUILD_EXAMPLES_JSON=ON
if: success() || failure()
- name: Check CMake 3.27
uses: ./.github/actions/quick_cmake
with:
cmake-version: "3.27"
if: success() || failure()
- name: Check CMake 3.28 (full)
uses: ./.github/actions/quick_cmake
with:
cmake-version: "3.28.X"
args: -DCLI11_SANITIZERS=ON -DCLI11_BUILD_EXAMPLES_JSON=ON
if: success() || failure()
- name: Check CMake 3.29
uses: ./.github/actions/quick_cmake
with:
cmake-version: "3.29"
if: success() || failure()
- name: Check CMake 3.30
uses: ./.github/actions/quick_cmake
with:
cmake-version: "3.30"
if: success() || failure()
- name: Check CMake 3.31
uses: ./.github/actions/quick_cmake
with:
cmake-version: "3.31"
args: -DCLI11_SANITIZERS=ON -DCLI11_BUILD_EXAMPLES_JSON=ON
if: success() || failure()
- name: Check CMake 4.0
uses: ./.github/actions/quick_cmake
with:
cmake-version: "4.0"
args: -DCLI11_BUILD_EXAMPLES_JSON=ON
if: success() || failure()
- name: Check CMake 4.1
uses: ./.github/actions/quick_cmake
with:
cmake-version: "4.1"
if: success() || failure()
- name: Check CMake 4.2
uses: ./.github/actions/quick_cmake
with:
cmake-version: "4.2"
if: success() || failure()
+103
View File
@@ -0,0 +1,103 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL Advanced"
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
schedule:
- cron: '30 5 * * 5'
jobs:
analyze:
name: Analyze (${{ matrix.language }})
# Runner size impacts CodeQL analysis time. To learn more, please see:
# - https://gh.io/recommended-hardware-resources-for-running-codeql
# - https://gh.io/supported-runners-and-hardware-resources
# - https://gh.io/using-larger-runners (GitHub.com only)
# Consider using larger runners or machines with greater resources for possible analysis time improvements.
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
permissions:
# required for all workflows
security-events: write
# required to fetch internal or private CodeQL packs
packages: read
# only required for workflows in private repositories
actions: read
contents: read
strategy:
fail-fast: false
matrix:
include:
- language: actions
build-mode: none
- language: c-cpp
build-mode: autobuild
- language: python
build-mode: none
# CodeQL supports the following values keywords for 'language': 'actions', 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'rust', 'swift'
# Use `c-cpp` to analyze code written in C, C++ or both
# Use 'java-kotlin' to analyze code written in Java, Kotlin or both
# Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
# To learn more about changing the languages that are analyzed or customizing the build mode for your analysis,
# see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning.
# If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how
# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
steps:
- name: Checkout repository
uses: actions/checkout@v4
# Add any setup steps before running the `github/codeql-action/init` action.
# This includes steps like installing compilers or runtimes (`actions/setup-node`
# or others). This is typically only required for manual builds.
# - name: Setup runtime (example)
# uses: actions/setup-example@v1
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v4
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality
# If the analyze step fails for one of the languages you are analyzing with
# "We were unable to automatically build your code", modify the matrix above
# to set the build mode to "manual" for that language. Then modify this step
# to build your code.
# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
- name: Run manual build steps
if: matrix.build-mode == 'manual'
shell: bash
run: |
echo 'If you are using a "manual" build mode for one or more of the' \
'languages you are analyzing, replace this with the commands to build' \
'your code, for example:'
echo ' make bootstrap'
echo ' make release'
exit 1
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v4
with:
category: "/language:${{matrix.language}}"
+40
View File
@@ -0,0 +1,40 @@
name: "Copilot Setup Steps"
# Automatically run the setup steps when they are changed to allow for easy validation, and
# allow manual testing through the repository's "Actions" tab
on:
workflow_dispatch:
push:
paths:
- .github/workflows/copilot-setup-steps.yml
pull_request:
paths:
- .github/workflows/copilot-setup-steps.yml
permissions: {}
jobs:
# The job MUST be called `copilot-setup-steps` or it will not be picked up by Copilot.
copilot-setup-steps:
runs-on: ubuntu-latest
# Set the permissions to the lowest permissions possible needed for your steps.
# Copilot will be given its own token for its operations.
permissions:
contents: read
steps:
- uses: actions/checkout@v5
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
doxygen \
clang-tidy
- name: Install pre-commit hooks
run: |
pipx install prek
prek install-hooks
+67
View File
@@ -0,0 +1,67 @@
name: Coverage Tests
on:
push:
branches:
- main
- v*
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
env:
CTEST_OUTPUT_ON_FAILURE: "1"
jobs:
coverage:
name: Coverage
runs-on: ubuntu-latest
strategy:
matrix:
std: ["14", "17", "20", "23"]
precompile: ["ON", "OFF"]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get LCov
run: |
sudo apt-get install ca-certificates lcov
#wget https://github.com/linux-test-project/lcov/releases/download/v1.16/lcov-1.16.tar.gz
#tar -xzf lcov-1.16.tar.gz
#cd lcov-1.16
#sudo make install
- name: Configure
run: |
cmake -S . -B build \
-DCMAKE_CXX_STANDARD=${{matrix.std}} \
-DCLI11_SINGLE_FILE_TESTS=OFF \
-DCLI11_BUILD_EXAMPLES=OFF \
-DCLI11_PRECOMPILED=${{matrix.precompile}} \
-DCMAKE_BUILD_TYPE=Coverage \
-DCLI11_ENABLE_EXTRA_VALIDATORS=ON
- name: Build
run: cmake --build build -j4
- name: Test
run: cmake --build build --target CLI11_coverage
- name: Prepare coverage
run: |
lcov --ignore-errors gcov,mismatch --directory . --capture --output-file coverage.info
lcov --remove coverage.info '*/tests/*' '/usr/*' --output-file coverage.info
lcov --list coverage.info
working-directory: build
- uses: codecov/codecov-action@v5
with:
files: build/coverage.info
# Protected branches reject tokenless uploads; fork PRs still work without it.
token: ${{ secrets.CODECOV_TOKEN }}
+80
View File
@@ -0,0 +1,80 @@
name: Docs
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
permissions:
contents: read
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
apidocs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Doxygen
run: |
curl -fsSL https://github.com/doxygen/doxygen/releases/download/Release_1_17_0/doxygen-1.17.0.linux.bin.tar.gz | tar -xz -C "$RUNNER_TEMP"
echo "$RUNNER_TEMP/doxygen-1.17.0/bin" >> "$GITHUB_PATH"
- name: Get version from Version.hpp
run: |
version=$(sed -n 's/#define CLI11_VERSION[ \t]*"\(.*\)"/\1/p' include/CLI/Version.hpp)
echo "CLI11_VERSION=$version" >> "$GITHUB_ENV"
- name: Build API docs
run: doxygen docs/Doxyfile
- name: Create redirects for old URLs
run: |
redirect() {
printf '<!DOCTYPE html>\n<html lang="en"><head><meta charset="utf-8"><meta http-equiv="refresh" content="0; url=%s"><link rel="canonical" href="https://cliutils.github.io/CLI11/%s"><title>Page moved</title></head><body><p>This page moved to <a href="%s">%s</a>.</p></body></html>\n' "$1" "$2" "$1" "$2" > "$3"
}
mkdir -p html/book/chapters
redirect ../book-installation.html book-installation.html html/book/index.html
redirect book-installation.html book-installation.html html/book.html
redirect "index.html#api-reference" "index.html#api-reference" html/api.html
for f in book/chapters/*.md; do
name=$(basename "$f" .md)
redirect "../../book-$name.html" "book-$name.html" "html/book/chapters/$name.html"
done
- uses: actions/upload-artifact@v4
with:
name: api-docs
path: html
pages:
runs-on: ubuntu-latest
needs: [apidocs]
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
if: >
success()
&& github.ref == 'refs/heads/main'
&& github.repository == 'CLIUtils/CLI11'
steps:
- uses: actions/configure-pages@v5
id: pages
- uses: actions/download-artifact@v4
with:
name: api-docs
path: _site
- uses: actions/upload-pages-artifact@v3
- uses: actions/deploy-pages@v4
id: deployment
+56
View File
@@ -0,0 +1,56 @@
name: Fuzz
on:
workflow_dispatch:
push:
branches:
- main
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
quick_fuzz1:
name: quickfuzz1
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Configure
run: |
cmake -S . -B build \
-DCMAKE_CXX_STANDARD=20 \
-DCLI11_SINGLE_FILE_TESTS=OFF \
-DCLI11_BUILD_EXAMPLES=OFF \
-DCLI11_FUZZ_TARGET=ON \
-DCLI11_BUILD_TESTS=OFF \
-DCLI11_BUILD_DOCS=OFF \
-DCMAKE_CXX_COMPILER=clang++ -DCMAKE_CXX_COMPILER_FORCED=ON \
-DCMAKE_CXX_FLAGS="-g -O1 -fsanitize=fuzzer,undefined,address"
- name: Build
run: cmake --build build -j4
- name: Test_app
run: |
cd build
make QUICK_CLI11_APP_FUZZ
- name: Test_file
run: |
cd build
make QUICK_CLI11_FILE_FUZZ
- name: artifacts
if: failure()
uses: actions/upload-artifact@v4
with:
name: file_failure
path: ./build/fuzz/cli11_*_fail_artifact.txt
+201
View File
@@ -0,0 +1,201 @@
name: Install Tests
on:
push:
branches:
- main
- v*
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
env:
CTEST_OUTPUT_ON_FAILURE: "1"
jobs:
install:
name: install tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Configure
run: cmake -S . -B build -DCLI11_INSTALL_PACKAGE_TESTS=ON -DCLI11_BUILD_EXAMPLES=OFF -DCMAKE_INSTALL_PREFIX=/home/runner/work/install
- name: Build
run: cmake --build build -j4
- name: install
run: cmake --install build
- name: Run tests
run: ctest --output-on-failure -L Packaging
working-directory: build
install-precompiled:
name: install tests precompiled
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Configure
run: cmake -S . -B build -DCLI11_INSTALL_PACKAGE_TESTS=ON -DCLI11_BUILD_EXAMPLES=OFF -DCLI11_ENABLE_EXTRA_VALIDATORS=ON -DCMAKE_INSTALL_PREFIX=/home/runner/work/install -DCLI11_PRECOMPILED=ON -DCLI11_DISABLE_IMPL_HEADERS_INSTALL=ON
- name: Build
run: cmake --build build -j4
- name: install
run: cmake --install build
- name: Run tests
run: ctest --output-on-failure -L Packaging
working-directory: build
install-precompiled-shared:
name: install tests precompiled shared
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Configure
run: cmake -S . -B build -DCLI11_INSTALL_PACKAGE_TESTS=ON -DCLI11_BUILD_EXAMPLES=OFF -DCLI11_ENABLE_EXTRA_VALIDATORS=ON -DCMAKE_INSTALL_PREFIX=/home/runner/work/install -DCLI11_PRECOMPILED=ON -DCLI11_DISABLE_IMPL_HEADERS_INSTALL=ON -DBUILD_SHARED_LIBS=ON
- name: Build
run: cmake --build build -j4
- name: install
run: cmake --install build
- name: Run tests
run: ctest --output-on-failure -L Packaging
working-directory: build
install-precompiled-all:
name: install tests precompiled full install
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Configure
run: cmake -S . -B build -DCLI11_INSTALL_PACKAGE_TESTS=ON -DCLI11_BUILD_EXAMPLES=OFF -DCLI11_ENABLE_EXTRA_VALIDATORS=ON -DCMAKE_INSTALL_PREFIX=/home/runner/work/install -DCLI11_PRECOMPILED=ON
- name: Build
run: cmake --build build -j4
- name: install
run: cmake --install build
- name: Configure2
run: cmake -S . -B build -DCLI11_INSTALL_PACKAGE_TESTS=ON -DCLI11_BUILD_EXAMPLES=OFF -DCMAKE_INSTALL_PREFIX=/home/runner/work/install
- name: Run tests
run: ctest --output-on-failure -L Packaging
working-directory: build
install-precompiled-macos:
# Shared covers dylib symbol export of the precompiled library
name: install tests precompiled shared macos
runs-on: macos-15
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Configure
run: cmake -S . -B build -DCLI11_INSTALL_PACKAGE_TESTS=ON -DCLI11_BUILD_EXAMPLES=OFF -DCLI11_ENABLE_EXTRA_VALIDATORS=ON -DCMAKE_INSTALL_PREFIX=/Users/runner/work/install -DCLI11_PRECOMPILED=ON -DBUILD_SHARED_LIBS=ON -DCMAKE_CXX_STANDARD=20
- name: Build
run: cmake --build build -j4
- name: install
run: cmake --install build
- name: Run tests
run: ctest --output-on-failure -L Packaging
working-directory: build
install-precompiled-macos-no-validators:
name: install tests precompiled macos no validators
runs-on: macos-15
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Configure
run: cmake -S . -B build -DCLI11_INSTALL_PACKAGE_TESTS=ON -DCLI11_BUILD_EXAMPLES=OFF -DCLI11_ENABLE_EXTRA_VALIDATORS=OFF -DCMAKE_INSTALL_PREFIX=/Users/runner/work/install -DCLI11_PRECOMPILED=ON
- name: Build
run: cmake --build build -j4
- name: install
run: cmake --install build
- name: Run tests
run: ctest --output-on-failure -L Packaging
working-directory: build
install-single_file:
name: install tests single file
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Configure
run: cmake -S . -B build -DCLI11_INSTALL_PACKAGE_TESTS=ON -DCLI11_BUILD_EXAMPLES=OFF -DCLI11_ENABLE_EXTRA_VALIDATORS=ON -DCMAKE_INSTALL_PREFIX=/home/runner/work/install -DCLI11_SINGLE_FILE=ON
- name: Build
run: cmake --build build -j4
- name: install
run: cmake --install build
- name: Run tests
run: ctest --output-on-failure -L Packaging
working-directory: build
install-module:
name: install module include tests (gcc, C++${{ matrix.std }})
runs-on: ubuntu-latest
container: gcc:15
strategy:
fail-fast: false
matrix:
std: ["20", "23"]
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: ./.github/actions/quick_cmake
with:
cmake-version: "4.4"
- uses: seanmiddleditch/gha-setup-ninja@master
- name: Configure
run: cmake -S . -B build -G Ninja -DCLI11_INSTALL_PACKAGE_TESTS=ON -DCLI11_BUILD_EXAMPLES=OFF -DCLI11_MODULE_TESTS=ON -DCLI11_MODULES=ON -DCMAKE_CXX_STANDARD=${{ matrix.std }} -DCMAKE_INSTALL_PREFIX=/home/runner/work/install
- name: Build
run: cmake --build build -j4
- name: install
run: cmake --install build
- name: Run tests
run: ctest --output-on-failure -L Packaging
working-directory: build
install-module-clang:
name: install cli11 module tests (C++${{ matrix.std }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
std: ["20", "23", "26"]
steps:
- name: Set up Clang
uses: egor-tensin/setup-clang@v2
with:
version: 20
platform: x64
- name: Install specific libc++ version
run: |
sudo apt-get update
sudo apt-get install -y libc++-20-dev libc++abi-20-dev lld-20
- uses: actions/checkout@v4
with:
submodules: true
- uses: ./.github/actions/quick_cmake
with:
# 4.4+ compiles the imported-module BMI with the consumer's standard
cmake-version: "4.4"
- uses: seanmiddleditch/gha-setup-ninja@master
- name: Configure
run: cmake -S . -B build -G Ninja -DCLI11_INSTALL_PACKAGE_TESTS=ON -DCLI11_BUILD_EXAMPLES=OFF -DCLI11_MODULE_TESTS=ON -DCLI11_FORCE_LIBCXX=ON -DCLI11_MODULES=ON -DCMAKE_CXX_STANDARD=${{ matrix.std }} -DCMAKE_INSTALL_PREFIX=/home/runner/work/install -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_LINKER_TYPE=LLD -DCMAKE_CXX_FLAGS=-stdlib=libc++
- name: Build
run: cmake --build build -j4
- name: install
run: cmake --install build
- name: Run tests
run: ctest --output-on-failure -L Packaging
working-directory: build
+50
View File
@@ -0,0 +1,50 @@
name: Platform Tests
on:
push:
branches:
- main
pull_request:
permissions:
contents: read
jobs:
arm64-gcc:
name: ARM64 GCC
runs-on: ubuntu-24.04-arm
steps:
- uses: actions/checkout@v4
- name: Configure
run: |
cmake -S . -B build \
-DCMAKE_CXX_STANDARD=17
- name: Build
run: cmake --build build -j4
- name: Test
run: |
cd build
ctest --output-on-failure
freebsd:
name: FreeBSD
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Test in FreeBSD
id: test
uses: vmactions/freebsd-vm@v1
with:
usesh: true
prepare: |
pkg install -y cmake pkgconf
run: |
cmake -S . -B build \
-DCMAKE_CXX_STANDARD=20
cmake --build build -j4
cd build
ctest --output-on-failure
+19
View File
@@ -0,0 +1,19 @@
name: PR merged
on:
pull_request_target:
types: [closed]
permissions:
contents: write
pull-requests: write
jobs:
label-merged:
name: Changelog needed
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true
steps:
- uses: actions/labeler@main
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
configuration-path: .github/labeler_merged.yml
+134
View File
@@ -0,0 +1,134 @@
name: Tests
on:
push:
branches:
- main
- v*
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
env:
CTEST_OUTPUT_ON_FAILURE: "1"
jobs:
preset:
name: Preset
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run CMake Workflow
run: cmake --workflow default
catch2-3:
name: Catch 2 3.x
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Get Catch 2
run: brew install catch2
- name: Configure
run: |
cmake -S . -B build \
-DCMAKE_CXX_STANDARD=14 \
-DCLI11_SINGLE_FILE_TESTS=OFF \
-DCLI11_BUILD_EXAMPLES=OFF \
-DCLI11_PRECOMPILED=ON
- name: Build
run: cmake --build build -j4
- name: Test
run: cmake --build build --target test
docker:
name: Docker ${{ matrix.name }}
runs-on: ubuntu-latest
container: ${{ matrix.container }}
strategy:
fail-fast: false
matrix:
include:
- name: gcc15 std23
container: gcc:15
std: 23
precompile: OFF
options: -DCMAKE_CXX_FLAGS="-Wstrict-overflow=5" -DCLI11_ENABLE_EXTRA_VALIDATORS=1
- name: gcc15 std26
container: gcc:15
std: 26
precompile: OFF
options: -DCLI11_ENABLE_EXTRA_VALIDATORS=1
- name: gcc12 std20
container: gcc:12
std: 20
precompile: OFF
options: -DCMAKE_CXX_FLAGS="-Wredundant-decls -Wconversion"
-DCLI11_ENABLE_EXTRA_VALIDATORS=1
- name: clang17 std23 precompiled
container: silkeh/clang:17
std: 23
precompile: ON
options: -DCMAKE_CXX_FLAGS="-std=c++23 -stdlib=libc++"
-DCLI11_ENABLE_EXTRA_VALIDATORS=1 -DCMAKE_CXX_COMPILER=clang++
-DCLI11_FORCE_LIBCXX=ON -DCMAKE_LINKER_TYPE=LLD
- name: gcc15 std17 precompiled shared lto
container: gcc:15
std: 17
precompile: ON
options: -DBUILD_SHARED_LIBS=ON -DCMAKE_CXX_FLAGS="-O2 -flto=auto"
- name: clang20 std26
container: silkeh/clang:20
std: 26
precompile: OFF
options: -DCMAKE_CXX_FLAGS="-std=c++2c -stdlib=libc++ -Wdocumentation"
-DCLI11_ENABLE_EXTRA_VALIDATORS=1 -DCMAKE_CXX_COMPILER=clang++
-DCLI11_FORCE_LIBCXX=ON -DCMAKE_LINKER_TYPE=LLD
steps:
- uses: actions/checkout@v4
# silkeh/clang does not include ca-certificates, so check the shasum for verification
- name: Install CMake
run: |
wget --no-check-certificate "https://cmake.org/files/v3.31/cmake-3.31.1-linux-x86_64.tar.gz"
echo "3b72fde0d40fa8be617667ea08d12c5ee47f6cf8950c2fbfcf2acfb5f83fb9de cmake-3.31.1-linux-x86_64.tar.gz" | sha256sum -c
tar -xzf cmake-3.31.1-linux-x86_64.tar.gz
echo "$PWD/cmake-3.31.1-linux-x86_64/bin" >> $GITHUB_PATH
- name: Configure
run: cmake -S . -B build -DCLI11_WARNINGS_AS_ERRORS=ON
-DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_STANDARD=${{ matrix.std }}
-DCLI11_PRECOMPILED=${{ matrix.precompile }} ${{ matrix.options }}
- name: Build
run: cmake --build build -j4
- name: Test
run: ctest --output-on-failure
working-directory: build
clang-tidy:
name: Clang-Tidy
runs-on: ubuntu-latest
container: silkeh/clang:20
steps:
- uses: actions/checkout@v4
- name: Install requirements
run: apt-get update && apt-get install -y ninja-build
- name: Configure
run: cmake --preset tidy
- name: Build
run: cmake --build --preset tidy