1
0
mirror of https://github.com/CLIUtils/CLI11.git synced 2025-05-07 23:33:52 +00:00

ci: set up coverage on GHA (#747)

* ci: set up coverage on GHA

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* ci: update to newer codecov uploader

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* ci: move to newer Windows image

* fix: better single file script help and usage strictness

* ci: revert update to windows-2022
This commit is contained in:
Henry Schreiner 2022-06-27 15:41:32 -04:00 committed by GitHub
parent c781998273
commit 6ae1e1ecc1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 63 additions and 99 deletions

View File

@ -1,25 +0,0 @@
#!/bin/env sh
# (Source me)
set -evx
#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
echo "Downloading Doxygen"
mkdir -p doxygen
travis_retry wget --no-check-certificate --quiet -O - "${DOXYGEN_URL}" | tar --strip-components=1 -xz -C doxygen
cd doxygen
mkdir -p build
cd build
cmake ..
make -j2
fi
export PATH="${DEPS_DIR}/doxygen/build/bin:${PATH}"
cd "${TRAVIS_BUILD_DIR}"
set +evx

View File

@ -1,17 +0,0 @@
#!/bin/env sh
# (Source me)
set -evx
LCOV_URL="http://ftp.de.debian.org/debian/pool/main/l/lcov/lcov_1.13.orig.tar.gz"
cd "${DEPS_DIR}"
if [[ ! -f "${DEPS_DIR}/lcov/bin/lcov" ]] ; then
echo "Downloading lcov"
mkdir -p lcov
travis_retry wget --no-check-certificate --quiet -O - "${LCOV_URL}" | tar --strip-components=1 -xz -C lcov
fi
export PATH="${DEPS_DIR}/lcov/bin:${PATH}"
cd "${TRAVIS_BUILD_DIR}"
set +evx

View File

@ -1,23 +0,0 @@
#!/usr/bin/env bash
echo -en "travis_fold:start:script.build\\r"
echo "Building..."
STD="$1"
shift
set -evx
mkdir -p build
cd build
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 --keep-going
set +evx
echo -en "travis_fold:end:script.build\\r"
echo -en "travis_fold:start:script.test\\r"
echo "Testing..."
set -evx
ctest --output-on-failure
set +evx
echo -en "travis_fold:end:script.test\\r"

View File

@ -1,27 +0,0 @@
#!/usr/bin/env bash
echo -en "travis_fold:start:script.build\\r"
echo "Building..."
set -evx
cd "${TRAVIS_BUILD_DIR}"
mkdir -p build
cd build
cmake .. -DCLI11_SINGLE_FILE_TESTS=OFF -DCLI11_EXAMPLES=OFF -DCMAKE_BUILD_TYPE=Coverage
cmake --build . -- -j2
cmake --build . --target CLI11_coverage
set +evx
echo -en "travis_fold:end:script.build\\r"
echo -en "travis_fold:start:script.lcov\\r"
echo "Capturing and uploading LCov..."
set -evx
lcov --directory . --capture --output-file coverage.info # capture coverage info
lcov --remove coverage.info '*/tests/*' '*/examples/*' '*gtest*' '*gmock*' '/usr/*' --output-file coverage.info # filter out system
lcov --list coverage.info #debug info
# Uploading report to CodeCov
bash <(curl -s https://codecov.io/bash) || echo "Codecov did not collect coverage reports"
set +evx
echo -en "travis_fold:end:script.lcov\\r"

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

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

View File

@ -6,7 +6,55 @@ on:
- 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"]
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 \
-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

View File

@ -40,12 +40,12 @@ jobs:
vmImage: "macOS-latest"
cli11.std: 11
Windows17:
vmImage: "vs2017-win2016"
vmImage: "windows-2019"
cli11.std: 17
Windows11:
vmImage: "vs2017-win2016"
vmImage: "windows-2019"
cli11.std: 11
Windowslatest:
WindowsLatest:
vmImage: "windows-2019"
cli11.std: 20
cli11.options: -DCMAKE_CXX_FLAGS="/std:c++latest /EHsc"

View File

@ -4,7 +4,7 @@ from __future__ import print_function, unicode_literals
import os
import re
from argparse import ArgumentParser
import argparse
from subprocess import Popen, PIPE
import warnings
@ -128,8 +128,9 @@ def make_header(output, main_header, files, tag, namespace, macro=None, version=
if __name__ == "__main__":
parser = ArgumentParser(
usage="Convert source to single header include. Can optionally add namespace and search-replace replacements (for macros)."
parser = argparse.ArgumentParser(
usage="Convert source to single header include. Can optionally add namespace and search-replace replacements (for macros).",
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
)
parser.add_argument("--output", default=None, help="Single header file output")
parser.add_argument(
@ -137,7 +138,7 @@ if __name__ == "__main__":
default="CLI11.hpp.in",
help="The main include file that defines the other files",
)
parser.add_argument("files", nargs="*", help="The header files")
parser.add_argument("files", nargs="+", help="The header files")
parser.add_argument("--namespace", default="CLI", help="Set the namespace")
parser.add_argument("--tag", default="CLI11", help="Tag to look up")
parser.add_argument(