-
Notifications
You must be signed in to change notification settings - Fork 0
175 lines (135 loc) · 5.01 KB
/
Copy pathci.yml
File metadata and controls
175 lines (135 loc) · 5.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
# Auto-generated from cpp-library (https://github.com/stlab/cpp-library)
# Do not edit this file directly - it will be overwritten when templates are regenerated
name: CI
on:
push:
branches: [main, develop]
pull_request:
branches: [main]
release:
types: [published]
jobs:
test:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
compiler: [gcc, clang, msvc]
exclude:
- os: ubuntu-latest
compiler: msvc
- os: macos-latest
compiler: msvc
- os: macos-latest
compiler: gcc
- os: windows-latest
compiler: gcc
- os: windows-latest
compiler: clang
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v5
- name: Configure CMake
run: cmake --preset=test
- name: Build
run: cmake --build --preset=test
- name: Test
run: ctest --preset=test
install-test:
name: Test Installation (${{ matrix.os }})
runs-on: ${{ matrix.os }}
needs: test
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v5
- name: Build and Install
run: |
cmake --preset=default
cmake --build --preset=default
cmake --install build/default --prefix ${{ runner.temp }}/install
- name: Test find_package
shell: bash
run: |
# Create a minimal test to verify the installation works with find_package
mkdir -p ${{ runner.temp }}/test-find-package
cd ${{ runner.temp }}/test-find-package
# Get project name from CMakeLists.txt
PACKAGE_NAME=$(grep -m1 "project(" "${{ github.workspace }}/CMakeLists.txt" | sed 's/project(\([^)]*\)).*/\1/' | awk '{print $1}')
# Convert paths to forward slashes for CMake (works on all platforms)
INSTALL_PREFIX=$(echo "${{ runner.temp }}/install" | sed 's|\\|/|g')
# Create test CMakeLists.txt
cat > CMakeLists.txt << EOF
cmake_minimum_required(VERSION 3.20)
project(test-find-package CXX)
set(CMAKE_PREFIX_PATH "${INSTALL_PREFIX}")
find_package(${PACKAGE_NAME} REQUIRED)
message(STATUS "Successfully found ${PACKAGE_NAME}")
EOF
# Test find_package
cmake -B build -S .
- name: Test CPMFindPackage
shell: bash
run: |
# Create test to verify CPMFindPackage works (tries find_package first, then CPM)
mkdir -p ${{ runner.temp }}/test-cpm
cd ${{ runner.temp }}/test-cpm
# Download CPM.cmake
mkdir cmake
curl -L https://github.com/cpm-cmake/CPM.cmake/releases/latest/download/get_cpm.cmake -o cmake/CPM.cmake
# Get project name from CMakeLists.txt
PACKAGE_NAME=$(grep -m1 "project(" "${{ github.workspace }}/CMakeLists.txt" | sed 's/project(\([^)]*\)).*/\1/' | awk '{print $1}')
# Convert paths to forward slashes for CMake (works on all platforms)
INSTALL_PREFIX=$(echo "${{ runner.temp }}/install" | sed 's|\\|/|g')
# Create test CMakeLists.txt that uses CPMFindPackage
cat > CMakeLists.txt << EOF
cmake_minimum_required(VERSION 3.20)
project(test-cpm CXX)
set(CMAKE_PREFIX_PATH "${INSTALL_PREFIX}")
set(CPM_SOURCE_CACHE \${CMAKE_SOURCE_DIR}/.cache/cpm CACHE PATH "CPM cache")
include(cmake/CPM.cmake)
# CPMFindPackage tries find_package first, then falls back to CPMAddPackage
CPMFindPackage(
NAME ${PACKAGE_NAME}
GITHUB_REPOSITORY ${{ github.repository }}
GIT_TAG ${{ github.sha }}
)
message(STATUS "Successfully acquired ${PACKAGE_NAME} via CPMFindPackage")
EOF
# Test CPMFindPackage (should find the installed version first)
cmake -B build -S .
clang-tidy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Configure CMake with clang-tidy
run: cmake --preset=clang-tidy
- name: Build with clang-tidy
run: cmake --build --preset=clang-tidy
- name: Run tests with clang-tidy
run: ctest --preset=clang-tidy
docs:
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'
permissions:
id-token: write
pages: write
contents: read
steps:
- uses: actions/checkout@v5
- name: Install Doxygen
uses: ssciwr/doxygen-install@v1
- name: Configure CMake
run: cmake --preset=docs
- name: Build Documentation
run: cmake --build --preset=docs
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Upload artifact
uses: actions/upload-pages-artifact@v4
with:
path: build/docs/html
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4