From 0585512cad6a77cb04f880d1fecf52a88f7e840b Mon Sep 17 00:00:00 2001 From: Christopher McArthur Date: Sun, 22 Nov 2026 22:28:09 -0800 Subject: [PATCH 1/8] bump versions --- .github/actions/install/boost-json/action.yml | 2 +- .../actions/install/boost-json/install-boost-json.sh | 3 +-- .../actions/install/danielaparker-jsoncons/action.yml | 2 +- .../danielaparker-jsoncons/install-jsoncons.sh | 4 +--- .github/actions/install/glaze-json/action.yml | 2 +- .github/actions/install/glaze-json/install-glaze.sh | 2 +- .github/actions/install/libressl/action.yml | 2 +- .../install/open-source-parsers-jsoncpp/action.yml | 2 +- .../open-source-parsers-jsoncpp/install-jsoncpp.sh | 2 +- .github/actions/install/openssl/action.yml | 2 +- .github/actions/install/reflectcpp-json/action.yml | 2 +- .../install/reflectcpp-json/install-reflect-cpp.sh | 2 +- .github/actions/install/wolfssl/action.yml | 2 +- .github/workflows/jwt.yml | 2 +- .github/workflows/ssl.yml | 8 +++++--- .github/workflows/traits.yml | 10 +++++----- docs/ssl.md | 11 ++++++++--- 17 files changed, 32 insertions(+), 28 deletions(-) diff --git a/.github/actions/install/boost-json/action.yml b/.github/actions/install/boost-json/action.yml index edebb5b7e..f6396219b 100644 --- a/.github/actions/install/boost-json/action.yml +++ b/.github/actions/install/boost-json/action.yml @@ -4,7 +4,7 @@ inputs: version: description: The desired Boost.JSON version to install required: false - default: "1.90.0" + default: "1.92.0" runs: using: composite steps: diff --git a/.github/actions/install/boost-json/install-boost-json.sh b/.github/actions/install/boost-json/install-boost-json.sh index 66d78a97c..7b604f5ec 100755 --- a/.github/actions/install/boost-json/install-boost-json.sh +++ b/.github/actions/install/boost-json/install-boost-json.sh @@ -13,8 +13,7 @@ if [[ -z "$1" ]] || [[ "$1" == "-h" ]] || [[ "$1" == "--help" ]]; then echo " VERSION Boost.JSON version to install (required)" echo "" echo "Examples:" - echo " $0 1.90.0" - echo " $0 1.89.0" + echo " $0 1.92.0" exit 1 fi diff --git a/.github/actions/install/danielaparker-jsoncons/action.yml b/.github/actions/install/danielaparker-jsoncons/action.yml index e29bbd004..6fa6bbade 100644 --- a/.github/actions/install/danielaparker-jsoncons/action.yml +++ b/.github/actions/install/danielaparker-jsoncons/action.yml @@ -4,7 +4,7 @@ inputs: version: description: The desired jsoncons version to install required: false - default: "1.3.2" + default: "1.10.0" runs: using: composite steps: diff --git a/.github/actions/install/danielaparker-jsoncons/install-jsoncons.sh b/.github/actions/install/danielaparker-jsoncons/install-jsoncons.sh index 18bf37dc7..f99566e5e 100755 --- a/.github/actions/install/danielaparker-jsoncons/install-jsoncons.sh +++ b/.github/actions/install/danielaparker-jsoncons/install-jsoncons.sh @@ -13,9 +13,7 @@ if [[ -z "$1" ]] || [[ "$1" == "-h" ]] || [[ "$1" == "--help" ]]; then echo " VERSION jsoncons version to install (required)" echo "" echo "Examples:" - echo " $0 1.5.0" - echo " $0 1.4.3" - echo " $0 1.3.2" + echo " $0 1.10.0" exit 1 fi diff --git a/.github/actions/install/glaze-json/action.yml b/.github/actions/install/glaze-json/action.yml index c88bad295..e8620fd95 100644 --- a/.github/actions/install/glaze-json/action.yml +++ b/.github/actions/install/glaze-json/action.yml @@ -4,7 +4,7 @@ inputs: version: description: The desired Glaze version to install required: false - default: "7.0.2" + default: "9.1.0" runs: using: composite steps: diff --git a/.github/actions/install/glaze-json/install-glaze.sh b/.github/actions/install/glaze-json/install-glaze.sh index 95b419a61..c50732ce0 100755 --- a/.github/actions/install/glaze-json/install-glaze.sh +++ b/.github/actions/install/glaze-json/install-glaze.sh @@ -13,7 +13,7 @@ if [[ -z "$1" ]] || [[ "$1" == "-h" ]] || [[ "$1" == "--help" ]]; then echo " VERSION glaze version to install (required)" echo "" echo "Examples:" - echo " $0 7.0.2" + echo " $0 9.1.0" exit 1 fi diff --git a/.github/actions/install/libressl/action.yml b/.github/actions/install/libressl/action.yml index 55cdc4c0f..9ff05241a 100644 --- a/.github/actions/install/libressl/action.yml +++ b/.github/actions/install/libressl/action.yml @@ -4,7 +4,7 @@ inputs: version: description: The desired LibreSSL version to install required: false - default: "4.2.1" + default: "4.4.1" runs: using: composite steps: diff --git a/.github/actions/install/open-source-parsers-jsoncpp/action.yml b/.github/actions/install/open-source-parsers-jsoncpp/action.yml index 34e0692b4..984ee1175 100644 --- a/.github/actions/install/open-source-parsers-jsoncpp/action.yml +++ b/.github/actions/install/open-source-parsers-jsoncpp/action.yml @@ -4,7 +4,7 @@ inputs: version: description: The desired open-source-parsers/jsoncpp version to install required: false - default: "1.9.6" + default: "1.9.8" runs: using: composite steps: diff --git a/.github/actions/install/open-source-parsers-jsoncpp/install-jsoncpp.sh b/.github/actions/install/open-source-parsers-jsoncpp/install-jsoncpp.sh index 13838a5a7..33ef46144 100755 --- a/.github/actions/install/open-source-parsers-jsoncpp/install-jsoncpp.sh +++ b/.github/actions/install/open-source-parsers-jsoncpp/install-jsoncpp.sh @@ -13,7 +13,7 @@ if [[ -z "$1" ]] || [[ "$1" == "-h" ]] || [[ "$1" == "--help" ]]; then echo " VERSION jsoncpp version to install (required)" echo "" echo "Examples:" - echo " $0 1.9.6" + echo " $0 1.9.8" exit 1 fi diff --git a/.github/actions/install/openssl/action.yml b/.github/actions/install/openssl/action.yml index 83c03a29e..87749d316 100644 --- a/.github/actions/install/openssl/action.yml +++ b/.github/actions/install/openssl/action.yml @@ -4,7 +4,7 @@ inputs: version: description: The desired OpenSSL version to install required: false - default: "openssl-3.0.0" + default: "openssl-4.1.0" runs: using: composite steps: diff --git a/.github/actions/install/reflectcpp-json/action.yml b/.github/actions/install/reflectcpp-json/action.yml index 0853cbf9c..4056be76c 100644 --- a/.github/actions/install/reflectcpp-json/action.yml +++ b/.github/actions/install/reflectcpp-json/action.yml @@ -4,7 +4,7 @@ inputs: version: description: The desired reflect-cpp version to install required: false - default: "0.24.0" + default: "0.27.1" runs: using: composite steps: diff --git a/.github/actions/install/reflectcpp-json/install-reflect-cpp.sh b/.github/actions/install/reflectcpp-json/install-reflect-cpp.sh index 6793920a9..bd112bd11 100755 --- a/.github/actions/install/reflectcpp-json/install-reflect-cpp.sh +++ b/.github/actions/install/reflectcpp-json/install-reflect-cpp.sh @@ -13,7 +13,7 @@ if [[ -z "$1" ]] || [[ "$1" == "-h" ]] || [[ "$1" == "--help" ]]; then echo " VERSION reflect-cpp version to install (required)" echo "" echo "Examples:" - echo " $0 0.24.0" + echo " $0 0.27.1" exit 1 fi diff --git a/.github/actions/install/wolfssl/action.yml b/.github/actions/install/wolfssl/action.yml index 013cdb98e..2f291d763 100644 --- a/.github/actions/install/wolfssl/action.yml +++ b/.github/actions/install/wolfssl/action.yml @@ -4,7 +4,7 @@ inputs: version: description: The desired stable wolfSSL version to install required: false - default: "v4.8.1-stable" + default: "v5.9.4-stable" runs: using: composite steps: diff --git a/.github/workflows/jwt.yml b/.github/workflows/jwt.yml index f34c2d6cd..83ecc6336 100644 --- a/.github/workflows/jwt.yml +++ b/.github/workflows/jwt.yml @@ -54,7 +54,7 @@ jobs: fail-fast: false matrix: openssl: - - { tag: "openssl-3.6.1", name: "3.6.1" } + - { tag: "openssl-4.1.0", name: "4.1.0" } - { tag: "OpenSSL_1_1_1w", name: "1.1.1w" } steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/ssl.yml b/.github/workflows/ssl.yml index 580e3b980..4bd4e42d2 100644 --- a/.github/workflows/ssl.yml +++ b/.github/workflows/ssl.yml @@ -12,6 +12,7 @@ jobs: strategy: matrix: openssl: + - { tag: "openssl-4.1.0", name: "4.1.0" } - { tag: "openssl-3.0.19", name: "3.0.19" } - { tag: "openssl-3.5.5", name: "3.5.5" } - { tag: "openssl-3.6.1", name: "3.6.1" } @@ -38,14 +39,14 @@ jobs: openssl-no-deprecated: runs-on: ubuntu-latest - name: OpenSSL 3.6 No Deprecated + name: OpenSSL 4.1 No Deprecated steps: - uses: actions/checkout@v4 - uses: lukka/get-cmake@latest - uses: ./.github/actions/install/gtest - uses: ./.github/actions/install/openssl with: - version: "openssl-3.6.1" + version: "openssl-4.1.0" - name: configure run: cmake --preset unit-tests -DCMAKE_CXX_FLAGS="-DOPENSSL_NO_DEPRECATED=1" -DCMAKE_C_FLAGS="-DOPENSSL_NO_DEPRECATED=1" @@ -58,7 +59,7 @@ jobs: strategy: fail-fast: false matrix: - libressl: ["4.2.1", "4.1.2", "3.9.2"] + libressl: ["4.4.1", "4.2.1", "4.1.2", "3.9.2"] name: LibreSSL ${{ matrix.libressl }} steps: - uses: actions/checkout@v4 @@ -89,6 +90,7 @@ jobs: - { ref: "v5.2.0-stable", name: "5.2.0" } - { ref: "v5.3.0-stable", name: "5.3.0"} - { ref: "v5.7.0-stable", name: "5.7.0"} + - { ref: "v5.9.4-stable", name: "5.9.4"} name: wolfSSL ${{ matrix.wolfssl.name }} steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/traits.yml b/.github/workflows/traits.yml index c1866b061..9e3a513a1 100644 --- a/.github/workflows/traits.yml +++ b/.github/workflows/traits.yml @@ -16,13 +16,13 @@ jobs: strategy: matrix: target: - - { name: "danielaparker-jsoncons", tag: "1.3.2", version: "v1.3.2" } - - { name: "boost-json", tag: "1.90.0", version: "v1.90.0" } + - { name: "danielaparker-jsoncons", tag: "1.10.0", version: "v1.10.0" } + - { name: "boost-json", tag: "1.92.0", version: "v1.92.0" } - { name: "nlohmann-json", tag: "3.12.0", version: "v3.12.0" } - { name: "kazuho-picojson", tag: "111c9be5188f7350c2eac9ddaedd8cca3d7bf394", version: "111c9be" } - - { name: "open-source-parsers-jsoncpp", tag: "1.9.6", version: "v1.9.6" } - - { name: "glaze-json", tag: "7.0.2", version: "v7.0.2" } - - { name: "reflectcpp-json", tag: "0.24.0", version: "v0.24.0" } + - { name: "open-source-parsers-jsoncpp", tag: "1.9.8", version: "v1.9.8" } + - { name: "glaze-json", tag: "9.1.0", version: "v9.1.0" } + - { name: "reflectcpp-json", tag: "0.27.1", version: "v0.27.1" } steps: - uses: actions/checkout@v4 - uses: lukka/get-cmake@latest diff --git a/docs/ssl.md b/docs/ssl.md index f6b9fa834..d0f9952f2 100644 --- a/docs/ssl.md +++ b/docs/ssl.md @@ -18,9 +18,10 @@ These are the versions which are currently being tested: | OpenSSL | LibreSSL | wolfSSL | | --------------------- | ------------------ | -------------- | -| ![3.0.19][o3.0] | ![4.2.1][l4.2] | ![5.1.1][w5.1] | -| ![3.5.5][o3.5] :star: | ![4.1.2][l4.1] | ![5.2.0][w5.2] | -| ![3.6.1][o3.6] | ![3.9.2][l3.9] | ![5.3.0][w5.3] | +| ![4.1.0][o4.1] | ![4.4.1][l4.4] | ![5.1.1][w5.1] | +| ![3.5.5][o3.5] :star: | ![4.2.1][l4.2] | ![5.2.0][w5.2] | +| ![3.6.1][o3.6] | ![4.1.2][l4.1] | ![5.3.0][w5.3] | +| ![3.0.19][o3.0] | ![3.9.2][l3.9] | ![5.9.4][w5.9] | | ![1.1.1w][o1.1.1] | | | | ![1.0.2u][o1.0.2] | | | @@ -30,6 +31,7 @@ These are the versions which are currently being tested: > - **3.0.19**: Supported until 2026-09-07 (LTS) > - **3.5.5**: Supported until 2030-04-08 (LTS) > - **3.6.1**: Supported until 2026-11-01 +> - **4.1.0**: Latest stable release > > A complete list of versions tested in the past can be found [on this branch](https://github.com/Thalhammer/jwt-cpp/tree/badges). @@ -38,12 +40,15 @@ These are the versions which are currently being tested: [o3.0]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/Thalhammer/jwt-cpp/badges/openssl/3.0.19/shields.json [o3.5]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/Thalhammer/jwt-cpp/badges/openssl/3.5.5/shields.json [o3.6]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/Thalhammer/jwt-cpp/badges/openssl/3.6.1/shields.json +[o4.1]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/Thalhammer/jwt-cpp/badges/openssl/4.1.0/shields.json +[l4.4]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/Thalhammer/jwt-cpp/badges/libressl/4.4.1/shields.json [l4.2]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/Thalhammer/jwt-cpp/badges/libressl/4.2.1/shields.json [l4.1]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/Thalhammer/jwt-cpp/badges/libressl/4.1.2/shields.json [l3.9]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/Thalhammer/jwt-cpp/badges/libressl/3.9.2/shields.json [w5.1]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/Thalhammer/jwt-cpp/badges/wolfssl/5.1.1/shields.json [w5.2]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/Thalhammer/jwt-cpp/badges/wolfssl/5.2.0/shields.json [w5.3]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/Thalhammer/jwt-cpp/badges/wolfssl/5.3.0/shields.json +[w5.9]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/Thalhammer/jwt-cpp/badges/wolfssl/5.9.4/shields.json ## Notes From 2bfb1bcc02e4e5ec9de5f70f67bbc816c1a30d35 Mon Sep 17 00:00:00 2001 From: Christopher McArthur Date: Mon, 23 Nov 2026 08:30:36 -0800 Subject: [PATCH 2/8] code cleanup for install scripts --- .github/actions/install/boost-json/action.yml | 4 +- .../install/boost-json/install-boost-json.sh | 64 ++++--------- .github/actions/install/common.sh | 92 +++++++++++++++++++ .../install/danielaparker-jsoncons/action.yml | 4 +- .../install-jsoncons.sh | 63 ++++--------- .github/actions/install/glaze-json/action.yml | 4 +- .../install/glaze-json/install-glaze.sh | 65 ++++--------- .github/actions/install/gtest/action.yml | 4 +- .../actions/install/gtest/install-gtest.sh | 66 ++++--------- .../install/kazuho-picojson/action.yml | 9 +- .../kazuho-picojson/install-picojson.sh | 15 +++ .github/actions/install/libressl/action.yml | 4 +- .../install/libressl/install-libressl.sh | 44 ++++----- .../actions/install/nlohmann-json/action.yml | 10 +- .../nlohmann-json/install-nlohmann-json.sh | 18 ++++ .../open-source-parsers-jsoncpp/action.yml | 4 +- .../install-jsoncpp.sh | 67 ++++---------- .github/actions/install/openssl/action.yml | 13 +-- .../install/openssl/install-openssl.sh | 18 ++++ .../install/reflectcpp-json/action.yml | 4 +- .../reflectcpp-json/install-reflect-cpp.sh | 64 ++++--------- .github/actions/install/wolfssl/action.yml | 6 +- .../install/wolfssl/install-wolfssl.sh | 46 ++++------ .github/workflows/ssl.yml | 24 +++++ .github/workflows/traits.yml | 17 ++-- 25 files changed, 351 insertions(+), 378 deletions(-) create mode 100644 .github/actions/install/common.sh create mode 100755 .github/actions/install/kazuho-picojson/install-picojson.sh create mode 100755 .github/actions/install/nlohmann-json/install-nlohmann-json.sh create mode 100755 .github/actions/install/openssl/install-openssl.sh diff --git a/.github/actions/install/boost-json/action.yml b/.github/actions/install/boost-json/action.yml index f6396219b..61c045969 100644 --- a/.github/actions/install/boost-json/action.yml +++ b/.github/actions/install/boost-json/action.yml @@ -8,5 +8,7 @@ inputs: runs: using: composite steps: - - run: ${{ github.action_path }}/install-boost-json.sh ${{ inputs.version }} + - run: '"$GITHUB_ACTION_PATH/install-boost-json.sh" "$VERSION" --prefix "$RUNNER_TEMP/jwt-cpp-deps" --jobs "$(nproc)"' shell: bash + env: + VERSION: ${{ inputs.version }} diff --git a/.github/actions/install/boost-json/install-boost-json.sh b/.github/actions/install/boost-json/install-boost-json.sh index 7b604f5ec..1bdb5dd0a 100755 --- a/.github/actions/install/boost-json/install-boost-json.sh +++ b/.github/actions/install/boost-json/install-boost-json.sh @@ -1,47 +1,19 @@ #!/usr/bin/env bash -# Install Boost.JSON library with specified version - -set -e # Exit on error - -# Check if version is provided -if [[ -z "$1" ]] || [[ "$1" == "-h" ]] || [[ "$1" == "--help" ]]; then - echo "Usage: $0 VERSION" - echo "" - echo "Install Boost.JSON library" - echo "" - echo "Arguments:" - echo " VERSION Boost.JSON version to install (required)" - echo "" - echo "Examples:" - echo " $0 1.92.0" - exit 1 -fi - -BOOST_JSON_VERSION="$1" -INSTALL_DIR="/tmp" -BUILD_DIR="${INSTALL_DIR}/boost-${BOOST_JSON_VERSION}" - -echo "Installing Boost.JSON v${BOOST_JSON_VERSION}..." - -# Download -echo "Downloading Boost.JSON v${BOOST_JSON_VERSION}..." -cd "${INSTALL_DIR}" -wget -q "https://github.com/boostorg/boost/releases/download/boost-${BOOST_JSON_VERSION}/boost-${BOOST_JSON_VERSION}-cmake.tar.xz" - -# Extract -echo "Extracting archive..." -tar -xf "boost-${BOOST_JSON_VERSION}-cmake.tar.xz" - -# Build and install -echo "Building and installing..." -cd "${BUILD_DIR}" -cmake . -DCMAKE_BUILD_TYPE=Release -DBOOST_INCLUDE_LIBRARIES="json" -cmake --build . --config Release -sudo cmake --install . - -# Cleanup -echo "Cleaning up..." -rm -f "${INSTALL_DIR}/boost-${BOOST_JSON_VERSION}-cmake.tar.xz" -rm -rf "${BUILD_DIR}" - -echo "✓ Boost.JSON v${BOOST_JSON_VERSION} installed successfully!" +set -euo pipefail + +SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)" +source "$SCRIPT_DIR/../common.sh" +install_init "$@" +install_require cmake + +SOURCE_DIR="$INSTALL_WORK_DIR/boost-${INSTALL_VERSION}" +BUILD_DIR="$INSTALL_WORK_DIR/build" +install_download_extract \ + "https://github.com/boostorg/boost/releases/download/boost-${INSTALL_VERSION}/boost-${INSTALL_VERSION}-cmake.tar.xz" \ + "boost-${INSTALL_VERSION}-cmake.tar.xz" +cmake -S "$SOURCE_DIR" -B "$BUILD_DIR" -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX="$INSTALL_PREFIX" -DBOOST_INCLUDE_LIBRARIES=json -DBUILD_TESTING=OFF +cmake --build "$BUILD_DIR" --config Release --parallel "$INSTALL_JOBS" +cmake --install "$BUILD_DIR" --config Release +install_publish_environment +echo "Boost.JSON ${INSTALL_VERSION} installed under ${INSTALL_PREFIX}" diff --git a/.github/actions/install/common.sh b/.github/actions/install/common.sh new file mode 100644 index 000000000..cafb76527 --- /dev/null +++ b/.github/actions/install/common.sh @@ -0,0 +1,92 @@ +#!/usr/bin/env bash + +install_init() { + INSTALL_VERSION="${1:-}" + if [[ "$INSTALL_VERSION" == "-h" || "$INSTALL_VERSION" == "--help" ]]; then + echo "Usage: $0 VERSION [--prefix PATH] [--jobs N]" + exit 0 + fi + if [[ -z "$INSTALL_VERSION" ]]; then + echo "Usage: $0 VERSION [--prefix PATH] [--jobs N]" >&2 + exit 1 + fi + shift + + INSTALL_PREFIX="${JWT_CPP_INSTALL_PREFIX:-$HOME/.local}" + INSTALL_JOBS="${JWT_CPP_INSTALL_JOBS:-2}" + while [[ $# -gt 0 ]]; do + case "$1" in + --prefix) + [[ $# -ge 2 && -n "$2" ]] || { echo "Missing path after --prefix" >&2; return 2; } + INSTALL_PREFIX="$2" + shift 2 + ;; + --jobs) + [[ $# -ge 2 && "$2" =~ ^[1-9][0-9]*$ ]] || { echo "--jobs must be a positive integer" >&2; return 2; } + INSTALL_JOBS="$2" + shift 2 + ;; + *) + echo "Unknown option: $1" >&2 + return 2 + ;; + esac + done + case "$INSTALL_PREFIX" in + *$'\n'*) echo "Install prefix cannot contain a newline" >&2; return 2 ;; + esac + + mkdir -p "$INSTALL_PREFIX" + INSTALL_WORK_DIR="$(mktemp -d "${TMPDIR:-/tmp}/jwt-cpp-install.XXXXXX")" + trap 'rm -rf "$INSTALL_WORK_DIR"' EXIT +} + +install_require() { + local command + for command in "$@"; do + if ! command -v "$command" >/dev/null 2>&1; then + echo "Required command not found: $command" >&2 + return 1 + fi + done +} + +install_download_extract() { + local url="$1" + local archive="$2" + install_require curl tar + curl --fail --location --retry 3 --silent --show-error "$url" --output "$INSTALL_WORK_DIR/$archive" + tar -xf "$INSTALL_WORK_DIR/$archive" -C "$INSTALL_WORK_DIR" +} + +install_prepend_env() { + local name="$1" + local value="$2" + local current="${!name:-}" + if [[ -n "${GITHUB_ENV:-}" ]]; then + if [[ ":$current:" != *":$value:"* ]]; then + printf '%s=%s\n' "$name" "$value${current:+:$current}" >> "$GITHUB_ENV" + fi + fi +} + +install_set_env() { + local name="$1" + local value="$2" + if [[ -n "${GITHUB_ENV:-}" ]]; then + printf '%s=%s\n' "$name" "$value" >> "$GITHUB_ENV" + fi +} + +install_publish_environment() { + local extra_variable="${1:-}" + local pkgconfig_path="$INSTALL_PREFIX/lib/pkgconfig:$INSTALL_PREFIX/lib64/pkgconfig" + local library_path="$INSTALL_PREFIX/lib:$INSTALL_PREFIX/lib64" + install_prepend_env CMAKE_PREFIX_PATH "$INSTALL_PREFIX" + install_prepend_env PKG_CONFIG_PATH "$pkgconfig_path" + install_prepend_env LD_LIBRARY_PATH "$library_path" + install_prepend_env DYLD_LIBRARY_PATH "$library_path" + if [[ -n "$extra_variable" ]]; then + install_set_env "$extra_variable" "$INSTALL_PREFIX" + fi +} diff --git a/.github/actions/install/danielaparker-jsoncons/action.yml b/.github/actions/install/danielaparker-jsoncons/action.yml index 6fa6bbade..c5520d5fb 100644 --- a/.github/actions/install/danielaparker-jsoncons/action.yml +++ b/.github/actions/install/danielaparker-jsoncons/action.yml @@ -8,5 +8,7 @@ inputs: runs: using: composite steps: - - run: ${{ github.action_path }}/install-jsoncons.sh ${{ inputs.version }} + - run: '"$GITHUB_ACTION_PATH/install-jsoncons.sh" "$VERSION" --prefix "$RUNNER_TEMP/jwt-cpp-deps" --jobs "$(nproc)"' shell: bash + env: + VERSION: ${{ inputs.version }} diff --git a/.github/actions/install/danielaparker-jsoncons/install-jsoncons.sh b/.github/actions/install/danielaparker-jsoncons/install-jsoncons.sh index f99566e5e..1b88b70c2 100755 --- a/.github/actions/install/danielaparker-jsoncons/install-jsoncons.sh +++ b/.github/actions/install/danielaparker-jsoncons/install-jsoncons.sh @@ -1,47 +1,18 @@ #!/usr/bin/env bash -# Install jsoncons library with specified version - -set -e # Exit on error - -# Check if version is provided -if [[ -z "$1" ]] || [[ "$1" == "-h" ]] || [[ "$1" == "--help" ]]; then - echo "Usage: $0 VERSION" - echo "" - echo "Install jsoncons library" - echo "" - echo "Arguments:" - echo " VERSION jsoncons version to install (required)" - echo "" - echo "Examples:" - echo " $0 1.10.0" - exit 1 -fi - -# Configuration -JSONCONS_VERSION="$1" -INSTALL_DIR="/tmp" -BUILD_DIR="${INSTALL_DIR}/jsoncons-${JSONCONS_VERSION}" - -echo "Installing jsoncons v${JSONCONS_VERSION}..." - -# Download -echo "Downloading jsoncons v${JSONCONS_VERSION}..." -cd "${INSTALL_DIR}" -wget -q "https://github.com/danielaparker/jsoncons/archive/v${JSONCONS_VERSION}.tar.gz" - -# Extract -echo "Extracting archive..." -tar -zxf "v${JSONCONS_VERSION}.tar.gz" - -# Build and install -echo "Building and installing..." -cd "${BUILD_DIR}" -cmake . -DCMAKE_BUILD_TYPE=Release -sudo cmake --install . - -# Cleanup -echo "Cleaning up..." -rm -f "${INSTALL_DIR}/v${JSONCONS_VERSION}.tar.gz" -rm -rf "${BUILD_DIR}" - -echo "✓ jsoncons v${JSONCONS_VERSION} installed successfully!" +set -euo pipefail + +SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)" +source "$SCRIPT_DIR/../common.sh" +install_init "$@" +install_require cmake + +SOURCE_DIR="$INSTALL_WORK_DIR/jsoncons-${INSTALL_VERSION}" +BUILD_DIR="$INSTALL_WORK_DIR/build" +install_download_extract "https://github.com/danielaparker/jsoncons/archive/v${INSTALL_VERSION}.tar.gz" \ + "jsoncons-${INSTALL_VERSION}.tar.gz" +cmake -S "$SOURCE_DIR" -B "$BUILD_DIR" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$INSTALL_PREFIX" \ + -DJSONCONS_BUILD_TESTS=OFF +cmake --build "$BUILD_DIR" --parallel "$INSTALL_JOBS" +cmake --install "$BUILD_DIR" +install_publish_environment +echo "jsoncons ${INSTALL_VERSION} installed under ${INSTALL_PREFIX}" diff --git a/.github/actions/install/glaze-json/action.yml b/.github/actions/install/glaze-json/action.yml index e8620fd95..8823ce801 100644 --- a/.github/actions/install/glaze-json/action.yml +++ b/.github/actions/install/glaze-json/action.yml @@ -8,5 +8,7 @@ inputs: runs: using: composite steps: - - run: ${{ github.action_path }}/install-glaze.sh ${{ inputs.version }} + - run: '"$GITHUB_ACTION_PATH/install-glaze.sh" "$VERSION" --prefix "$RUNNER_TEMP/jwt-cpp-deps" --jobs "$(nproc)"' shell: bash + env: + VERSION: ${{ inputs.version }} diff --git a/.github/actions/install/glaze-json/install-glaze.sh b/.github/actions/install/glaze-json/install-glaze.sh index c50732ce0..cb38731d9 100755 --- a/.github/actions/install/glaze-json/install-glaze.sh +++ b/.github/actions/install/glaze-json/install-glaze.sh @@ -1,49 +1,18 @@ #!/usr/bin/env bash -# Install glaze library with specified version - -set -e # Exit on error - -# Check if version is provided -if [[ -z "$1" ]] || [[ "$1" == "-h" ]] || [[ "$1" == "--help" ]]; then - echo "Usage: $0 VERSION" - echo "" - echo "Install glaze library" - echo "" - echo "Arguments:" - echo " VERSION glaze version to install (required)" - echo "" - echo "Examples:" - echo " $0 9.1.0" - exit 1 -fi - -# Configuration -glaze_VERSION="$1" -INSTALL_DIR="/tmp" -BUILD_DIR="${INSTALL_DIR}/glaze-${glaze_VERSION}" - -echo "Installing glaze v${glaze_VERSION}..." - -# Download -echo "Downloading glaze v${glaze_VERSION}..." -cd "${INSTALL_DIR}" -wget -q "https://github.com/stephenberry/glaze/archive/v${glaze_VERSION}.tar.gz" - -# Extract -echo "Extracting archive..." -tar -zxf "v${glaze_VERSION}.tar.gz" - -# Build and install -echo "Building and installing..." -cd "${BUILD_DIR}" -mkdir -p build -cd build -cmake .. -DCMAKE_BUILD_TYPE=Release -sudo cmake --install . - -# Cleanup -echo "Cleaning up..." -rm -f "${INSTALL_DIR}/v${glaze_VERSION}.tar.gz" -rm -rf "${BUILD_DIR}" - -echo "✓ glaze v${glaze_VERSION} installed successfully!" +set -euo pipefail + +SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)" +source "$SCRIPT_DIR/../common.sh" +install_init "$@" +install_require cmake + +SOURCE_DIR="$INSTALL_WORK_DIR/glaze-${INSTALL_VERSION}" +BUILD_DIR="$INSTALL_WORK_DIR/build" +install_download_extract "https://github.com/stephenberry/glaze/archive/v${INSTALL_VERSION}.tar.gz" \ + "glaze-${INSTALL_VERSION}.tar.gz" +cmake -S "$SOURCE_DIR" -B "$BUILD_DIR" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$INSTALL_PREFIX" \ + -Dglaze_DEVELOPER_MODE=OFF +cmake --build "$BUILD_DIR" --parallel "$INSTALL_JOBS" +cmake --install "$BUILD_DIR" +install_publish_environment +echo "Glaze ${INSTALL_VERSION} installed under ${INSTALL_PREFIX}" diff --git a/.github/actions/install/gtest/action.yml b/.github/actions/install/gtest/action.yml index 7211bb223..ee5396bb5 100644 --- a/.github/actions/install/gtest/action.yml +++ b/.github/actions/install/gtest/action.yml @@ -8,5 +8,7 @@ inputs: runs: using: composite steps: - - run: ${{ github.action_path }}/install-gtest.sh ${{ inputs.version }} + - run: '"$GITHUB_ACTION_PATH/install-gtest.sh" "$VERSION" --prefix "$RUNNER_TEMP/jwt-cpp-deps" --jobs "$(nproc)"' shell: bash + env: + VERSION: ${{ inputs.version }} diff --git a/.github/actions/install/gtest/install-gtest.sh b/.github/actions/install/gtest/install-gtest.sh index 7ab50454e..d3fc23060 100755 --- a/.github/actions/install/gtest/install-gtest.sh +++ b/.github/actions/install/gtest/install-gtest.sh @@ -1,48 +1,20 @@ #!/usr/bin/env bash -# Install gtest library with specified version - -set -e # Exit on error - -# Check if version is provided -if [[ -z "$1" ]] || [[ "$1" == "-h" ]] || [[ "$1" == "--help" ]]; then - echo "Usage: $0 VERSION" - echo "" - echo "Install gtest library" - echo "" - echo "Arguments:" - echo " VERSION gtest version to install (required)" - echo "" - echo "Examples:" - echo " $0 1.17.0" - exit 1 -fi - -# Configuration -gtest_VERSION="$1" -INSTALL_DIR="/tmp" -BUILD_DIR="${INSTALL_DIR}/googletest-${gtest_VERSION}" - -echo "Installing gtest v${gtest_VERSION}..." - -# Download -echo "Downloading gtest v${gtest_VERSION}..." -cd "${INSTALL_DIR}" -wget -q "https://github.com/google/googletest/releases/download/v${gtest_VERSION}/googletest-${gtest_VERSION}.tar.gz" - -# Extract -echo "Extracting archive..." -tar -zxf "googletest-${gtest_VERSION}.tar.gz" - -# Build and install -echo "Building and installing..." -cd "${BUILD_DIR}" -cmake . -DCMAKE_BUILD_TYPE=Release -DINSTALL_GTEST=ON -cmake --build . -sudo make install # There's a bug in the v1.16.0 CMakeLists.txt that doesn't properly install the library when invoked via CMake, so we have to use make install directly - -# Cleanup -echo "Cleaning up..." -rm -f "${INSTALL_DIR}/googletest-${gtest_VERSION}.tar.gz" -rm -rf "${BUILD_DIR}" - -echo "✓ gtest v${gtest_VERSION} installed successfully!" +set -euo pipefail + +SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)" +source "$SCRIPT_DIR/../common.sh" +install_init "$@" +install_require cmake make + +SOURCE_DIR="$INSTALL_WORK_DIR/googletest-${INSTALL_VERSION}" +BUILD_DIR="$INSTALL_WORK_DIR/build" +install_download_extract \ + "https://github.com/google/googletest/releases/download/v${INSTALL_VERSION}/googletest-${INSTALL_VERSION}.tar.gz" \ + "googletest-${INSTALL_VERSION}.tar.gz" +cmake -S "$SOURCE_DIR" -B "$BUILD_DIR" -DCMAKE_BUILD_TYPE=Release -DINSTALL_GTEST=ON \ + -DCMAKE_INSTALL_PREFIX="$INSTALL_PREFIX" +cmake --build "$BUILD_DIR" --parallel "$INSTALL_JOBS" +# Use make install because the CMake install target is broken in GTest 1.16.0. +make -C "$BUILD_DIR" -j "$INSTALL_JOBS" install +install_publish_environment +echo "GoogleTest ${INSTALL_VERSION} installed under ${INSTALL_PREFIX}" diff --git a/.github/actions/install/kazuho-picojson/action.yml b/.github/actions/install/kazuho-picojson/action.yml index caf887512..65fc1f3ae 100644 --- a/.github/actions/install/kazuho-picojson/action.yml +++ b/.github/actions/install/kazuho-picojson/action.yml @@ -8,10 +8,7 @@ inputs: runs: using: composite steps: - - run: | - cd /tmp - wget https://github.com/kazuho/picojson/archive/${{ inputs.version }}.tar.gz - tar -zxf /tmp/${{ inputs.version }}.tar.gz - cd picojson-${{ inputs.version }} - sudo cp -v picojson.h /usr/local/include/picojson + - run: '"$GITHUB_ACTION_PATH/install-picojson.sh" "$VERSION" --prefix "$RUNNER_TEMP/jwt-cpp-deps" --jobs "$(nproc)"' shell: bash + env: + VERSION: ${{ inputs.version }} diff --git a/.github/actions/install/kazuho-picojson/install-picojson.sh b/.github/actions/install/kazuho-picojson/install-picojson.sh new file mode 100755 index 000000000..f8c8282fb --- /dev/null +++ b/.github/actions/install/kazuho-picojson/install-picojson.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +set -euo pipefail + +SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)" +source "$SCRIPT_DIR/../common.sh" +install_init "$@" + +ARCHIVE_VERSION="${INSTALL_VERSION#v}" +SOURCE_DIR="$INSTALL_WORK_DIR/picojson-${ARCHIVE_VERSION}" +install_download_extract "https://github.com/kazuho/picojson/archive/${INSTALL_VERSION}.tar.gz" \ + "picojson-${ARCHIVE_VERSION}.tar.gz" +mkdir -p "$INSTALL_PREFIX/include/picojson" +cp "$SOURCE_DIR/picojson.h" "$INSTALL_PREFIX/include/picojson/picojson.h" +install_publish_environment +echo "picojson ${ARCHIVE_VERSION} installed under ${INSTALL_PREFIX}" diff --git a/.github/actions/install/libressl/action.yml b/.github/actions/install/libressl/action.yml index 9ff05241a..29db0ae1f 100644 --- a/.github/actions/install/libressl/action.yml +++ b/.github/actions/install/libressl/action.yml @@ -8,5 +8,7 @@ inputs: runs: using: composite steps: - - run: ${{ github.action_path }}/install-libressl.sh ${{ inputs.version }} + - run: '"$GITHUB_ACTION_PATH/install-libressl.sh" "$VERSION" --prefix "$RUNNER_TEMP/jwt-cpp-deps" --jobs "$(nproc)"' shell: bash + env: + VERSION: ${{ inputs.version }} diff --git a/.github/actions/install/libressl/install-libressl.sh b/.github/actions/install/libressl/install-libressl.sh index e95bfa8f8..2a2dc784d 100755 --- a/.github/actions/install/libressl/install-libressl.sh +++ b/.github/actions/install/libressl/install-libressl.sh @@ -1,30 +1,20 @@ #!/usr/bin/env bash -# Install LibreSSL library with specified version +set -euo pipefail -set -e # Exit on error +SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)" +source "$SCRIPT_DIR/../common.sh" +install_init "$@" +install_require make -# Check if version is provided -if [[ -z "$1" ]] || [[ "$1" == "-h" ]] || [[ "$1" == "--help" ]]; then - echo "Usage: $0 VERSION" - echo "" - echo "Install libreSSL library" - echo "" - echo "Arguments:" - echo " VERSION libreSSL version to install (required)" - echo "" - echo "Examples:" - echo " $0 4.2.1" - echo " $0 4.1.2" - echo " $0 3.9.4" - exit 1 -fi - -LIBRESSL_VERSION="$1" - -wget https://raw.githubusercontent.com/libressl-portable/portable/v${LIBRESSL_VERSION}/FindLibreSSL.cmake -P cmake/ -cd /tmp -wget https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-${LIBRESSL_VERSION}.tar.gz -tar -zvxf /tmp/libressl-${LIBRESSL_VERSION}.tar.gz -cd libressl-${LIBRESSL_VERSION} -./configure -sudo make -j $(nproc) install +SOURCE_DIR="$INSTALL_WORK_DIR/libressl-${INSTALL_VERSION}" +install_download_extract \ + "https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-${INSTALL_VERSION}.tar.gz" \ + "libressl-${INSTALL_VERSION}.tar.gz" +( + cd "$SOURCE_DIR" + ./configure --prefix="$INSTALL_PREFIX" + make -j "$INSTALL_JOBS" + make install +) +install_publish_environment LIBRESSL_ROOT_DIR +echo "LibreSSL ${INSTALL_VERSION} installed under ${INSTALL_PREFIX}" diff --git a/.github/actions/install/nlohmann-json/action.yml b/.github/actions/install/nlohmann-json/action.yml index 80124924d..918aa1e3b 100644 --- a/.github/actions/install/nlohmann-json/action.yml +++ b/.github/actions/install/nlohmann-json/action.yml @@ -8,11 +8,7 @@ inputs: runs: using: composite steps: - - run: | - cd /tmp - wget https://github.com/nlohmann/json/archive/v${{ inputs.version }}.tar.gz - tar -zxf /tmp/v${{ inputs.version }}.tar.gz - cd json-${{ inputs.version }} - cmake . - sudo cmake --install . + - run: '"$GITHUB_ACTION_PATH/install-nlohmann-json.sh" "$VERSION" --prefix "$RUNNER_TEMP/jwt-cpp-deps" --jobs "$(nproc)"' shell: bash + env: + VERSION: ${{ inputs.version }} diff --git a/.github/actions/install/nlohmann-json/install-nlohmann-json.sh b/.github/actions/install/nlohmann-json/install-nlohmann-json.sh new file mode 100755 index 000000000..a8e3dad91 --- /dev/null +++ b/.github/actions/install/nlohmann-json/install-nlohmann-json.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash +set -euo pipefail + +SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)" +source "$SCRIPT_DIR/../common.sh" +install_init "$@" +install_require cmake + +SOURCE_DIR="$INSTALL_WORK_DIR/json-${INSTALL_VERSION}" +BUILD_DIR="$INSTALL_WORK_DIR/build" +install_download_extract "https://github.com/nlohmann/json/archive/v${INSTALL_VERSION}.tar.gz" \ + "nlohmann-json-${INSTALL_VERSION}.tar.gz" +cmake -S "$SOURCE_DIR" -B "$BUILD_DIR" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$INSTALL_PREFIX" \ + -DJSON_BuildTests=OFF +cmake --build "$BUILD_DIR" --parallel "$INSTALL_JOBS" +cmake --install "$BUILD_DIR" +install_publish_environment +echo "nlohmann-json ${INSTALL_VERSION} installed under ${INSTALL_PREFIX}" diff --git a/.github/actions/install/open-source-parsers-jsoncpp/action.yml b/.github/actions/install/open-source-parsers-jsoncpp/action.yml index 984ee1175..ef3f04a71 100644 --- a/.github/actions/install/open-source-parsers-jsoncpp/action.yml +++ b/.github/actions/install/open-source-parsers-jsoncpp/action.yml @@ -8,5 +8,7 @@ inputs: runs: using: composite steps: - - run: ${{ github.action_path }}/install-jsoncpp.sh ${{ inputs.version }} + - run: '"$GITHUB_ACTION_PATH/install-jsoncpp.sh" "$VERSION" --prefix "$RUNNER_TEMP/jwt-cpp-deps" --jobs "$(nproc)"' shell: bash + env: + VERSION: ${{ inputs.version }} diff --git a/.github/actions/install/open-source-parsers-jsoncpp/install-jsoncpp.sh b/.github/actions/install/open-source-parsers-jsoncpp/install-jsoncpp.sh index 33ef46144..f3ad292d3 100755 --- a/.github/actions/install/open-source-parsers-jsoncpp/install-jsoncpp.sh +++ b/.github/actions/install/open-source-parsers-jsoncpp/install-jsoncpp.sh @@ -1,51 +1,18 @@ #!/usr/bin/env bash -# Install jsoncpp library with specified version - -set -e # Exit on error - -# Check if version is provided -if [[ -z "$1" ]] || [[ "$1" == "-h" ]] || [[ "$1" == "--help" ]]; then - echo "Usage: $0 VERSION" - echo "" - echo "Install jsoncpp library" - echo "" - echo "Arguments:" - echo " VERSION jsoncpp version to install (required)" - echo "" - echo "Examples:" - echo " $0 1.9.8" - exit 1 -fi - -# Configuration -JSONCPP_VERSION="$1" -INSTALL_DIR="/tmp" -BUILD_DIR="${INSTALL_DIR}/jsoncpp-${JSONCPP_VERSION}" - -echo "Installing jsoncpp v${JSONCPP_VERSION}..." - -# Download -echo "Downloading jsoncpp v${JSONCPP_VERSION}..." -cd "${INSTALL_DIR}" -wget -q "https://github.com/open-source-parsers/jsoncpp/archive/${JSONCPP_VERSION}.tar.gz" - -# Extract -echo "Extracting archive..." -tar -zxf "${JSONCPP_VERSION}.tar.gz" - -# Build and install -echo "Building and installing..." -cd "${BUILD_DIR}" -# https://github.com/open-source-parsers/jsoncpp/blob/69098a18b9af0c47549d9a271c054d13ca92b006/include/PreventInSourceBuilds.cmake#L8 -mkdir -p build -cd build -cmake .. -DJSONCPP_WITH_TESTS=OFF -DBUILD_SHARED_LIBS=OFF -DBUILD_OBJECT_LIBS=OFF -cmake --build . -sudo cmake --install . - -# Cleanup -echo "Cleaning up..." -rm -f "${INSTALL_DIR}/${JSONCPP_VERSION}.tar.gz" -rm -rf "${BUILD_DIR}" - -echo "✓ jsoncpp v${JSONCPP_VERSION} installed successfully!" +set -euo pipefail + +SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)" +source "$SCRIPT_DIR/../common.sh" +install_init "$@" +install_require cmake + +SOURCE_DIR="$INSTALL_WORK_DIR/jsoncpp-${INSTALL_VERSION}" +BUILD_DIR="$INSTALL_WORK_DIR/build" +install_download_extract "https://github.com/open-source-parsers/jsoncpp/archive/${INSTALL_VERSION}.tar.gz" \ + "jsoncpp-${INSTALL_VERSION}.tar.gz" +cmake -S "$SOURCE_DIR" -B "$BUILD_DIR" -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX="$INSTALL_PREFIX" -DJSONCPP_WITH_TESTS=OFF -DBUILD_SHARED_LIBS=OFF -DBUILD_OBJECT_LIBS=OFF +cmake --build "$BUILD_DIR" --parallel "$INSTALL_JOBS" +cmake --install "$BUILD_DIR" +install_publish_environment +echo "JsonCpp ${INSTALL_VERSION} installed under ${INSTALL_PREFIX}" diff --git a/.github/actions/install/openssl/action.yml b/.github/actions/install/openssl/action.yml index 87749d316..a93728b4f 100644 --- a/.github/actions/install/openssl/action.yml +++ b/.github/actions/install/openssl/action.yml @@ -8,14 +8,7 @@ inputs: runs: using: composite steps: - - run: | - cd /tmp - wget https://github.com/openssl/openssl/archive/refs/tags/${{ inputs.version }}.tar.gz - tar -zxf /tmp/${{ inputs.version }}.tar.gz - cd openssl-${{ inputs.version }} - ./config --prefix=/tmp --libdir=lib - make -j $(nproc) - sudo make -j $(nproc) install_sw - echo "OPENSSL_ROOT_DIR=/tmp" >> "$GITHUB_ENV" - echo "OpenSSL_ROOT=/tmp" >> "$GITHUB_ENV" + - run: '"$GITHUB_ACTION_PATH/install-openssl.sh" "$VERSION" --prefix "$RUNNER_TEMP/jwt-cpp-deps" --jobs "$(nproc)"' shell: bash + env: + VERSION: ${{ inputs.version }} diff --git a/.github/actions/install/openssl/install-openssl.sh b/.github/actions/install/openssl/install-openssl.sh new file mode 100755 index 000000000..2f2c45c6f --- /dev/null +++ b/.github/actions/install/openssl/install-openssl.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash +set -euo pipefail + +SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)" +source "$SCRIPT_DIR/../common.sh" +install_init "$@" +install_require perl make + +SOURCE_DIR="$INSTALL_WORK_DIR/openssl-${INSTALL_VERSION}" +install_download_extract "https://github.com/openssl/openssl/archive/refs/tags/${INSTALL_VERSION}.tar.gz" \ + "openssl-${INSTALL_VERSION}.tar.gz" +( + cd "$SOURCE_DIR" + ./config --prefix="$INSTALL_PREFIX" --libdir=lib + make -j "$INSTALL_JOBS" install_sw +) +install_publish_environment OPENSSL_ROOT_DIR +echo "OpenSSL ${INSTALL_VERSION#openssl-} installed under ${INSTALL_PREFIX}" diff --git a/.github/actions/install/reflectcpp-json/action.yml b/.github/actions/install/reflectcpp-json/action.yml index 4056be76c..5981dc1f6 100644 --- a/.github/actions/install/reflectcpp-json/action.yml +++ b/.github/actions/install/reflectcpp-json/action.yml @@ -8,5 +8,7 @@ inputs: runs: using: composite steps: - - run: ${{ github.action_path }}/install-reflect-cpp.sh ${{ inputs.version }} + - run: '"$GITHUB_ACTION_PATH/install-reflect-cpp.sh" "$VERSION" --prefix "$RUNNER_TEMP/jwt-cpp-deps" --jobs "$(nproc)"' shell: bash + env: + VERSION: ${{ inputs.version }} diff --git a/.github/actions/install/reflectcpp-json/install-reflect-cpp.sh b/.github/actions/install/reflectcpp-json/install-reflect-cpp.sh index bd112bd11..cdf789223 100755 --- a/.github/actions/install/reflectcpp-json/install-reflect-cpp.sh +++ b/.github/actions/install/reflectcpp-json/install-reflect-cpp.sh @@ -1,48 +1,18 @@ #!/usr/bin/env bash -# Install reflect-cpp library with specified version - -set -e # Exit on error - -# Check if version is provided -if [[ -z "$1" ]] || [[ "$1" == "-h" ]] || [[ "$1" == "--help" ]]; then - echo "Usage: $0 VERSION" - echo "" - echo "Install reflect-cpp library" - echo "" - echo "Arguments:" - echo " VERSION reflect-cpp version to install (required)" - echo "" - echo "Examples:" - echo " $0 0.27.1" - exit 1 -fi - -# Configuration -reflectcpp_VERSION="$1" -INSTALL_DIR="/tmp" -BUILD_DIR="${INSTALL_DIR}/reflect-cpp-${reflectcpp_VERSION}" - -echo "Installing reflectcpp v${reflectcpp_VERSION}..." - -# Download -echo "Downloading reflectcpp v${reflectcpp_VERSION}..." -cd "${INSTALL_DIR}" -wget -q "https://github.com/getml/reflect-cpp/archive/v${reflectcpp_VERSION}.tar.gz" - -# Extract -echo "Extracting archive..." -tar -zxf "v${reflectcpp_VERSION}.tar.gz" - -# Build and install -echo "Building and installing..." -cd "${BUILD_DIR}" -cmake . -DCMAKE_BUILD_TYPE=Release -DREFLECTCPP_INSTALL=ON -cmake --build . -sudo cmake --install . - -# Cleanup -echo "Cleaning up..." -rm -f "${INSTALL_DIR}/v${reflectcpp_VERSION}.tar.gz" -rm -rf "${BUILD_DIR}" - -echo "✓ reflect-cpp v${reflectcpp_VERSION} installed successfully!" +set -euo pipefail + +SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)" +source "$SCRIPT_DIR/../common.sh" +install_init "$@" +install_require cmake + +SOURCE_DIR="$INSTALL_WORK_DIR/reflect-cpp-${INSTALL_VERSION}" +BUILD_DIR="$INSTALL_WORK_DIR/build" +install_download_extract "https://github.com/getml/reflect-cpp/archive/v${INSTALL_VERSION}.tar.gz" \ + "reflect-cpp-${INSTALL_VERSION}.tar.gz" +cmake -S "$SOURCE_DIR" -B "$BUILD_DIR" -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX="$INSTALL_PREFIX" -DREFLECTCPP_INSTALL=ON +cmake --build "$BUILD_DIR" --parallel "$INSTALL_JOBS" +cmake --install "$BUILD_DIR" +install_publish_environment +echo "reflect-cpp ${INSTALL_VERSION} installed under ${INSTALL_PREFIX}" diff --git a/.github/actions/install/wolfssl/action.yml b/.github/actions/install/wolfssl/action.yml index 2f291d763..a7dac6cb8 100644 --- a/.github/actions/install/wolfssl/action.yml +++ b/.github/actions/install/wolfssl/action.yml @@ -8,7 +8,7 @@ inputs: runs: using: composite steps: - - run: ${{ github.action_path }}/install-wolfssl.sh ${{ inputs.version }} - shell: bash - - run: sudo rm -rf /usr/include/openssl + - run: '"$GITHUB_ACTION_PATH/install-wolfssl.sh" "$VERSION" --prefix "$RUNNER_TEMP/jwt-cpp-deps" --jobs "$(nproc)"' shell: bash + env: + VERSION: ${{ inputs.version }} diff --git a/.github/actions/install/wolfssl/install-wolfssl.sh b/.github/actions/install/wolfssl/install-wolfssl.sh index 845ae2421..3ba411db9 100755 --- a/.github/actions/install/wolfssl/install-wolfssl.sh +++ b/.github/actions/install/wolfssl/install-wolfssl.sh @@ -1,31 +1,21 @@ #!/usr/bin/env bash -# Install wolfSSL library with specified version +set -euo pipefail -set -e # Exit on error +SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)" +source "$SCRIPT_DIR/../common.sh" +install_init "$@" +install_require autoconf automake aclocal autoreconf make -# Check if version is provided -if [[ -z "$1" ]] || [[ "$1" == "-h" ]] || [[ "$1" == "--help" ]]; then - echo "Usage: $0 VERSION" - echo "" - echo "Install wolfSSL library" - echo "" - echo "Arguments:" - echo " VERSION wolfSSL version to install (required)" - echo "" - echo "Examples:" - echo " $0 4.2.1" - echo " $0 4.1.2" - echo " $0 3.9.4" - exit 1 -fi - -WOLFSSL_VERSION="$1" - -cd /tmp -wget -O wolfssl.tar.gz https://github.com/wolfSSL/wolfssl/archive/$WOLFSSL_VERSION.tar.gz -tar -zxf /tmp/wolfssl.tar.gz -cd wolfssl-* -autoreconf -fiv -./configure --enable-opensslall --enable-opensslextra --disable-examples --disable-crypttests --enable-harden --enable-all --enable-all-crypto -make -sudo make install +SOURCE_DIR="$INSTALL_WORK_DIR/wolfssl-${INSTALL_VERSION#v}" +install_download_extract "https://github.com/wolfSSL/wolfssl/archive/${INSTALL_VERSION}.tar.gz" \ + "wolfssl-${INSTALL_VERSION}.tar.gz" +( + cd "$SOURCE_DIR" + autoreconf -fiv + ./configure --prefix="$INSTALL_PREFIX" --enable-opensslall --enable-opensslextra \ + --disable-examples --disable-crypttests --enable-harden --enable-all --enable-all-crypto + make -j "$INSTALL_JOBS" + make install +) +install_publish_environment +echo "wolfSSL ${INSTALL_VERSION#v} installed under ${INSTALL_PREFIX}" diff --git a/.github/workflows/ssl.yml b/.github/workflows/ssl.yml index 4bd4e42d2..9d8c75eb6 100644 --- a/.github/workflows/ssl.yml +++ b/.github/workflows/ssl.yml @@ -29,6 +29,12 @@ jobs: with: version: ${{ matrix.openssl.tag }} + - name: verify OpenSSL installation + run: | + "$OPENSSL_ROOT_DIR/bin/openssl" version | grep -F "${{ matrix.openssl.name }}" + - name: verify installers left checkout clean + run: git status --short --untracked-files=all && test -z "$(git status --porcelain --untracked-files=all)" + - run: cmake --workflow --preset unit-tests - if: github.event_name == 'push' && always() @@ -48,6 +54,12 @@ jobs: with: version: "openssl-4.1.0" + - name: verify OpenSSL installation + run: | + "$OPENSSL_ROOT_DIR/bin/openssl" version | grep -F "4.1.0" + - name: verify installers left checkout clean + run: git status --short --untracked-files=all && test -z "$(git status --porcelain --untracked-files=all)" + - name: configure run: cmake --preset unit-tests -DCMAKE_CXX_FLAGS="-DOPENSSL_NO_DEPRECATED=1" -DCMAKE_C_FLAGS="-DOPENSSL_NO_DEPRECATED=1" - run: cmake --build --preset unit-tests @@ -69,6 +81,12 @@ jobs: with: version: ${{ matrix.libressl }} + - name: verify LibreSSL installation + run: | + "$LIBRESSL_ROOT_DIR/bin/openssl" version | grep -F "LibreSSL ${{ matrix.libressl }}" + - name: verify installers left checkout clean + run: git status --short --untracked-files=all && test -z "$(git status --porcelain --untracked-files=all)" + - name: configure run: cmake --preset unit-tests -DJWT_SSL_LIBRARY:STRING=LibreSSL - run: cmake --build --preset unit-tests @@ -100,6 +118,12 @@ jobs: with: version: ${{ matrix.wolfssl.ref }} + - name: verify wolfSSL installation + run: | + "$RUNNER_TEMP/jwt-cpp-deps/bin/wolfssl-config" --version | grep -Fx "${{ matrix.wolfssl.name }}" + - name: verify installers left checkout clean + run: git status --short --untracked-files=all && test -z "$(git status --porcelain --untracked-files=all)" + - name: configure run: cmake --preset unit-tests -DJWT_SSL_LIBRARY:STRING=wolfSSL - run: cmake --build --preset unit-tests diff --git a/.github/workflows/traits.yml b/.github/workflows/traits.yml index 9e3a513a1..77345f756 100644 --- a/.github/workflows/traits.yml +++ b/.github/workflows/traits.yml @@ -28,10 +28,8 @@ jobs: - uses: lukka/get-cmake@latest - name: setup run: | - mkdir build - cd build - cmake .. -DJWT_BUILD_EXAMPLES=OFF - sudo cmake --install . + cmake -S . -B build -DJWT_BUILD_EXAMPLES=OFF -DCMAKE_INSTALL_PREFIX="$RUNNER_TEMP/jwt-cpp-deps" + cmake --install build # Install the JSON library - if: matrix.target.name == 'danielaparker-jsoncons' @@ -49,8 +47,6 @@ jobs: with: version: ${{matrix.target.tag}} - - if: matrix.target.name == 'kazuho-picojson' - run: rm -rf include/picojson - if: matrix.target.name == 'kazuho-picojson' uses: ./.github/actions/install/kazuho-picojson with: @@ -71,9 +67,18 @@ jobs: with: version: ${{ matrix.target.tag }} + - name: verify installers left checkout clean + run: git status --short --untracked-files=all && test -z "$(git status --porcelain --untracked-files=all)" + - name: test working-directory: example/traits run: | + if [[ "${{ matrix.target.name }}" == "kazuho-picojson" ]]; then + backup="$(mktemp)" + cp ../../include/picojson/picojson.h "$backup" + rm -rf ../../include/picojson + trap 'mkdir -p ../../include/picojson; cp "$backup" ../../include/picojson/picojson.h; rm -f "$backup"' EXIT + fi cmake . -DCMAKE_FIND_DEBUG_MODE=1 cmake --build . --target ${{ matrix.target.name }} ./${{ matrix.target.name }} From 85fafa8739961a568544dd879c82175fed4f2989 Mon Sep 17 00:00:00 2001 From: Christopher McArthur Date: Mon, 23 Nov 2026 08:46:32 -0800 Subject: [PATCH 3/8] openssl lts in docs and ci --- .github/workflows/jwt.yml | 1 + .github/workflows/ssl.yml | 8 +++----- docs/ssl.md | 20 +++++--------------- 3 files changed, 9 insertions(+), 20 deletions(-) diff --git a/.github/workflows/jwt.yml b/.github/workflows/jwt.yml index 83ecc6336..706b90def 100644 --- a/.github/workflows/jwt.yml +++ b/.github/workflows/jwt.yml @@ -55,6 +55,7 @@ jobs: matrix: openssl: - { tag: "openssl-4.1.0", name: "4.1.0" } + - { tag: "openssl-3.5.5", name: "3.5.5" } - { tag: "OpenSSL_1_1_1w", name: "1.1.1w" } steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/ssl.yml b/.github/workflows/ssl.yml index 9d8c75eb6..9dbc93c85 100644 --- a/.github/workflows/ssl.yml +++ b/.github/workflows/ssl.yml @@ -71,7 +71,7 @@ jobs: strategy: fail-fast: false matrix: - libressl: ["4.4.1", "4.2.1", "4.1.2", "3.9.2"] + libressl: ["4.4.1", "4.2.1", "3.9.2"] name: LibreSSL ${{ matrix.libressl }} steps: - uses: actions/checkout@v4 @@ -104,11 +104,9 @@ jobs: strategy: matrix: wolfssl: - - { ref: "v5.1.1-stable", name: "5.1.1"} - - { ref: "v5.2.0-stable", name: "5.2.0" } - - { ref: "v5.3.0-stable", name: "5.3.0"} - - { ref: "v5.7.0-stable", name: "5.7.0"} - { ref: "v5.9.4-stable", name: "5.9.4"} + - { ref: "v5.7.0-stable", name: "5.7.0"} + - { ref: "v5.3.0-stable", name: "5.3.0"} name: wolfSSL ${{ matrix.wolfssl.name }} steps: - uses: actions/checkout@v4 diff --git a/docs/ssl.md b/docs/ssl.md index d0f9952f2..5e1434f82 100644 --- a/docs/ssl.md +++ b/docs/ssl.md @@ -18,36 +18,26 @@ These are the versions which are currently being tested: | OpenSSL | LibreSSL | wolfSSL | | --------------------- | ------------------ | -------------- | -| ![4.1.0][o4.1] | ![4.4.1][l4.4] | ![5.1.1][w5.1] | -| ![3.5.5][o3.5] :star: | ![4.2.1][l4.2] | ![5.2.0][w5.2] | -| ![3.6.1][o3.6] | ![4.1.2][l4.1] | ![5.3.0][w5.3] | -| ![3.0.19][o3.0] | ![3.9.2][l3.9] | ![5.9.4][w5.9] | -| ![1.1.1w][o1.1.1] | | | -| ![1.0.2u][o1.0.2] | | | +| ![4.1.0][o4.1] | ![4.4.1][l4.4] | ![5.9.4][w5.9] | +| ![3.5.5][o3.5] :star: | ![4.2.1][l4.2] | ![5.7.0][w5.7] | +| ![3.0.19][o3.0] | ![3.9.2][l3.9] | ![5.3.0][w5.3] | > [!NOTE] > :star: Indicates LTS (Long-Term Support) versions. [OpenSSL versions](https://openssl-library.org/policies/releasestrat/index.html) are supported as follows: > -> - **3.0.19**: Supported until 2026-09-07 (LTS) > - **3.5.5**: Supported until 2030-04-08 (LTS) -> - **3.6.1**: Supported until 2026-11-01 -> - **4.1.0**: Latest stable release +> - **4.1.0**: Supported until 2027-11-23 > > A complete list of versions tested in the past can be found [on this branch](https://github.com/Thalhammer/jwt-cpp/tree/badges). -[o1.0.2]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/Thalhammer/jwt-cpp/badges/openssl/1.0.2u/shields.json -[o1.1.1]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/Thalhammer/jwt-cpp/badges/openssl/1.1.1w/shields.json [o3.0]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/Thalhammer/jwt-cpp/badges/openssl/3.0.19/shields.json [o3.5]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/Thalhammer/jwt-cpp/badges/openssl/3.5.5/shields.json -[o3.6]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/Thalhammer/jwt-cpp/badges/openssl/3.6.1/shields.json [o4.1]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/Thalhammer/jwt-cpp/badges/openssl/4.1.0/shields.json [l4.4]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/Thalhammer/jwt-cpp/badges/libressl/4.4.1/shields.json [l4.2]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/Thalhammer/jwt-cpp/badges/libressl/4.2.1/shields.json -[l4.1]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/Thalhammer/jwt-cpp/badges/libressl/4.1.2/shields.json [l3.9]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/Thalhammer/jwt-cpp/badges/libressl/3.9.2/shields.json -[w5.1]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/Thalhammer/jwt-cpp/badges/wolfssl/5.1.1/shields.json -[w5.2]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/Thalhammer/jwt-cpp/badges/wolfssl/5.2.0/shields.json [w5.3]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/Thalhammer/jwt-cpp/badges/wolfssl/5.3.0/shields.json +[w5.7]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/Thalhammer/jwt-cpp/badges/wolfssl/5.7.0/shields.json [w5.9]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/Thalhammer/jwt-cpp/badges/wolfssl/5.9.4/shields.json ## Notes From f3c86164e867db225470e7e35f4ddb64804b287e Mon Sep 17 00:00:00 2001 From: Christopher McArthur Date: Mon, 23 Nov 2026 21:18:09 -0800 Subject: [PATCH 4/8] Fix CI failures for new version deps --- .../install/libressl/install-libressl.sh | 6 ++++ .../install/openssl/install-openssl.sh | 3 +- .github/workflows/cmake.yml | 10 ++++-- .github/workflows/ssl.yml | 2 +- .github/workflows/traits.yml | 11 +++---- .../traits/danielaparker-jsoncons/traits.h | 22 ++++++------- tests/OpenSSLErrorTest.cpp | 31 ++++++++++++------- 7 files changed, 50 insertions(+), 35 deletions(-) diff --git a/.github/actions/install/libressl/install-libressl.sh b/.github/actions/install/libressl/install-libressl.sh index 2a2dc784d..865681867 100755 --- a/.github/actions/install/libressl/install-libressl.sh +++ b/.github/actions/install/libressl/install-libressl.sh @@ -16,5 +16,11 @@ install_download_extract \ make -j "$INSTALL_JOBS" make install ) + +mkdir -p "$INSTALL_PREFIX/cmake" +curl --fail --location --retry 3 --silent --show-error \ + "https://raw.githubusercontent.com/libressl-portable/portable/v${INSTALL_VERSION}/FindLibreSSL.cmake" \ + --output "$INSTALL_PREFIX/cmake/FindLibreSSL.cmake" + install_publish_environment LIBRESSL_ROOT_DIR echo "LibreSSL ${INSTALL_VERSION} installed under ${INSTALL_PREFIX}" diff --git a/.github/actions/install/openssl/install-openssl.sh b/.github/actions/install/openssl/install-openssl.sh index 2f2c45c6f..9d67e379a 100755 --- a/.github/actions/install/openssl/install-openssl.sh +++ b/.github/actions/install/openssl/install-openssl.sh @@ -12,7 +12,8 @@ install_download_extract "https://github.com/openssl/openssl/archive/refs/tags/$ ( cd "$SOURCE_DIR" ./config --prefix="$INSTALL_PREFIX" --libdir=lib - make -j "$INSTALL_JOBS" install_sw + make -j "$INSTALL_JOBS" + make install_sw ) install_publish_environment OPENSSL_ROOT_DIR echo "OpenSSL ${INSTALL_VERSION#openssl-} installed under ${INSTALL_PREFIX}" diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index b132ca960..98e41fde4 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -225,13 +225,17 @@ jobs: run: | mkdir build cd build - cmake .. -DJWT_SSL_LIBRARY:STRING="LibreSSL" -DJWT_BUILD_EXAMPLES=OFF - sudo make install + cmake .. -DJWT_SSL_LIBRARY:STRING="LibreSSL" -DJWT_BUILD_EXAMPLES=OFF \ + -DCMAKE_INSTALL_PREFIX="$RUNNER_TEMP/jwt-cpp-deps" \ + -DCMAKE_MODULE_PATH="$RUNNER_TEMP/jwt-cpp-deps/cmake" + cmake --build . + cmake --install . - name: test run: | cd tests/cmake - cmake . -DCMAKE_PREFIX_PATH=/usr/local/cmake -DCMAKE_MODULE_PATH=../../cmake -DTEST:STRING="libressl-is-used" + cmake . -DCMAKE_PREFIX_PATH="$RUNNER_TEMP/jwt-cpp-deps/cmake" \ + -DCMAKE_MODULE_PATH="$RUNNER_TEMP/jwt-cpp-deps/cmake" -DTEST:STRING="libressl-is-used" cmake --build . with-wolfssl: diff --git a/.github/workflows/ssl.yml b/.github/workflows/ssl.yml index 9dbc93c85..5c28b030f 100644 --- a/.github/workflows/ssl.yml +++ b/.github/workflows/ssl.yml @@ -88,7 +88,7 @@ jobs: run: git status --short --untracked-files=all && test -z "$(git status --porcelain --untracked-files=all)" - name: configure - run: cmake --preset unit-tests -DJWT_SSL_LIBRARY:STRING=LibreSSL + run: cmake --preset unit-tests -DJWT_SSL_LIBRARY:STRING=LibreSSL -DCMAKE_MODULE_PATH="$RUNNER_TEMP/jwt-cpp-deps/cmake" - run: cmake --build --preset unit-tests - name: test run: ctest --preset unit-tests --output-on-failure diff --git a/.github/workflows/traits.yml b/.github/workflows/traits.yml index 77345f756..1ae869767 100644 --- a/.github/workflows/traits.yml +++ b/.github/workflows/traits.yml @@ -47,6 +47,9 @@ jobs: with: version: ${{matrix.target.tag}} + # Delete the vendor directory for kazuho-picojson to ensure that the install action is used. + - if: matrix.target.name == 'kazuho-picojson' + run: rm -rf include/picojson - if: matrix.target.name == 'kazuho-picojson' uses: ./.github/actions/install/kazuho-picojson with: @@ -73,13 +76,7 @@ jobs: - name: test working-directory: example/traits run: | - if [[ "${{ matrix.target.name }}" == "kazuho-picojson" ]]; then - backup="$(mktemp)" - cp ../../include/picojson/picojson.h "$backup" - rm -rf ../../include/picojson - trap 'mkdir -p ../../include/picojson; cp "$backup" ../../include/picojson/picojson.h; rm -f "$backup"' EXIT - fi - cmake . -DCMAKE_FIND_DEBUG_MODE=1 + cmake . -DCMAKE_FIND_DEBUG_MODE=1 -DCMAKE_CXX_FLAGS="-DJSONCONS_NO_DEPRECATED" cmake --build . --target ${{ matrix.target.name }} ./${{ matrix.target.name }} diff --git a/include/jwt-cpp/traits/danielaparker-jsoncons/traits.h b/include/jwt-cpp/traits/danielaparker-jsoncons/traits.h index bb00d5418..7bcb05bae 100644 --- a/include/jwt-cpp/traits/danielaparker-jsoncons/traits.h +++ b/include/jwt-cpp/traits/danielaparker-jsoncons/traits.h @@ -131,30 +131,28 @@ namespace jwt { static jwt::json::type get_type(const json& val) { using jwt::json::type; - if (val.type() == jsoncons::json_type::bool_value) return type::boolean; - if (val.type() == jsoncons::json_type::int64_value) return type::integer; - if (val.type() == jsoncons::json_type::uint64_value) return type::integer; - if (val.type() == jsoncons::json_type::half_value) return type::number; - if (val.type() == jsoncons::json_type::double_value) return type::number; - if (val.type() == jsoncons::json_type::string_value) return type::string; - if (val.type() == jsoncons::json_type::array_value) return type::array; - if (val.type() == jsoncons::json_type::object_value) return type::object; + if (val.is_bool()) return type::boolean; + if (val.is_int64() || val.is_uint64()) return type::integer; + if (val.is_number()) return type::number; + if (val.is_string()) return type::string; + if (val.is_array()) return type::array; + if (val.is_object()) return type::object; throw std::logic_error("invalid type"); } static object_type as_object(const json& val) { - if (val.type() != jsoncons::json_type::object_value) throw std::bad_cast(); + if (!val.is_object()) throw std::bad_cast(); return object_type(val); } static array_type as_array(const json& val) { - if (val.type() != jsoncons::json_type::array_value) throw std::bad_cast(); + if (!val.is_array()) throw std::bad_cast(); return array_type(val); } static string_type as_string(const json& val) { - if (val.type() != jsoncons::json_type::string_value) throw std::bad_cast(); + if (!val.is_string()) throw std::bad_cast(); return val.as_string(); } @@ -169,7 +167,7 @@ namespace jwt { } static boolean_type as_boolean(const json& val) { - if (val.type() != jsoncons::json_type::bool_value) throw std::bad_cast(); + if (!val.is_bool()) throw std::bad_cast(); return val.as_bool(); } diff --git a/tests/OpenSSLErrorTest.cpp b/tests/OpenSSLErrorTest.cpp index 52c7cac91..4b0bbfa0f 100644 --- a/tests/OpenSSLErrorTest.cpp +++ b/tests/OpenSSLErrorTest.cpp @@ -6,6 +6,10 @@ #include #include +// OpenSSL 4.1 bypasses the BIO_ctrl symbol interposed by these tests. +#if !defined(LIBWOLFSSL_VERSION_HEX) && OPENSSL_VERSION_NUMBER < 0x40100000L +#define JWT_TEST_BIO_CTRL_INTERPOSITION +#endif // TODO: Figure out why the tests fail on older openssl versions #ifndef JWT_OPENSSL_1_0_0 // It fails on < 1.1 but no idea why. // LibreSSL has different return codes but was already outside of the effective scope @@ -744,7 +748,7 @@ TEST(OpenSSLErrorTest, ExtractPubkeyFromCert) { {&fail_PEM_read_bio_X509, 1, jwt::error::rsa_error::cert_load_failed}, {&fail_X509_get_pubkey, 1, jwt::error::rsa_error::get_key_failed}, {&fail_PEM_write_bio_PUBKEY, 1, jwt::error::rsa_error::write_key_failed}, -#ifndef LIBWOLFSSL_VERSION_HEX /* wolfSSL does not use BIO_ctrl in BIO_get_mem_data */ +#ifdef JWT_TEST_BIO_CTRL_INTERPOSITION {&fail_BIO_ctrl, 1, jwt::error::rsa_error::convert_to_pem_failed} #endif }; @@ -762,7 +766,7 @@ TEST(OpenSSLErrorTest, ExtractPubkeyFromCertErrorCode) { {&fail_PEM_read_bio_X509, 1, jwt::error::rsa_error::cert_load_failed}, {&fail_X509_get_pubkey, 1, jwt::error::rsa_error::get_key_failed}, {&fail_PEM_write_bio_PUBKEY, 1, jwt::error::rsa_error::write_key_failed}, -#ifndef LIBWOLFSSL_VERSION_HEX /* wolfSSL does not use BIO_ctrl in BIO_get_mem_data */ +#ifdef JWT_TEST_BIO_CTRL_INTERPOSITION {&fail_BIO_ctrl, 1, jwt::error::rsa_error::convert_to_pem_failed} #endif }; @@ -928,14 +932,16 @@ TEST(OpenSSLErrorTest, ConvertCertBase64DerToPem) { }); } +// wolfSSL 5.9 parses the EdDSA certificate, so this injected failure reaches PEM writing. TEST(OpenSSLErrorTest, ConvertEcdsaCertBase64DerToPem) { std::vector mapping{{&fail_BIO_new, 1, jwt::error::rsa_error::create_mem_bio_failed}, -#ifndef LIBWOLFSSL_VERSION_HEX +#if defined(LIBWOLFSSL_VERSION_HEX) && LIBWOLFSSL_VERSION_HEX < 0x05009000 + {&fail_PEM_write_bio_cert, 1, jwt::error::rsa_error::create_mem_bio_failed} +#else {&fail_PEM_write_bio_cert, 1, jwt::error::rsa_error::write_cert_failed}, +#ifdef JWT_TEST_BIO_CTRL_INTERPOSITION {&fail_BIO_ctrl, 1, jwt::error::rsa_error::convert_to_pem_failed} -#else - {&fail_PEM_write_bio_cert, 1, jwt::error::rsa_error::create_mem_bio_failed}, - {&fail_BIO_ctrl, 1, jwt::error::rsa_error::create_mem_bio_failed} +#endif #endif }; @@ -950,7 +956,7 @@ TEST(OpenSSLErrorTest, ConvertEcdsaCertBase64DerToPem) { TEST(OpenSSLErrorTest, ConvertCertBase64DerToPemErrorCode) { std::vector mapping{{&fail_BIO_new, 1, jwt::error::rsa_error::create_mem_bio_failed}, {&fail_PEM_write_bio_cert, 1, jwt::error::rsa_error::write_cert_failed}, -#ifndef LIBWOLFSSL_VERSION_HEX /* wolfSSL does not use BIO_ctrl in BIO_get_mem_data */ +#ifdef JWT_TEST_BIO_CTRL_INTERPOSITION {&fail_BIO_ctrl, 1, jwt::error::rsa_error::convert_to_pem_failed} #endif }; @@ -1216,7 +1222,7 @@ TEST(OpenSSLErrorTest, ECDSACertificate) { {&fail_PEM_read_bio_X509, 1, jwt::error::ecdsa_error::cert_load_failed}, {&fail_X509_get_pubkey, 1, jwt::error::ecdsa_error::get_key_failed}, {&fail_PEM_write_bio_PUBKEY, 1, jwt::error::ecdsa_error::write_key_failed}, -#ifndef LIBWOLFSSL_VERSION_HEX /* wolfSSL does not use BIO_ctrl in BIO_get_mem_data */ +#ifdef JWT_TEST_BIO_CTRL_INTERPOSITION { &fail_BIO_ctrl, 1, jwt::error::ecdsa_error::convert_to_pem_failed } @@ -1359,9 +1365,12 @@ TEST(OpenSSLErrorTest, EdDSACertificate) { {&fail_BIO_new, 2, jwt::error::rsa_error::create_mem_bio_failed}, {&fail_PEM_read_bio_X509, 1, jwt::error::rsa_error::cert_load_failed}, {&fail_X509_get_pubkey, 1, jwt::error::rsa_error::get_key_failed}, - {&fail_PEM_write_bio_PUBKEY, 1, jwt::error::rsa_error::write_key_failed}, { - &fail_BIO_ctrl, 1, jwt::error::rsa_error::convert_to_pem_failed - } +#ifdef JWT_TEST_BIO_CTRL_INTERPOSITION + {&fail_PEM_write_bio_PUBKEY, 1, jwt::error::rsa_error::write_key_failed}, + {&fail_BIO_ctrl, 1, jwt::error::rsa_error::convert_to_pem_failed} +#else + {&fail_PEM_write_bio_PUBKEY, 1, jwt::error::rsa_error::write_key_failed} +#endif }; run_multitest(mapping, [](std::error_code& ec) { From 19811714ae9637dc7fcc8850596763b12f464c67 Mon Sep 17 00:00:00 2001 From: Christopher McArthur Date: Mon, 23 Nov 2026 23:20:58 -0800 Subject: [PATCH 5/8] linter --- tests/OpenSSLErrorTest.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/tests/OpenSSLErrorTest.cpp b/tests/OpenSSLErrorTest.cpp index 4b0bbfa0f..6b47c4898 100644 --- a/tests/OpenSSLErrorTest.cpp +++ b/tests/OpenSSLErrorTest.cpp @@ -934,13 +934,16 @@ TEST(OpenSSLErrorTest, ConvertCertBase64DerToPem) { // wolfSSL 5.9 parses the EdDSA certificate, so this injected failure reaches PEM writing. TEST(OpenSSLErrorTest, ConvertEcdsaCertBase64DerToPem) { - std::vector mapping{{&fail_BIO_new, 1, jwt::error::rsa_error::create_mem_bio_failed}, + std::vector mapping { + {&fail_BIO_new, 1, jwt::error::rsa_error::create_mem_bio_failed}, #if defined(LIBWOLFSSL_VERSION_HEX) && LIBWOLFSSL_VERSION_HEX < 0x05009000 - {&fail_PEM_write_bio_cert, 1, jwt::error::rsa_error::create_mem_bio_failed} + {&fail_PEM_write_bio_cert, 1, jwt::error::rsa_error::create_mem_bio_failed} #else - {&fail_PEM_write_bio_cert, 1, jwt::error::rsa_error::write_cert_failed}, + {&fail_PEM_write_bio_cert, 1, jwt::error::rsa_error::write_cert_failed}, #ifdef JWT_TEST_BIO_CTRL_INTERPOSITION - {&fail_BIO_ctrl, 1, jwt::error::rsa_error::convert_to_pem_failed} + { + &fail_BIO_ctrl, 1, jwt::error::rsa_error::convert_to_pem_failed + } #endif #endif }; @@ -1369,7 +1372,9 @@ TEST(OpenSSLErrorTest, EdDSACertificate) { {&fail_PEM_write_bio_PUBKEY, 1, jwt::error::rsa_error::write_key_failed}, {&fail_BIO_ctrl, 1, jwt::error::rsa_error::convert_to_pem_failed} #else - {&fail_PEM_write_bio_PUBKEY, 1, jwt::error::rsa_error::write_key_failed} + { + &fail_PEM_write_bio_PUBKEY, 1, jwt::error::rsa_error::write_key_failed + } #endif }; From 0ccd22f04f97fdbbcca31470545096fc9daa8f8c Mon Sep 17 00:00:00 2001 From: Christopher McArthur Date: Mon, 23 Nov 2026 23:24:03 -0800 Subject: [PATCH 6/8] dont run clean check and picojson since it needs to be unvendored --- .github/workflows/traits.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/traits.yml b/.github/workflows/traits.yml index 1ae869767..054fb1f00 100644 --- a/.github/workflows/traits.yml +++ b/.github/workflows/traits.yml @@ -70,7 +70,8 @@ jobs: with: version: ${{ matrix.target.tag }} - - name: verify installers left checkout clean + - if: matrix.target.name != 'kazuho-picojson' + name: verify installers left checkout clean run: git status --short --untracked-files=all && test -z "$(git status --porcelain --untracked-files=all)" - name: test From f2952a46537667bb68e73692c1257291dbfcb2d3 Mon Sep 17 00:00:00 2001 From: Christopher McArthur Date: Tue, 24 Nov 2026 09:39:42 -0800 Subject: [PATCH 7/8] Fix OpenSSLErrorTest to interpose X509_get_pubkey for OpenSSL 4.1 compatibility --- tests/OpenSSLErrorTest.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/OpenSSLErrorTest.cpp b/tests/OpenSSLErrorTest.cpp index 6b47c4898..87941bc49 100644 --- a/tests/OpenSSLErrorTest.cpp +++ b/tests/OpenSSLErrorTest.cpp @@ -6,9 +6,10 @@ #include #include -// OpenSSL 4.1 bypasses the BIO_ctrl symbol interposed by these tests. +// OpenSSL 4.1 bypasses the BIO_ctrl and X509_get_pubkey symbols interposed by these tests. #if !defined(LIBWOLFSSL_VERSION_HEX) && OPENSSL_VERSION_NUMBER < 0x40100000L #define JWT_TEST_BIO_CTRL_INTERPOSITION +#define JWT_TEST_X509_GET_PUBKEY_INTERPOSITION #endif // TODO: Figure out why the tests fail on older openssl versions #ifndef JWT_OPENSSL_1_0_0 // It fails on < 1.1 but no idea why. @@ -746,7 +747,9 @@ void run_multitest(const std::vector& mapping, Func fn) { TEST(OpenSSLErrorTest, ExtractPubkeyFromCert) { std::vector mapping{{&fail_BIO_new, 1, jwt::error::rsa_error::create_mem_bio_failed}, {&fail_PEM_read_bio_X509, 1, jwt::error::rsa_error::cert_load_failed}, +#ifdef JWT_TEST_X509_GET_PUBKEY_INTERPOSITION {&fail_X509_get_pubkey, 1, jwt::error::rsa_error::get_key_failed}, +#endif {&fail_PEM_write_bio_PUBKEY, 1, jwt::error::rsa_error::write_key_failed}, #ifdef JWT_TEST_BIO_CTRL_INTERPOSITION {&fail_BIO_ctrl, 1, jwt::error::rsa_error::convert_to_pem_failed} @@ -764,7 +767,9 @@ TEST(OpenSSLErrorTest, ExtractPubkeyFromCert) { TEST(OpenSSLErrorTest, ExtractPubkeyFromCertErrorCode) { std::vector mapping{{&fail_BIO_new, 1, jwt::error::rsa_error::create_mem_bio_failed}, {&fail_PEM_read_bio_X509, 1, jwt::error::rsa_error::cert_load_failed}, +#ifdef JWT_TEST_X509_GET_PUBKEY_INTERPOSITION {&fail_X509_get_pubkey, 1, jwt::error::rsa_error::get_key_failed}, +#endif {&fail_PEM_write_bio_PUBKEY, 1, jwt::error::rsa_error::write_key_failed}, #ifdef JWT_TEST_BIO_CTRL_INTERPOSITION {&fail_BIO_ctrl, 1, jwt::error::rsa_error::convert_to_pem_failed} @@ -1223,7 +1228,9 @@ TEST(OpenSSLErrorTest, ECDSACertificate) { // extract_pubkey_from_cert {&fail_BIO_new, 2, jwt::error::ecdsa_error::create_mem_bio_failed}, {&fail_PEM_read_bio_X509, 1, jwt::error::ecdsa_error::cert_load_failed}, +#ifdef JWT_TEST_X509_GET_PUBKEY_INTERPOSITION {&fail_X509_get_pubkey, 1, jwt::error::ecdsa_error::get_key_failed}, +#endif {&fail_PEM_write_bio_PUBKEY, 1, jwt::error::ecdsa_error::write_key_failed}, #ifdef JWT_TEST_BIO_CTRL_INTERPOSITION { @@ -1367,7 +1374,9 @@ TEST(OpenSSLErrorTest, EdDSACertificate) { // extract_pubkey_from_cert {&fail_BIO_new, 2, jwt::error::rsa_error::create_mem_bio_failed}, {&fail_PEM_read_bio_X509, 1, jwt::error::rsa_error::cert_load_failed}, +#ifdef JWT_TEST_X509_GET_PUBKEY_INTERPOSITION {&fail_X509_get_pubkey, 1, jwt::error::rsa_error::get_key_failed}, +#endif #ifdef JWT_TEST_BIO_CTRL_INTERPOSITION {&fail_PEM_write_bio_PUBKEY, 1, jwt::error::rsa_error::write_key_failed}, {&fail_BIO_ctrl, 1, jwt::error::rsa_error::convert_to_pem_failed} From a013a4d3010d86b461448c9639ee48d121b8c197 Mon Sep 17 00:00:00 2001 From: Christopher McArthur Date: Wed, 25 Nov 2026 12:35:50 -0800 Subject: [PATCH 8/8] exclude new runner tmp for coverage --- tests/CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index a9bd95584..d87bb7f24 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -193,6 +193,9 @@ if(JWT_ENABLE_COVERAGE) include("code-coverage") setup_coverage(jwt-cpp-test) set(COVERAGE_EXCLUDES "/usr/**" "*test*" "*build*" "**/picojson.h") + if(DEFINED ENV{RUNNER_TEMP}) + list(APPEND COVERAGE_EXCLUDES "$ENV{RUNNER_TEMP}/**") + endif() setup_target_for_coverage_lcov(NAME coverage EXECUTABLE ${CMAKE_CURRENT_BINARY_DIR}/jwt-cpp-test LCOV_ARGS "--ignore-errors" "mismatch,mismatch,inconsistent") endif()