Files
jwt-cpp/tests/CMakePresets.json
Chris Mc a6927cb814 Add support for CMake Presets (#348)
* dev container + vscode extensions

* exploring cmake presets for CI

* ignore user presets

* add configure to build preset

windows ran in debug, which means the multi config needs more help

* coverage preset

* creating a fuzzing preset

* fuzzing fix cwd + more configs to preset

* move cmake set vars to right section

https://learn.microsoft.com/en-us/cpp/build/cmake-presets-vs?view=msvc-170

"You can set C and C++ compilers by using cacheVariables.CMAKE_C_COMPILER and cacheVariables.CMAKE_CXX_COMPILER in a Configure Preset. It's equivalent to passing -D CMAKE_C_COMPILER=<value> and -D CMAKE_CXX_COMPILER=<value> to CMake from the command line."

* fix workdir for new fuzz run targets

* split up presets into more files

* fix include order (liking this less)

* add asan to presets

* fix copy paste

* add asan build preset

* move ubsan to presets

* replace mustache with a cmake script

* touch ups

* restore file to void merge conflicts

* fix order for args

* remove action wrapper

more quotes for inputs

* revert bad render of boost_json

* fix casing

* format changes

* test to see if output is working

* last try

* git revert moving mustache to cmake

* cmake not enough for presets

* drop ci prefix

* new test for `library_ROOT` search path

* install with presets

* cmake --install does not take a preset

* install with preset is not yet supported

https://gitlab.kitware.com/cmake/cmake/-/issues/23208

* add missing build step

* more global fuzzing flags to toolchain file

* fixup toolchain in presets

* fix pathing and limit configs to tested platforms

* clean up + use presets for clang-tidy

* dry up sanitizer flags

* try install with a preset

* remove duplicated test

* notes about hunter test

* skip checking the compiler since this causes errors with the same CMake uses in combinations with the fuzz sanitizer flag

https://github.com/prince-chrismc/jwt-cpp/actions/runs/7481024827/job/20361722539?pr=33

```
    /usr/bin/ld: /usr/bin/ld: DWARF error: invalid or unhandled FORM value: 0x22
    CMakeFiles/cmTC_ff7c6.dir/testCCompiler.c.o: in function `main':
    testCCompiler.c:(.text.main[main]+0x0): multiple definition of `main'; /usr/lib/llvm-14/lib/clang/14.0.0/lib/linux/libclang_rt.fuzzer-x86_64.a(FuzzerMain.cpp.o):(.text.main+0x0): first defined here
    /usr/bin/ld: /usr/lib/llvm-14/lib/clang/14.0.0/lib/linux/libclang_rt.fuzzer-x86_64.a(FuzzerMain.cpp.o): in function `main':
    (.text.main+0x12): undefined reference to `LLVMFuzzerTestOneInput'
```

* remove system name to disable cross compiling

* tests do not pass clang-tidy

* drop toolchain, use target specific flags

* leave flags in cmake

* missing deps + clean apt files

* remove some code duplication

* fix typo

* devcontainers fix, test and add wolfssl

refactored installer to have a script that could be reused

* add missing build context

* pass version to script

* dont use bash syntax

* fix typo

* upload tar.gz for new releases

* revert name to manually trigger it

* Update and rename nuget.yml to release.yml

* disable nuget for testing

* add a zip as well

* back to basics

* remove remove testing code

* update workflow name

* enable testing needs to be in the root

* add a test preset and use it in some workflows

* fix linting tests

* bump github actions

* bump python setup

* drop dev containers

* dont install openssl on windows

* revert merge conflicts

* fix whitespace

* fix private claims example to have a valid token

#351

* put back versioned format

I dont remember why, it looks like it was debugging
2024-06-15 07:52:23 -07:00

146 lines
4.5 KiB
JSON

{
"version": 6,
"cmakeMinimumRequired": {
"major": 3,
"minor": 25,
"patch": 0
},
"include": [
"../cmake/CMakePresets.json"
],
"configurePresets": [
{
"name": "linux",
"hidden": true,
"description": "This is only available on Linux",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Linux"
}
},
{
"name": "coverage",
"inherits": ["debug", "linux"],
"displayName": "Coverage",
"description": "This is only available on Linux",
"cacheVariables": {
"JWT_BUILD_TESTS": "ON",
"JWT_ENABLE_COVERAGE": "ON"
}
},
{
"name": "unit-tests",
"inherits": ["debug"],
"displayName": "Unit Tests",
"cacheVariables": {
"JWT_BUILD_TESTS": "ON"
}
},
{
"name": "ci-fuzzing",
"inherits": ["debug", "linux"],
"displayName": "Fuzz Testing",
"description": "This is only available on Linux with Clang",
"cacheVariables": {
"JWT_ENABLE_FUZZING": "ON",
"CMAKE_C_COMPILER": "clang",
"CMAKE_CXX_COMPILER": "clang++"
}
},
{
"name": "ci-asan",
"inherits": ["debug", "linux"],
"displayName": "Address/Leak Sanitizer",
"description": "This is only available on Linux",
"environment": {
"ASAN_FLAGS": "-fsanitize=address -fsanitize=leak",
"ASAN_OPTIONS": "check_initialization_order=true:detect_stack_use_after_return=true:fast_unwind_on_malloc=0"
},
"cacheVariables": {
"JWT_BUILD_EXAMPLES": "ON",
"JWT_BUILD_TESTS": "ON",
"CMAKE_C_FLAGS": "$env{ASAN_FLAGS}",
"CMAKE_CXX_FLAGS": "$env{ASAN_FLAGS}",
"CMAKE_EXE_LINKER_FLAGS": "$env{ASAN_FLAGS}",
"CMAKE_MODULE_LINKER_FLAGS": "$env{ASAN_FLAGS}"
}
},
{
"name": "ci-ubsan",
"inherits": ["debug", "linux"],
"displayName": "Undefined Behavior Sanitizer",
"description": "This is only available on Linux",
"environment": {
"UBSAN_FLAGS": "-fsanitize=undefined -fsanitize=return -fsanitize=float-divide-by-zero -fsanitize=float-cast-overflow -fno-sanitize-recover=all",
"UBSAN_OPTIONS": "print_stacktrace=1"
},
"cacheVariables": {
"JWT_BUILD_EXAMPLES": "ON",
"JWT_BUILD_TESTS": "ON",
"CMAKE_C_FLAGS": "$env{UBSAN_FLAGS}",
"CMAKE_CXX_FLAGS": "$env{UBSAN_FLAGS}",
"CMAKE_EXE_LINKER_FLAGS": "$env{UBSAN_FLAGS}",
"CMAKE_MODULE_LINKER_FLAGS": "$env{UBSAN_FLAGS}"
}
}
],
"buildPresets": [
{
"name": "coverage",
"configurePreset": "coverage",
"configuration": "Debug",
"targets": [
"jwt-cpp-test",
"coverage"
]
},
{
"name": "unit-tests",
"configurePreset": "unit-tests",
"configuration": "Debug",
"targets": [
"jwt-cpp-test"
]
},
{
"name": "ci-fuzzing",
"configurePreset": "ci-fuzzing",
"targets": [
"jwt-cpp-fuzz-BaseEncodeFuzz",
"jwt-cpp-fuzz-BaseDecodeFuzz",
"jwt-cpp-fuzz-TokenDecodeFuzz"
]
},
{
"name": "ci-asan",
"configurePreset": "ci-asan",
"targets": [
"rsa-create",
"rsa-verify",
"jwks-verify",
"jwt-cpp-test"
]
},
{
"name": "ci-ubsan",
"configurePreset": "ci-ubsan",
"targets": [
"rsa-create",
"rsa-verify",
"jwks-verify",
"jwt-cpp-test"
]
}
],
"testPresets": [
{
"name": "unit-tests",
"description": "Run the unit tests",
"configurePreset": "unit-tests",
"execution": {
"noTestsAction": "error"
}
}
]
}