Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create CMake preset #44

Merged
merged 9 commits into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion .github/workflows/ci_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,21 @@ on:
- cron: '30 15 * * *'

jobs:
preset-test:
runs-on: ubuntu-latest
strategy:
matrix:
preset: ["gcc-debug", "gcc-release"]
steps:
- uses: actions/checkout@v4
- name: Setup cmake
uses: jwlawson/actions-setup-cmake@v2
with:
cmake-version: '3.25.x'
- uses: seanmiddleditch/gha-setup-ninja@v5
- name: Run preset
run: cmake --workflow --preset ${{ matrix.preset }}

test:
runs-on: ubuntu-latest
strategy:
Expand Down Expand Up @@ -72,7 +87,7 @@ jobs:

create-issue-when-fault:
runs-on: ubuntu-latest
needs: [test]
needs: [test, preset-test]
if: failure() && github.event_name == 'schedule'
steps:
# See https://github.com/cli/cli/issues/5075
Expand Down
121 changes: 121 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
{
"version": 6,
"configurePresets": [
{
"name": "_root-config",
"hidden": true,
"generator": "Ninja",
wusatosi marked this conversation as resolved.
Show resolved Hide resolved
"binaryDir": "${sourceDir}/build/${presetName}",
"cacheVariables": {
"CMAKE_CXX_STANDARD": "20"
}
},
{
"name": "_debug-base",
"hidden": true,
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_CXX_FLAGS": "-g -fsanitize=address -fsanitize=pointer-compare -fsanitize=pointer-subtract -fsanitize=leak -fsanitize=undefined"
wusatosi marked this conversation as resolved.
Show resolved Hide resolved
}
},
{
"name": "_release-base",
"hidden": true,
"cacheVariables": {
"CMAKE_BUILD_TYPE": "RelWithDebInfo",
"CMAKE_CXX_FLAGS": "-g -O3"
wusatosi marked this conversation as resolved.
Show resolved Hide resolved
}
},
{
"name": "gcc-debug",
"displayName": "GCC Debug Build",
"inherits": [
"_root-config",
"_debug-base"
],
"cacheVariables": {
"CMAKE_CXX_COMPILER": "g++"
}
},
{
"name": "gcc-release",
"displayName": "GCC Release Build",
"inherits": [
"_root-config",
"_release-base"
],
"cacheVariables": {
"CMAKE_CXX_COMPILER": "g++"
}
}
],
"buildPresets": [
{
"name": "gcc-debug",
"configurePreset": "gcc-debug"
},
{
"name": "gcc-release",
"configurePreset": "gcc-release"
}
],
"testPresets": [
{
"name": "_test_base",
"hidden": true,
"output": {
"outputOnFailure": true
},
"execution": {
"noTestsAction": "error",
"stopOnFailure": true
}
},
{
"name": "gcc-debug",
"inherits": "_test_base",
"configurePreset": "gcc-debug"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not for this PR, but it just occurred to me that we might leverage the ninja-multiconfig generator to keep the list of configurePresets small? That is have one that configures Debug, Release, and possibly various sanitizer flavors? This might help keep the combinatorics down.

},
{
"name": "gcc-release",
"inherits": "_test_base",
"configurePreset": "gcc-release"
}
],
"workflowPresets": [
{
"name": "gcc-debug",
"steps": [
{
"type": "configure",
"name": "gcc-debug"
},
{
"type": "build",
"name": "gcc-debug"
},
{
"type": "test",
"name": "gcc-debug"
}
]
},
{
"name": "gcc-release",
"steps": [
{
"type": "configure",
"name": "gcc-release"
},
{
"type": "build",
"name": "gcc-release"
},
{
"type": "test",
"name": "gcc-release"
}
]
}
]
}