Skip to content

Commit 493793d

Browse files
committed
ci use presets
1 parent 67a5f18 commit 493793d

5 files changed

Lines changed: 55 additions & 33 deletions

File tree

.github/copilot-instructions.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
description: when building the project code, use CMake presets
3+
applyTo: '**/*.cmake, **/CMakeLists.txt, **/CMakePresets.json, **/*.cpp, **/*.h, **/*.c, **/*.f90'
4+
---
5+
6+
* build and test project code: `cmake --workflow default`
7+
* only build the project code: `cmake --workflow build`

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
- uses: ./.github/workflows/composite-unix
4545

4646

47-
linux-gcc-9-10-11:
47+
linux-gcc-old:
4848
runs-on: ubuntu-22.04
4949
timeout-minutes: 15
5050

@@ -61,7 +61,7 @@ jobs:
6161
- *checkout
6262

6363
- name: GCC APT
64-
if: matrix.gcc-version < 11
64+
if: matrix.gcc-version < 10
6565
run: |
6666
sudo apt update -y
6767
sudo apt install -y --no-install-recommends gcc-${{ matrix.gcc-version }} g++-${{ matrix.gcc-version }} gfortran-${{ matrix.gcc-version }}
@@ -90,7 +90,7 @@ jobs:
9090
- name: install compilers
9191
run: |
9292
apt update -y
93-
apt install -y --no-install-recommends ca-certificates gpg curl make ninja-build ${{ env.CC }} ${{ env.CXX }} ${{ env.FC }}
93+
apt install -y --no-install-recommends ca-certificates gpg curl make ${{ env.CC }} ${{ env.CXX }} ${{ env.FC }}
9494
9595
- name: install CMake
9696
run: |

.github/workflows/composite-unix/action.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
name: Composite Unix
2+
description: Build and test on Unix with multiple compilers
3+
14
runs:
25

36
using: "composite"
@@ -14,7 +17,7 @@ runs:
1417

1518
- name: upload CMakeConfigureLog.yaml
1619
if: failure() && hashFiles('build/CMakeFiles/CMakeConfigureLog.yaml') != ''
17-
uses: actions/upload-artifact@v6
20+
uses: actions/upload-artifact@v7
1821
with:
1922
name: ${{ runner.os }}-${{ env.CC }}-${{ env.FC }}-CMakeConfigureLog.yaml
2023
path: build/CMakeFiles/CMakeConfigureLog.yaml

.github/workflows/oneapi-linux.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@ env:
55
CXX: icpx
66
FC: ifx
77
# https://github.com/oneapi-src/oneapi-ci/blob/master/.github/workflows/build_all.yml
8-
CTEST_NO_TESTS_ACTION: error
9-
CMAKE_BUILD_TYPE: Release
10-
CMAKE_GENERATOR: Ninja
11-
# don't need Ninja but it prints the command lines by default which is good for debugging
128

139
# debug triggers asan build errors, peculiar to GitHub Actions
1410

@@ -72,7 +68,7 @@ jobs:
7268

7369
- name: Upload log failure
7470
if: failure()
75-
uses: actions/upload-artifact@v6
71+
uses: actions/upload-artifact@v7
7672
with:
7773
name: oneapi-${{ runner.os }}-CMakeConfigureLog.yaml
7874
path: build/CMakeFiles/CMakeConfigureLog.yaml

CMakePresets.json

Lines changed: 40 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
"configurePresets": [
55
{
66
"name": "default",
7-
"binaryDir": "${sourceDir}/build",
7+
"binaryDir": "build",
88
"cacheVariables": {
9+
"CMAKE_BUILD_TYPE": "Release",
910
"CMAKE_COMPILE_WARNING_AS_ERROR": true,
1011
"CMAKE_LINK_WARNING_AS_ERROR": true
1112
}
@@ -15,36 +16,43 @@
1516
},
1617
{ "name": "gmake", "inherits": "default",
1718
"generator": "Unix Makefiles"
19+
},
20+
{ "name": "build", "inherits": "default"},
21+
{
22+
"name": "debug", "inherits": "default",
23+
"cacheVariables": {
24+
"CMAKE_BUILD_TYPE": "Debug"
25+
}
26+
},
27+
{
28+
"name": "msvc", "inherits": "default",
29+
"generator": "Visual Studio 18 2026"
1830
}
1931
],
2032
"buildPresets": [
2133
{
2234
"name": "default",
23-
"configurePreset": "default"
24-
},
25-
{
26-
"name": "release",
2735
"configurePreset": "default",
28-
"configuration": "Release"
36+
"configuration": "Release",
37+
"jobs": 0
2938
},
39+
{ "name": "build", "inherits": "default", "configurePreset": "build" },
40+
{ "name": "msvc", "inherits": "default", "configurePreset": "msvc" },
41+
{ "name": "debug", "configurePreset": "debug", "configuration": "Debug" },
3042
{
3143
"name": "reldebug",
3244
"configurePreset": "default",
3345
"configuration": "RelWithDebInfo",
3446
"displayName": "Release with Debug Info"
3547
},
36-
{
37-
"name": "debug",
38-
"configurePreset": "default",
39-
"configuration": "Debug"
40-
},
4148
{ "name": "ninja", "configurePreset": "ninja" },
4249
{ "name": "gmake", "configurePreset": "gmake" }
4350
],
4451
"testPresets": [
4552
{
4653
"name": "default",
4754
"configurePreset": "default",
55+
"configuration": "Release",
4856
"output": {
4957
"outputOnFailure": true,
5058
"verbosity": "verbose"
@@ -53,23 +61,19 @@
5361
"noTestsAction": "error",
5462
"scheduleRandom": true,
5563
"stopOnFailure": false,
56-
"timeout": 15
64+
"jobs": 4
5765
}
5866
},
59-
{
60-
"name": "release", "inherits": "default",
61-
"configurePreset": "default",
62-
"configuration": "Release"
63-
},
6467
{
6568
"name": "reldebug", "inherits": "default",
6669
"configurePreset": "default",
6770
"configuration": "RelWithDebInfo",
6871
"displayName": "Release with Debug Info"
6972
},
73+
{ "name": "msvc", "inherits": "default", "configurePreset": "msvc" },
7074
{
7175
"name": "debug", "inherits": "default",
72-
"configurePreset": "default",
76+
"configurePreset": "debug",
7377
"configuration": "Debug"
7478
},
7579
{ "name": "ninja", "configurePreset": "ninja" },
@@ -78,31 +82,42 @@
7882
"workflowPresets": [
7983
{
8084
"name": "default",
85+
"displayName": "build and test",
8186
"steps": [
8287
{ "type": "configure", "name": "default" },
8388
{ "type": "build", "name": "default" },
8489
{ "type": "test", "name": "default" }
85-
90+
]
91+
},
92+
{
93+
"name": "build",
94+
"displayName": "build only",
95+
"steps": [
96+
{ "type": "configure", "name": "build" },
97+
{ "type": "build", "name": "build" }
8698
]
8799
},
88100
{
89101
"name": "debug",
102+
"displayName": "Debug build and test",
90103
"steps": [
91-
{ "type": "configure", "name": "default" },
104+
{ "type": "configure", "name": "debug" },
92105
{ "type": "build", "name": "debug" },
93106
{ "type": "test", "name": "debug" }
94107
]
95108
},
96109
{
97-
"name": "release",
110+
"name": "msvc",
111+
"displayName": "MSVC build and test",
98112
"steps": [
99-
{ "type": "configure", "name": "default" },
100-
{ "type": "build", "name": "release" },
101-
{ "type": "test", "name": "release" }
113+
{ "type": "configure", "name": "msvc" },
114+
{ "type": "build", "name": "msvc" },
115+
{ "type": "test", "name": "msvc" }
102116
]
103117
},
104118
{
105119
"name": "ninja",
120+
"displayName": "Ninja build and test",
106121
"steps": [
107122
{ "type": "configure", "name": "ninja" },
108123
{ "type": "build", "name": "ninja" },
@@ -111,6 +126,7 @@
111126
},
112127
{
113128
"name": "gmake",
129+
"displayName": "GNU Make build and test",
114130
"steps": [
115131
{ "type": "configure", "name": "gmake" },
116132
{ "type": "build", "name": "gmake" },

0 commit comments

Comments
 (0)