Skip to content

Commit

Permalink
Merge pull request #1 from CLIUtils/master
Browse files Browse the repository at this point in the history
Update to latest version
  • Loading branch information
maximmenshikov authored Sep 30, 2020
2 parents 8ecce8f + c166652 commit a5b15ca
Show file tree
Hide file tree
Showing 116 changed files with 10,731 additions and 3,885 deletions.
420 changes: 420 additions & 0 deletions .all-contributorsrc

Large diffs are not rendered by default.

10 changes: 7 additions & 3 deletions .appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
version: 1.8.0.{build}
version: 1.9.1.{build}

branches:
only:
- master
- v1

install:
- git submodule update --init --recursive
- set PATH=C:\Python36;%PATH%
- py -3 --version
- set PATH=C:\Python38-x64;C:\Python38-x64\Scripts;%PATH%
- cmake --version
- pip install conan
- python --version
- python -m pip --version
- python -m pip install conan
- conan user
- conan --version

Expand Down
2 changes: 1 addition & 1 deletion .ci/azure-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ steps:

- task: CMake@1
inputs:
cmakeArgs: .. -DCLI11_WARNINGS_AS_ERRORS=ON -DCLI11_SINGLE_FILE=$(cli11.single) -DCLI11_CXX_STD=$(cli11.std) -DCLI11_SINGLE_FILE_TESTS=$(cli11.single) -DCMAKE_BUILD_TYPE=$(cli11.build_type) $(cli11.options)
cmakeArgs: .. -DCLI11_WARNINGS_AS_ERRORS=ON -DCLI11_SINGLE_FILE=$(cli11.single) -DCMAKE_CXX_STANDARD=$(cli11.std) -DCLI11_SINGLE_FILE_TESTS=$(cli11.single) -DCMAKE_BUILD_TYPE=$(cli11.build_type) $(cli11.options)
displayName: 'Configure'

- script: cmake --build .
Expand Down
3 changes: 2 additions & 1 deletion .ci/build_doxygen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@

set -evx

DOXYGEN_URL="http://doxygen.nl/files/doxygen-1.8.15.src.tar.gz"
#DOXYGEN_URL="http://doxygen.nl/files/doxygen-1.8.17.src.tar.gz"
DOXYGEN_URL="https://github.com/doxygen/doxygen/archive/Release_1_8_15.tar.gz"
cd "${DEPS_DIR}"

if [[ ! -f "${DEPS_DIR}/doxygen/build/bin/doxygen" ]] ; then
Expand Down
2 changes: 1 addition & 1 deletion .ci/make_and_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ set -evx

mkdir -p build
cd build
cmake .. -DCLI11_WARNINGS_AS_ERRORS=ON -DCLI11_SINGLE_FILE=ON -DCLI11_CXX_STD=$STD -DCLI11_SINGLE_FILE_TESTS=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_COMPILER_LAUNCHER=ccache $@
cmake .. -DCLI11_WARNINGS_AS_ERRORS=ON -DCLI11_SINGLE_FILE=ON -DCMAKE_CXX_STANDARD=$STD -DCLI11_SINGLE_FILE_TESTS=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_COMPILER_LAUNCHER=ccache $@
cmake --build . -- -j2

set +evx
Expand Down
6 changes: 3 additions & 3 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ BasedOnStyle: LLVM
# AlwaysBreakTemplateDeclarations: false
BinPackArguments: false
BinPackParameters: false
# BraceWrapping:
# BraceWrapping:
# AfterClass: false
# AfterControlStatement: false
# AfterEnum: false
Expand Down Expand Up @@ -69,13 +69,13 @@ IndentWidth: 4
# PenaltyReturnTypeOnItsOwnLine: 60
# PointerAlignment: Right
# ReflowComments: true
SortIncludes: false
SortIncludes: true
# SpaceAfterCStyleCast: false
# SpaceAfterTemplateKeyword: true
# SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: Never
# SpaceInEmptyParentheses: false
# SpacesBeforeTrailingComments: 1
SpacesBeforeTrailingComments: 2
# SpacesInAngles: false
# SpacesInContainerLiterals: true
# SpacesInCStyleCastParentheses: false
Expand Down
27 changes: 22 additions & 5 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -1,8 +1,25 @@
#Checks: '*,-clang-analyzer-alpha.*'
#Checks: '-*,google-readability-casting,llvm-namespace-comment,performance-unnecessary-value-param,llvm-include-order,misc-throw-by-value-catch-by-reference,readability-container-size-empty,google-runtime-references,modernize*'
Checks: '-*,llvm-namespace-comment,readability-container-size-empty,misc-throw-by-value-catch-by-reference,modernize*,google-readability-casting'
# Checks that will be implemented in future PRs:
# performance-unnecessary-value-param, hints to ~110 issues. Be careful with implementing the suggested changes of this one, as auto-fixes may break the code

FormatStyle: file

Checks: '
-*,
google-*,
-google-runtime-references,
llvm-include-order,
llvm-namespace-comment,
misc-throw-by-value-catch-by-reference,
modernize*,
-modernize-use-trailing-return-type,
readability-container-size-empty,
'

WarningsAsErrors: '*'

HeaderFilterRegex: '.*hpp'

CheckOptions:
- key: readability-braces-around-statements.ShortStatementLines
value: '1'
- key: google-readability-braces-around-statements.ShortStatementLines
value: '3'

50 changes: 45 additions & 5 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,33 @@ In general, make sure the addition is well thought out and does not increase the

* 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 clang-format, 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 have clang-format, just run `scripts/check_style.sh`
* Everything must pass clang-tidy as well, run with `-DCLANG_TIDY_FIX-ON` (make sure you use a single threaded build process!)
* 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 `-DCLI11_CLANG_TIDY=ON` (if you set `-DCLI11_CLANG_TIDY_OPTIONS="-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).

Note that the style check is really just:

## Pre-commit

Format is handled by pre-commit. You should install it:

```bash
git ls-files -- '.cpp' '.hpp' | xargs clang-format -i -style=file
python3 -m pip install pre-commit
```

Then, you can run it on the items you've added to your staging area, or all files:

```
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):

And, if you want to always use it, feel free to install the git hook provided in scripts.
```bash
pre-commit install
```

## For developers releasing to Conan.io

Expand All @@ -38,3 +55,26 @@ 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:
* Replace " 🆕" and "🆕 " with "" (ignores the description line)
* Check for `\/\/$` (vi syntax) to catch leftover `// 🆕`
* Replace "🚧" with "🆕" (manually ignore the description line)
16 changes: 16 additions & 0 deletions .github/actions/cmake_config/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM ubuntu:18.04

RUN apt-get update \
&& apt-get install -y --no-install-recommends \
g++=4:7.4.0-1ubuntu2.3 \
wget=1.19.4-1ubuntu2.2 \
libidn11=1.33-2.1ubuntu1.2 \
ca-certificates=20180409 \
make=4.1-9.1ubuntu1 \
git=1:2.17.1-1ubuntu0.7 \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

COPY entrypoint.sh /entrypoint.sh

ENTRYPOINT ["/entrypoint.sh"]
16 changes: 16 additions & 0 deletions .github/actions/cmake_config/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
description: 'Test out a bare bones configuration with a CMake version'
inputs:
version:
description: 'The full version of CMake to check'
required: true
options:
description: 'The CMake configuration options'
required: false
default: ""
name: 'Configure with CMake'
runs:
using: 'docker'
image: 'Dockerfile'
args:
- ${{ inputs.version }}
- ${{ inputs.options }}
23 changes: 23 additions & 0 deletions .github/actions/cmake_config/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash -l

set -ex

mkdir -p cmake_dir
mkdir -p build_tmp
mkdir -p cmake_sources
rm -rf cmake_dir/* build_tmp/*

v=$1
fn=cmake-$v-Linux-x86_64.tar.gz

if [ ! -f cmake_sources/$fn ]; then
wget -qO cmake_sources/$fn "https://cmake.org/files/v${v%.*}/$fn"
fi

tar -xzf cmake_sources/$fn --strip-components=1 -C $PWD/cmake_dir

export PATH=$PWD/cmake_dir/bin:$PATH

cmake --version

cd build_tmp && cmake .. $2
57 changes: 57 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Build
on:
push:
branches:
- master
- v*
tags:
- "*"
pull_request:
branches:
- master

jobs:
single-header:
name: Single header
runs-on: ubuntu-latest
steps:

- uses: actions/checkout@v2
with:
submodules: true

- uses: actions/setup-python@v2

- name: Make header
run: python ./scripts/MakeSingleHeader.py CLI11.hpp

- name: Prepare CMake config
run: cmake -S . -B build

- 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.* .
- uses: actions/upload-artifact@v2
with:
name: CLI11.hpp
path: CLI11.hpp

- uses: actions/upload-artifact@v2
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 }}
Loading

0 comments on commit a5b15ca

Please sign in to comment.