Squashed 'libs/cli11/' content from commit dcbcb47

git-subtree-dir: libs/cli11
git-subtree-split: dcbcb4721dda5dab0a56d9faaaee50e6a30f7758
This commit is contained in:
Henry Winkel
2022-09-15 09:51:20 +02:00
commit 147125babf
163 changed files with 38023 additions and 0 deletions

103
.github/CONTRIBUTING.md vendored Normal file
View File

@@ -0,0 +1,103 @@
# 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 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. You should install it (or use
[pipx](https://pypa.github.io/pipx/)):
```bash
python3 -m pip install pre-commit
```
Then, you can run it on the items you've added to your staging area, or all
files:
```bash
pre-commit run
# OR
pre-commit run --all-files
```
And, if you want to always use it, you can install it as a git hook (hence the
name, pre-commit):
```bash
pre-commit install
```
## For developers releasing to Conan.io
This is now done by the CI system on tagged releases. Previously, the steps to
make a Conan.io release were:
```bash
conan remove '*' # optional, I like to be clean
conan create . cliutils/stable
conan upload "*" -r cli11 --all
```
Here I've assumed that the remote is `cli11`.
## 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 `.appveyor.yml` and `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
.github/actions/quick_cmake/action.yml vendored Normal file
View File

@@ -0,0 +1,25 @@
name: Quick CMake config
description: "Runs CMake 3.4+ (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@v1.12
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

7
.github/codecov.yml vendored Normal file
View File

@@ -0,0 +1,7 @@
codecov:
notify:
after_n_builds: 4
coverage:
status:
project:
informational: true

7
.github/dependabot.yml vendored Normal file
View File

@@ -0,0 +1,7 @@
version: 2
updates:
# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"

4
.github/labeler_merged.yml vendored Normal file
View File

@@ -0,0 +1,4 @@
needs changelog:
- all: ["!CHANGELOG.md"]
needs README:
- all: ["!README.md"]

59
.github/workflows/build.yml vendored Normal file
View File

@@ -0,0 +1,59 @@
name: Build
on:
push:
branches:
- main
- v*
tags:
- "*"
pull_request:
jobs:
single-header:
name: Single header
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
- uses: actions/setup-python@v4
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
cp build/CLI11-*-Source.* .
- name: Make header
run: cmake --build build --target CLI11-generate-single-file
- name: Copy file to main folder
run: cp build/include/CLI11.hpp CLI11.hpp
- uses: actions/upload-artifact@v3
with:
name: CLI11.hpp
path: CLI11.hpp
- uses: actions/upload-artifact@v3
with:
name: CLI11-Source
path: CLI11-Source
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
CLI11.hpp
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

15
.github/workflows/pr_merged.yml vendored Normal file
View File

@@ -0,0 +1,15 @@
name: PR merged
on:
pull_request_target:
types: [closed]
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

250
.github/workflows/tests.yml vendored Normal file
View File

@@ -0,0 +1,250 @@
name: Tests
on:
push:
branches:
- main
- v*
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
coverage:
name: Coverage
runs-on: ubuntu-latest
strategy:
matrix:
std: ["11", "14", "17", "20"]
precompile: ["ON", "OFF"]
steps:
- uses: actions/checkout@v3
- name: Get LCov
run: |
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_EXAMPLES=OFF \
-DCLI11_PRECOMPILED=${{matrix.precompile}} \
-DCMAKE_BUILD_TYPE=Coverage
- name: Build
run: cmake --build build -j4
- name: Test
run: cmake --build build --target CLI11_coverage
- name: Prepare coverage
run: |
lcov --directory . --capture --output-file coverage.info
lcov --remove coverage.info '*/tests/*' '*/examples/*' '/usr/*' --output-file coverage.info
lcov --list coverage.info
working-directory: build
- name: Upload coverage
run: |
curl -Os https://uploader.codecov.io/latest/linux/codecov
chmod +x codecov
./codecov
working-directory: build
clang-tidy:
name: Clang-Tidy
runs-on: ubuntu-latest
container: silkeh/clang:14
steps:
- uses: actions/checkout@v3
- name: Configure
run: >
cmake -S . -B build -DCMAKE_CXX_STANDARD=17
-DCMAKE_CXX_CLANG_TIDY="$(which
clang-tidy);--use-color;--warnings-as-errors=*"
- name: Build
run: cmake --build build -j4 -- --keep-going
cuda-build:
name: CUDA build only
runs-on: ubuntu-latest
container: nvidia/cuda:10.2-devel-ubuntu18.04
steps:
- uses: actions/checkout@v1
with:
submodules: true
- name: Add wget
run: apt-get update && apt-get install -y wget
- name: Get cmake
uses: jwlawson/actions-setup-cmake@v1.12
- name: Configure
run: cmake -S . -B build -DCLI11_CUDA_TESTS=ON
- name: Build
run: cmake --build build -j2
boost-build:
name: Boost build
runs-on: ubuntu-latest
container: zouzias/boost:1.76.0
steps:
- uses: actions/checkout@v1
with:
submodules: true
- name: Add deps
run: apt-get update && apt-get install make
- name: Get CMake
uses: jwlawson/actions-setup-cmake@v1.12
- name: Configure
run: cmake -S . -B build -DCLI11_BOOST=ON
- name: Build
run: cmake --build build -j2
- name: Run tests
run: ctest --output-on-failure
working-directory: build
meson-build:
name: Meson build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Prepare commands
run: |
pipx install meson
pipx install ninja
- name: Configure
run: meson setup build-meson . -Dtests=true
- name: Build
run: meson compile -C build-meson
cmake-config:
name: CMake config check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Check CMake 3.4
with:
cmake-version: "3.4"
uses: ./.github/actions/quick_cmake
- name: Check CMake 3.5
uses: ./.github/actions/quick_cmake
with:
cmake-version: "3.5"
if: success() || failure()
- name: Check CMake 3.6
uses: ./.github/actions/quick_cmake
with:
cmake-version: "3.6"
if: success() || failure()
- name: Check CMake 3.7
uses: ./.github/actions/quick_cmake
with:
cmake-version: "3.7"
if: success() || failure()
- name: Check CMake 3.8
uses: ./.github/actions/quick_cmake
with:
cmake-version: "3.8"
if: success() || failure()
- name: Check CMake 3.9
uses: ./.github/actions/quick_cmake
with:
cmake-version: "3.9"
if: success() || failure()
- name: Check CMake 3.10
uses: ./.github/actions/quick_cmake
with:
cmake-version: "3.10"
if: success() || failure()
- name: Check CMake 3.11 (full)
uses: ./.github/actions/quick_cmake
with:
cmake-version: "3.11"
args: -DCLI11_SANITIZERS=ON -DCLI11_BUILD_EXAMPLES_JSON=ON
if: success() || failure()
- name: Check CMake 3.12
uses: ./.github/actions/quick_cmake
with:
cmake-version: "3.12"
if: success() || failure()
- name: Check CMake 3.13
uses: ./.github/actions/quick_cmake
with:
cmake-version: "3.13"
if: success() || failure()
- name: Check CMake 3.14
uses: ./.github/actions/quick_cmake
with:
cmake-version: "3.14"
if: success() || failure()
- name: Check CMake 3.15
uses: ./.github/actions/quick_cmake
with:
cmake-version: "3.15"
if: success() || failure()
- name: Check CMake 3.16
uses: ./.github/actions/quick_cmake
with:
cmake-version: "3.16"
if: success() || failure()
- name: Check CMake 3.17
uses: ./.github/actions/quick_cmake
with:
cmake-version: "3.17"
if: success() || failure()
- 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 (full)
uses: ./.github/actions/quick_cmake
with:
cmake-version: "3.21"
args: -DCLI11_SANITIZERS=ON -DCLI11_BUILD_EXAMPLES_JSON=ON
if: success() || failure()
- name: Check CMake 3.22 (full)
uses: ./.github/actions/quick_cmake
with:
cmake-version: "3.22"
args: -DCLI11_SANITIZERS=ON -DCLI11_BUILD_EXAMPLES_JSON=ON
if: success() || failure()