Merge branch 'master' into compile-examples

This commit is contained in:
Dominik Thalhammer
2020-07-06 12:24:08 +02:00
committed by GitHub
7 changed files with 93 additions and 5 deletions

39
.github/workflows/coverage.yml vendored Normal file
View File

@@ -0,0 +1,39 @@
name: C/C++ CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: install cmake
uses: lukka/get-cmake@v3.17.2
- name: configure
run: |
sudo apt update
sudo apt install libgtest-dev lcov
(cd /usr/src/gtest && sudo `which cmake` .)
sudo make -C /usr/src/gtest
sudo ln -s /usr/src/gtest/libgtest.a /usr/lib/libgtest.a
sudo ln -s /usr/src/gtest/libgtest_main.a /usr/lib/libgtest_main.a
mkdir build
cd build
cmake .. -DBUILD_TESTS=ON -DCOVERAGE=ON -DCMAKE_BUILD_TYPE=Debug
- name: make
run: cd build && make jwt-cpp-test coverage
- name: Coveralls GitHub Action
uses: coverallsapp/github-action@v1.1.1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: build/coverage.info

21
.github/workflows/documentation.yml vendored Normal file
View File

@@ -0,0 +1,21 @@
name: Documentation CI
on:
push:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: run doxygen
uses: mattnotmitt/doxygen-action@v1
- name: deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/html
force_orphan: true

View File

@@ -5,6 +5,7 @@ if(CMAKE_TOOLCHAIN_FILE)
endif()
option(BUILD_TESTS "Configure CMake to build tests (or not)" ON)
option(COVERAGE "Enable code coverage testing" OFF)
option(EXTERNAL_PICOJSON "Use find_package() to locate the picojson header" OFF)
option(DISABLE_JWT_CPP_BASE64
"Do not include the base64 implementation from this library" OFF)
@@ -16,6 +17,8 @@ project(jwt-cpp)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
find_package(OpenSSL 1.0.2 REQUIRED)
if(EXTERNAL_PICOJSON)

View File

@@ -38,7 +38,7 @@ PROJECT_NAME = "JWT-C++"
# could be handy for archiving the generated documentation or if some version
# control system is used.
PROJECT_NUMBER =
PROJECT_NUMBER = 0.5.0-dev
# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
@@ -889,7 +889,7 @@ EXCLUDE_SYMLINKS = NO
# Note that the wildcards are matched against the file with absolute path, so to
# exclude all test directories for example use the pattern */test/*
EXCLUDE_PATTERNS =
EXCLUDE_PATTERNS = *nlohmann*, *picojson*
# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
# (namespaces, classes, functions, etc.) that should be excluded from the
@@ -900,13 +900,13 @@ EXCLUDE_PATTERNS =
# Note that the wildcards are matched against the file with absolute path, so to
# exclude all test directories use the pattern */test/*
EXCLUDE_SYMBOLS =
EXCLUDE_SYMBOLS = jwt::details
# The EXAMPLE_PATH tag can be used to specify one or more files or directories
# that contain example code fragments that are included (see the \include
# command).
EXAMPLE_PATH =
EXAMPLE_PATH = examples
# If the value of the EXAMPLE_PATH tag contains directories, you can use the
# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and
@@ -1666,7 +1666,7 @@ EXTRA_SEARCH_MAPPINGS =
# If the GENERATE_LATEX tag is set to YES, doxygen will generate LaTeX output.
# The default value is: YES.
GENERATE_LATEX = YES
GENERATE_LATEX = NO
# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. If a
# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of

View File

@@ -2,6 +2,7 @@
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/5f7055e294744901991fd0a1620b231d)](https://app.codacy.com/app/Thalhammer/jwt-cpp?utm_source=github.com&utm_medium=referral&utm_content=Thalhammer/jwt-cpp&utm_campaign=Badge_Grade_Settings)
[![Build Status](https://travis-ci.com/Thalhammer/jwt-cpp.svg?branch=master)](https://travis-ci.com/Thalhammer/jwt-cpp)
[![Coverage Status](https://coveralls.io/repos/github/Thalhammer/jwt-cpp/badge.svg?branch=master)](https://coveralls.io/github/Thalhammer/jwt-cpp?branch=master)
A header only library for creating and validating json web tokens in c++.

15
cmake/code-coverage.cmake Normal file
View File

@@ -0,0 +1,15 @@
set(COVERAGE_CMAKE "${CMAKE_BINARY_DIR}/cmake/CodeCoverage.cmake")
if(NOT EXISTS ${COVERAGE_CMAKE})
set(COVERAGE_URL
"https://raw.githubusercontent.com/bilke/cmake-modules/master/CodeCoverage.cmake"
)
file(DOWNLOAD ${COVERAGE_URL} ${COVERAGE_CMAKE})
endif()
include(${COVERAGE_CMAKE})
function(setup_coverage TARGET)
target_compile_options(${TARGET} PRIVATE -g -O0 -fprofile-arcs
-ftest-coverage)
target_link_libraries(${TARGET} PRIVATE gcov)
endfunction()

View File

@@ -35,3 +35,12 @@ target_link_libraries(jwt-cpp-test PRIVATE jwt-cpp::jwt-cpp GTest::GTest
GTest::Main pthread)
gtest_add_tests(TARGET jwt-cpp-test)
if(${COVERAGE})
include("code-coverage")
setup_coverage(jwt-cpp-test)
set(COVERAGE_EXCLUDES "/usr/**" "/home/*/.conan/**" "*test*" "*build*" "*json*")
setup_target_for_coverage_lcov(NAME coverage EXECUTABLE
${CMAKE_CURRENT_BINARY_DIR}/jwt-cpp-test)
endif()