Skip to content

Commit a55abe7

Browse files
Merge pull request #1 from nevergiveupcpp/ngu/ci
chore: add CI workflow with cmake presets
2 parents 4b41c9b + 552659f commit a55abe7

2 files changed

Lines changed: 124 additions & 21 deletions

File tree

.github/workflows/ci.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: ["master"]
6+
pull_request:
7+
branches: ["master"]
8+
9+
jobs:
10+
test:
11+
name: ${{ matrix.name }}
12+
runs-on: ${{ matrix.os }}
13+
14+
strategy:
15+
fail-fast: false
16+
17+
matrix:
18+
include:
19+
- name: Windows x64 / MSVC
20+
os: windows-latest
21+
preset: msvc-x64
22+
vcpkg_triplet: x64-windows
23+
24+
- name: Windows x64 / Clang
25+
os: windows-latest
26+
preset: llvm-x64
27+
vcpkg_triplet: x64-windows
28+
29+
- name: Windows ARM64 / MSVC
30+
os: windows-11-arm
31+
preset: msvc-arm64
32+
vcpkg_triplet: arm64-windows
33+
34+
- name: Linux x64 / GCC
35+
os: ubuntu-latest
36+
preset: gcc-linux-x64
37+
vcpkg_triplet: x64-linux-dynamic
38+
39+
- name: Linux ARM64 / GCC
40+
os: ubuntu-24.04-arm
41+
preset: gcc-linux-arm64
42+
vcpkg_triplet: arm64-linux
43+
44+
- name: macOS ARM64 / AppleClang
45+
os: macos-latest
46+
preset: apple-clang-macos-arm64
47+
vcpkg_triplet: arm64-osx
48+
49+
steps:
50+
- uses: actions/checkout@v4
51+
52+
- name: Set VCPKG_ROOT
53+
shell: bash
54+
run: echo "VCPKG_ROOT=$VCPKG_INSTALLATION_ROOT" >> $GITHUB_ENV
55+
56+
- name: Install GTest
57+
run: vcpkg install gtest:${{ matrix.vcpkg_triplet }}
58+
59+
- name: Configure
60+
working-directory: tests/unittest
61+
run: cmake --preset ${{ matrix.preset }}
62+
63+
- name: Build
64+
working-directory: tests/unittest
65+
run: cmake --build --preset ${{ matrix.preset }} --config Release
66+
67+
- name: Test
68+
working-directory: tests/unittest/build/${{ matrix.preset }}
69+
run: ctest --build-config Release --output-on-failure

tests/CMakePresets.json

Lines changed: 55 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,18 @@
3737
"VCPKG_TARGET_TRIPLET": "x86-windows"
3838
}
3939
},
40+
{
41+
"name": "msvc-arm64",
42+
"inherits": "base-release",
43+
"displayName": "MSVC ARM64 Release",
44+
"binaryDir": "${sourceDir}/build/msvc-arm64",
45+
"toolset": "v143",
46+
"architecture": "ARM64",
47+
"cacheVariables": {
48+
"CMAKE_MSVC_RUNTIME_LIBRARY": "MultiThreadedDLL",
49+
"VCPKG_TARGET_TRIPLET": "arm64-windows"
50+
}
51+
},
4052
{
4153
"name": "llvm-x64",
4254
"inherits": "base-release",
@@ -84,32 +96,54 @@
8496
"CMAKE_CXX_FLAGS": "-m32 -msse -msse2",
8597
"VCPKG_TARGET_TRIPLET": "x86-linux"
8698
}
87-
}
88-
],
89-
"buildPresets": [
90-
{
91-
"name": "msvc-x64",
92-
"configurePreset": "msvc-x64"
93-
},
94-
{
95-
"name": "msvc-x86",
96-
"configurePreset": "msvc-x86"
9799
},
98100
{
99-
"name": "llvm-x64",
100-
"configurePreset": "llvm-x64"
101-
},
102-
{
103-
"name": "gcc-mingw-x64",
104-
"configurePreset": "gcc-mingw-x64"
101+
"name": "clang-linux-x64",
102+
"inherits": "base-release",
103+
"displayName": "Clang Linux x64 Release",
104+
"binaryDir": "${sourceDir}/build/clang-linux-x64",
105+
"generator": "Ninja",
106+
"cacheVariables": {
107+
"CMAKE_C_COMPILER": "clang",
108+
"CMAKE_CXX_COMPILER": "clang++",
109+
"VCPKG_TARGET_TRIPLET": "x64-linux-dynamic"
110+
}
105111
},
106112
{
107-
"name": "gcc-linux-x64",
108-
"configurePreset": "gcc-linux-x64"
113+
"name": "gcc-linux-arm64",
114+
"inherits": "base-release",
115+
"displayName": "GCC Linux ARM64 Release",
116+
"binaryDir": "${sourceDir}/build/gcc-linux-arm64",
117+
"generator": "Ninja",
118+
"cacheVariables": {
119+
"CMAKE_C_COMPILER": "gcc",
120+
"CMAKE_CXX_COMPILER": "g++",
121+
"VCPKG_TARGET_TRIPLET": "arm64-linux"
122+
}
109123
},
110124
{
111-
"name": "gcc-linux-x86",
112-
"configurePreset": "gcc-linux-x86"
125+
"name": "apple-clang-macos-arm64",
126+
"inherits": "base-release",
127+
"displayName": "Apple Clang macOS ARM64 Release",
128+
"binaryDir": "${sourceDir}/build/apple-clang-macos-arm64",
129+
"generator": "Ninja",
130+
"cacheVariables": {
131+
"CMAKE_C_COMPILER": "clang",
132+
"CMAKE_CXX_COMPILER": "clang++",
133+
"VCPKG_TARGET_TRIPLET": "arm64-osx"
134+
}
113135
}
136+
],
137+
"buildPresets": [
138+
{ "name": "msvc-x64", "configurePreset": "msvc-x64" },
139+
{ "name": "msvc-x86", "configurePreset": "msvc-x86" },
140+
{ "name": "msvc-arm64", "configurePreset": "msvc-arm64" },
141+
{ "name": "llvm-x64", "configurePreset": "llvm-x64" },
142+
{ "name": "gcc-mingw-x64", "configurePreset": "gcc-mingw-x64" },
143+
{ "name": "gcc-linux-x64", "configurePreset": "gcc-linux-x64" },
144+
{ "name": "gcc-linux-x86", "configurePreset": "gcc-linux-x86" },
145+
{ "name": "clang-linux-x64", "configurePreset": "clang-linux-x64" },
146+
{ "name": "gcc-linux-arm64", "configurePreset": "gcc-linux-arm64" },
147+
{ "name": "apple-clang-macos-arm64", "configurePreset": "apple-clang-macos-arm64" }
114148
]
115-
}
149+
}

0 commit comments

Comments
 (0)