Skip to content

Commit 5bb34a1

Browse files
chore: add CI
1 parent 54d37eb commit 5bb34a1

3 files changed

Lines changed: 172 additions & 21 deletions

File tree

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @nevergiveupcpp

.github/workflows/ci.yml

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
pull_request:
7+
branches: ["main"]
8+
9+
jobs:
10+
unittests:
11+
name: ${{ matrix.name }}
12+
runs-on: ${{ matrix.os }}
13+
if: github.event_name == 'pull_request'
14+
15+
strategy:
16+
fail-fast: false
17+
18+
matrix:
19+
include:
20+
- name: Windows x64 / MSVC
21+
os: windows-latest
22+
preset: msvc-x64
23+
vcpkg_triplet: x64-windows
24+
25+
- name: Windows x64 / Clang
26+
os: windows-latest
27+
preset: llvm-x64
28+
vcpkg_triplet: x64-windows
29+
30+
- name: Windows ARM64 / MSVC
31+
os: windows-11-arm
32+
preset: msvc-arm64
33+
vcpkg_triplet: arm64-windows
34+
35+
- name: Linux x64 / GCC
36+
os: ubuntu-latest
37+
preset: gcc-linux-x64
38+
vcpkg_triplet: x64-linux-dynamic
39+
40+
- name: Linux ARM64 / GCC
41+
os: ubuntu-24.04-arm
42+
preset: gcc-linux-arm64
43+
vcpkg_triplet: arm64-linux
44+
45+
- name: macOS ARM64 / AppleClang
46+
os: macos-latest
47+
preset: apple-clang-macos-arm64
48+
vcpkg_triplet: arm64-osx
49+
50+
steps:
51+
- uses: actions/checkout@v4
52+
53+
- name: Set VCPKG_ROOT
54+
shell: bash
55+
run: echo "VCPKG_ROOT=$VCPKG_INSTALLATION_ROOT" >> $GITHUB_ENV
56+
57+
- name: Install GTest
58+
run: vcpkg install gtest:${{ matrix.vcpkg_triplet }}
59+
60+
- name: Configure
61+
working-directory: tests/unittest
62+
run: cmake --preset ${{ matrix.preset }}
63+
64+
- name: Build
65+
working-directory: tests/unittest
66+
run: cmake --build --preset ${{ matrix.preset }} --config Release
67+
68+
- name: Test
69+
working-directory: tests/unittest/build/${{ matrix.preset }}
70+
run: ctest --build-config Release --output-on-failure
71+
72+
benchmark:
73+
name: Benchmark
74+
runs-on: windows-latest
75+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
76+
77+
steps:
78+
- uses: actions/checkout@v4
79+
80+
- name: Set VCPKG_ROOT
81+
shell: bash
82+
run: echo "VCPKG_ROOT=$VCPKG_INSTALLATION_ROOT" >> $GITHUB_ENV
83+
84+
- name: Install Google Benchmark
85+
run: vcpkg install benchmark:x64-windows
86+
87+
- name: Configure
88+
working-directory: tests/benchmark
89+
run: cmake --preset msvc-x64
90+
91+
- name: Build
92+
working-directory: tests/benchmark
93+
run: cmake --build --preset msvc-x64 --config Release
94+
95+
- name: Run
96+
working-directory: tests/benchmark/build/msvc-x64/Release
97+
run: ./benchmark-pvm.exe --benchmark_format=json --benchmark_out=result.json
98+
99+
- name: Store results
100+
uses: benchmark-action/github-action-benchmark@v1
101+
with:
102+
tool: googlecpp
103+
output-file-path: tests/benchmark/build/msvc-x64/Release/result.json
104+
github-token: ${{ secrets.GITHUB_TOKEN }}
105+
auto-push: true
106+
comment-on-alert: true
107+
alert-threshold: '150%'
108+
fail-on-alert: true
109+
110+
all-checks:
111+
name: All Checks
112+
runs-on: ubuntu-latest
113+
if: github.event_name == 'pull_request'
114+
needs: [unittests]
115+
steps:
116+
- run: echo "All checks passed"

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)