From fe4dfe337f01e37d31d645b82b28d997293c0985 Mon Sep 17 00:00:00 2001 From: Alfi Maulana Date: Wed, 16 Oct 2024 08:47:44 +0700 Subject: [PATCH] build: add CMake preset for development (#252) * build: add `CMakePresets.json` file Signed-off-by: Alfi Maulana * ci: use CMake presets in workflows Signed-off-by: Alfi Maulana --------- Signed-off-by: Alfi Maulana --- .github/workflows/build.yaml | 4 +--- .github/workflows/test.yaml | 9 ++------- CMakePresets.json | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 35 insertions(+), 10 deletions(-) create mode 100644 CMakePresets.json diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 34a14f0..c180e24 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -13,9 +13,7 @@ jobs: uses: actions/checkout@v4.2.1 - name: Configure Project - uses: threeal/cmake-action@v2.0.0 - with: - run-build: false + run: cmake --preset default - name: Install Project run: cmake --install build --prefix install diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 8c2d8d6..71514d9 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -13,12 +13,7 @@ jobs: uses: actions/checkout@v4.2.1 - name: Configure Project - uses: threeal/cmake-action@v2.0.0 - with: - options: ASSERTION_ENABLE_TESTS=ON - run-build: false + run: cmake --preset development - name: Test Project - uses: threeal/ctest-action@v1.1.0 - with: - verbose: true + run: ctest --preset development diff --git a/CMakePresets.json b/CMakePresets.json new file mode 100644 index 0000000..eeb08d8 --- /dev/null +++ b/CMakePresets.json @@ -0,0 +1,32 @@ +{ + "version": 3, + "cmakeMinimumRequired": { + "major": 3, + "minor": 21 + }, + "configurePresets": [ + { + "name": "default", + "binaryDir": "${sourceDir}/build" + }, + { + "name": "development", + "inherits": ["default"], + "cacheVariables": { + "ASSERTION_ENABLE_TESTS": "ON" + } + } + ], + "testPresets": [ + { + "name": "development", + "configurePreset": "development", + "output": { + "verbosity": "verbose" + }, + "execution": { + "noTestsAction": "error" + } + } + ] +}