Files
jwt-cpp/.github/workflows/cmake.yml
Chris Mc a751ea2272 🌱 Utilize gtest's TypeParam to change traits implementation during testing (#423)
* utilize TypeParam to change traits implementation

explains why coverage hits were so slow

* fixup danielaparker-jsoncons locally

* fixup open_source_parsers_jsoncpp

tested locally

* cleanup lcov args

* add install script for osp/jsoncpp

* linting

* install script for boost

* boost outputs json in different order

this si allowed so the tests are now more relaxed when matching tokens

* update gtest to install gmock as well

* update gtest

* add default version for gtest

* lower gtest for min cmake compat test

* fix typo

* find gtest package is now config

* add back install for lcov

* try forcing install on

* debug print cmake cache file from gtest

* try install with make directly

* workaround for gtest 1.16 cmake install

* lower gtest to match cmake_min_versions

* enable picojson lint tests generation

* move negative decode tests

* linter

* explicit trait test for picojson

* lint
2026-03-17 19:48:25 -07:00

278 lines
7.0 KiB
YAML

name: CMake CI
on:
push:
branches: [master]
pull_request:
branches: [master]
paths:
- "CMakeLists.txt"
- "cmake/**"
- "include/jwt-cpp/**"
- "tests/cmake/**"
- ".github/actions/**"
- ".github/workflows/cmake.yml"
jobs:
default-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: lukka/get-cmake@latest
- name: setup
run: |
cmake --preset release
sudo cmake --build --preset release --target install
- name: test
working-directory: tests/cmake
run: |
cmake . -DTEST:STRING="defaults-enabled" -DCMAKE_FIND_DEBUG_MODE=1
cmake --build .
default-linux-with-examples:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: lukka/get-cmake@latest
- name: setup
run: |
mkdir build
cd build
cmake .. -DJWT_BUILD_EXAMPLES=ON
sudo cmake --install .
- name: test
working-directory: tests/cmake
run: |
cmake . -DTEST:STRING="defaults-enabled"
cmake --build .
default-win:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: lukka/get-cmake@latest
- run: choco install openssl
- name: setup
run: |
cmake -E make_directory build
cd build
cmake .. -DJWT_BUILD_EXAMPLES=OFF
cmake --install .
- name: test
run: |
cd tests/cmake
cmake . -DTEST:STRING="defaults-enabled" -DCMAKE_FIND_DEBUG_MODE=1
cmake --build .
min-req:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/install/cmake
with:
version: "3.14.7"
url: "https://cmake.org/files/v3.14/cmake-3.14.7.tar.gz"
- uses: ./.github/actions/install/gtest
with:
version: "1.16.0" # Compatible with CMake 3.14, required 3.13
- name: setup
run: |
mkdir build
cd build
cmake .. -DJWT_BUILD_EXAMPLES=ON -DJWT_BUILD_TESTS=ON
sudo make install
- name: test
run: |
cd tests/cmake
cmake . -DTEST:STRING="defaults-enabled"
cmake --build .
preset-support-but-not-enough:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/install/cmake
with:
version: "3.24.4"
url: "https://cmake.org/files/v3.24/cmake-3.24.4.tar.gz"
- uses: ./.github/actions/install/gtest
- name: setup
run: |
mkdir build
cd build
cmake .. -DJWT_BUILD_EXAMPLES=ON -DJWT_BUILD_TESTS=ON
sudo make install
- name: test
run: |
cd tests/cmake
cmake . -DTEST:STRING="defaults-enabled"
cmake --build .
custom-install-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: lukka/get-cmake@latest
- name: setup
run: |
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX:STRING="/opt/jwt-cpp" -DJWT_BUILD_EXAMPLES=OFF
make install
- name: test
run: |
cd tests/cmake
cmake . -DCMAKE_PREFIX_PATH="/opt/jwt-cpp" -DTEST:STRING="defaults-enabled" -DCMAKE_FIND_DEBUG_MODE=1
cmake --build .
root-hint-install-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: lukka/get-cmake@latest
- name: setup
run: |
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX:STRING="/opt/jwt-cpp" -DJWT_BUILD_EXAMPLES=OFF
make install
- name: test
run: |
cd tests/cmake
cmake . -Djwt-cpp_ROOT="/opt/jwt-cpp" -DTEST:STRING="defaults-enabled" -DCMAKE_FIND_DEBUG_MODE=1
cmake --build .
custom-install-win:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: lukka/get-cmake@latest
- run: choco install openssl
- name: setup
run: |
cmake -E make_directory build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX:STRING="C:/jwt-cpp" -DJWT_BUILD_EXAMPLES=OFF
cmake --install .
- name: test
run: |
cd tests/cmake
cmake . -DCMAKE_PREFIX_PATH="C:/jwt-cpp" -DTEST:STRING="defaults-enabled" -DCMAKE_FIND_DEBUG_MODE=1
cmake --build .
no-pico:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: lukka/get-cmake@latest
- name: setup
run: |
mkdir build
cd build
cmake .. -DJWT_DISABLE_PICOJSON=ON -DJWT_BUILD_EXAMPLES=OFF
sudo make install
- name: test
run: |
cd tests/cmake
cmake . -DCMAKE_PREFIX_PATH=/usr/local/cmake -DTEST:STRING="picojson-is-disabled"
cmake --build .
no-base64:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: lukka/get-cmake@latest
- name: setup
run: |
mkdir build
cd build
cmake .. -DJWT_DISABLE_BASE64=ON -DJWT_BUILD_EXAMPLES=OFF
sudo make install
- name: test
run: |
cd tests/cmake
cmake . -DCMAKE_PREFIX_PATH=/usr/local/cmake -DTEST:STRING="base64-is-disabled"
cmake --build .
with-libressl:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: lukka/get-cmake@latest
- uses: ./.github/actions/install/libressl
- name: setup
run: |
mkdir build
cd build
cmake .. -DJWT_SSL_LIBRARY:STRING="LibreSSL" -DJWT_BUILD_EXAMPLES=OFF
sudo make install
- name: test
run: |
cd tests/cmake
cmake . -DCMAKE_PREFIX_PATH=/usr/local/cmake -DCMAKE_MODULE_PATH=../../cmake -DTEST:STRING="libressl-is-used"
cmake --build .
with-wolfssl:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: lukka/get-cmake@latest
- uses: ./.github/actions/install/wolfssl
with:
version: ab3bbf11e9d39b52e24bf42bbc6babc16d4a669b
- name: setup
run: |
mkdir build
cd build
cmake .. -DJWT_SSL_LIBRARY:STRING="wolfSSL" -DJWT_BUILD_EXAMPLES=OFF
sudo make install
- name: test
run: |
cd tests/cmake
cmake . -DTEST:STRING="wolfssl-is-used"
cmake --build .
with-hunter: # This is actually testing the integration with the package management
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: lukka/get-cmake@latest
with:
cmakeVersion: "~3.25.0" # <--= optional, use most recent 3.25.x version
- name: setup
run: |
mkdir build
cd build
cmake .. -DJWT_BUILD_TESTS=ON -DJWT_BUILD_EXAMPLES=ON -DJWT_ENABLE_COVERAGE=OFF -DHUNTER_ENABLED=ON
make
- name: test
run: |
cd build
./tests/jwt-cpp-test