diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index fc68a85b2..968770356 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -28,8 +28,8 @@ jobs: sudo make install - name: test + working-directory: tests/cmake run: | - cd tests/cmake cmake . -DTEST:STRING="defaults-enabled" -DCMAKE_FIND_DEBUG_MODE=1 cmake --build . @@ -43,12 +43,12 @@ jobs: run: | mkdir build cd build - cmake .. + cmake .. -DJWT_BUILD_EXAMPLES=ON sudo cmake --install . - name: test + working-directory: tests/cmake run: | - cd tests/cmake cmake . -DTEST:STRING="defaults-enabled" cmake --build . @@ -114,6 +114,25 @@ jobs: 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@v3 + - 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: @@ -214,7 +233,7 @@ jobs: cmake . -DTEST:STRING="wolfssl-is-used" cmake --build . - with-hunter: + with-hunter: # This is actually testing the integration with the package management runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/cross-platform.yml b/.github/workflows/cross-platform.yml index 1716d9cc9..b25d126cf 100644 --- a/.github/workflows/cross-platform.yml +++ b/.github/workflows/cross-platform.yml @@ -29,20 +29,10 @@ jobs: shell: bash run: cmake --build . - - if: matrix.os != 'windows-latest' - name: test - working-directory: ${{ github.workspace }}/build - shell: bash - run: | - ./example/rsa-create - ./example/rsa-verify - - - if: matrix.os == 'windows-latest' - name: test - working-directory: ${{ github.workspace }}/build + - name: test run: | - example\Debug\rsa-create.exe - example\Debug\rsa-verify.exe + cmake --build build/ --target rsa-create-run + cmake --build build/ --target rsa-verify-run - if: github.event_name == 'push' && always() uses: ./.github/actions/badge diff --git a/.github/workflows/jwt.yml b/.github/workflows/jwt.yml index 6bd10ffe2..2291cbb54 100644 --- a/.github/workflows/jwt.yml +++ b/.github/workflows/jwt.yml @@ -47,12 +47,10 @@ jobs: cmake .. -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DJWT_ENABLE_FUZZING=ON - name: run - working-directory: build run: | - make jwt-cpp-fuzz-BaseEncodeFuzz jwt-cpp-fuzz-BaseDecodeFuzz jwt-cpp-fuzz-TokenDecodeFuzz - ./tests/fuzz/jwt-cpp-fuzz-BaseEncodeFuzz -runs=100000 - ./tests/fuzz/jwt-cpp-fuzz-BaseDecodeFuzz -runs=100000 ../tests/fuzz/decode-corpus - ./tests/fuzz/jwt-cpp-fuzz-TokenDecodeFuzz -runs=100000 ../tests/fuzz/token-corpus + cmake --build build/ --target jwt-cpp-fuzz-BaseEncodeFuzz-run + cmake --build build/ --target jwt-cpp-fuzz-BaseDecodeFuzz-run + cmake --build build/ --target jwt-cpp-fuzz-TokenDecodeFuzz-run asan: # Based on https://gist.github.com/jlblancoc/44be9d4d466f0a973b1f3808a8e56782 runs-on: ubuntu-latest diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7cd7ef531..fc6a18ff9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,4 +1,4 @@ -name: Nuget CD +name: Release CD on: # Allows you to run this workflow manually from the Actions tab diff --git a/.github/workflows/targets.yml b/.github/workflows/targets.yml index d331c4a2e..dfda4986f 100644 --- a/.github/workflows/targets.yml +++ b/.github/workflows/targets.yml @@ -37,6 +37,7 @@ jobs: mkdir build cd build cmake .. + cmake --build . cmake --install . - name: test working-directory: tests/cmake @@ -45,6 +46,7 @@ jobs: cmake --build . gcc-12: + name: GCC 12 runs-on: ubuntu-latest container: image: ubuntu:jammy-20231004 # 22.04 @@ -66,6 +68,7 @@ jobs: mkdir build cd build cmake .. + cmake --build . cmake --install . - name: test diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt index a153b57b1..94b749ecb 100644 --- a/example/CMakeLists.txt +++ b/example/CMakeLists.txt @@ -13,18 +13,22 @@ endif() add_executable(print-claims print-claims.cpp) target_link_libraries(print-claims jwt-cpp::jwt-cpp) +add_custom_target(print-claims-run COMMAND print-claims) add_executable(private-claims private-claims.cpp) target_link_libraries(private-claims jwt-cpp::jwt-cpp) add_executable(rsa-create rsa-create.cpp) target_link_libraries(rsa-create jwt-cpp::jwt-cpp) +add_custom_target(rsa-create-run COMMAND rsa-create) add_executable(rsa-verify rsa-verify.cpp) target_link_libraries(rsa-verify jwt-cpp::jwt-cpp) +add_custom_target(rsa-verify-run COMMAND rsa-verify) add_executable(jwks-verify jwks-verify.cpp) target_link_libraries(jwks-verify jwt-cpp::jwt-cpp) +add_custom_target(jwks-verify-run COMMAND jwks-verify) add_executable(es256k es256k.cpp) target_link_libraries(es256k jwt-cpp::jwt-cpp) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index c41809f7d..356aa3b80 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -75,6 +75,7 @@ target_link_libraries(jwt-cpp-test PRIVATE jwt-cpp nlohmann_json::nlohmann_json $<$>:${CMAKE_DL_LIBS}>) gtest_discover_tests(jwt-cpp-test) +add_custom_target(jwt-cpp-test-run COMMAND jwt-cpp-test) if(JWT_ENABLE_COVERAGE) include("code-coverage") diff --git a/tests/fuzz/CMakeLists.txt b/tests/fuzz/CMakeLists.txt index 1860731fe..4bacf5c24 100644 --- a/tests/fuzz/CMakeLists.txt +++ b/tests/fuzz/CMakeLists.txt @@ -5,16 +5,20 @@ endif() function(ADD_FUZZING_EXECUTABLE TARGET) add_executable(jwt-cpp-fuzz-${TARGET} "${TARGET}.cpp") target_compile_options( - jwt-cpp-fuzz-${TARGET} - PRIVATE -g -O1 -fsanitize=fuzzer,address,signed-integer-overflow,undefined - -fno-omit-frame-pointer) - target_link_options( - jwt-cpp-fuzz-${TARGET} PRIVATE - -fsanitize=fuzzer,address,signed-integer-overflow,undefined - -fno-omit-frame-pointer) + jwt-cpp-fuzz-${TARGET} PRIVATE -g -O1 -fsanitize=fuzzer,address,signed-integer-overflow,undefined + -fno-omit-frame-pointer) + target_link_options(jwt-cpp-fuzz-${TARGET} PRIVATE -fsanitize=fuzzer,address,signed-integer-overflow,undefined + -fno-omit-frame-pointer) target_link_libraries(jwt-cpp-fuzz-${TARGET} PRIVATE jwt-cpp::jwt-cpp) endfunction() add_fuzzing_executable(BaseEncodeFuzz) +add_custom_target(jwt-cpp-fuzz-BaseEncodeFuzz-run COMMAND jwt-cpp-fuzz-BaseEncodeFuzz -runs=100000) + add_fuzzing_executable(BaseDecodeFuzz) +add_custom_target(jwt-cpp-fuzz-BaseDecodeFuzz-run COMMAND jwt-cpp-fuzz-BaseDecodeFuzz -runs=100000 decode-corpus + WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}) + add_fuzzing_executable(TokenDecodeFuzz) +add_custom_target(jwt-cpp-fuzz-TokenDecodeFuzz-run COMMAND jwt-cpp-fuzz-TokenDecodeFuzz -runs=100000 token-corpus + WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR})