55
66on :
77 push :
8- branches : [ main, develop ]
8+ branches : [main, develop]
99 pull_request :
10- branches : [ main ]
10+ branches : [main]
1111 release :
1212 types : [published]
1313
@@ -32,42 +32,109 @@ jobs:
3232 runs-on : ${{ matrix.os }}
3333
3434 steps :
35- - uses : actions/checkout@v4
35+ - uses : actions/checkout@v5
3636
37- - name : Configure CMake
38- run : cmake --preset=test
37+ - name : Configure CMake
38+ run : cmake --preset=test
3939
40- - name : Build
41- run : cmake --build --preset=test
40+ - name : Build
41+ run : cmake --build --preset=test
4242
43- - name : Test
44- run : ctest --preset=test
43+ - name : Test
44+ run : ctest --preset=test
4545
46- clang-tidy :
47- runs-on : ubuntu-latest
48-
49- steps :
50- - uses : actions/checkout@v4
46+ install-test :
47+ name : Test Installation (${{ matrix.os }})
48+ runs-on : ${{ matrix.os }}
49+ needs : test
50+ strategy :
51+ fail-fast : false
52+ matrix :
53+ os : [ubuntu-latest, macos-latest, windows-latest]
5154
52- - name : Setup Ninja
53- uses : ashutoshvarma/setup-ninja@master
55+ steps :
56+ - uses : actions/checkout@v5
57+
58+ - name : Build and Install
59+ run : |
60+ cmake --preset=default
61+ cmake --build --preset=default
62+ cmake --install build/default --prefix ${{ runner.temp }}/install
63+
64+ - name : Test find_package
65+ shell : bash
66+ run : |
67+ # Create a minimal test to verify the installation works with find_package
68+ mkdir -p ${{ runner.temp }}/test-find-package
69+ cd ${{ runner.temp }}/test-find-package
70+
71+ # Get project name from CMakeLists.txt
72+ PROJECT_NAME=$(grep -m1 "project(" ${{ github.workspace }}/CMakeLists.txt | sed 's/project(\(.*\))/\1/' | awk '{print $1}')
73+
74+ # Create test CMakeLists.txt
75+ cat > CMakeLists.txt << EOF
76+ cmake_minimum_required(VERSION 3.20)
77+ project(test-find-package CXX)
78+
79+ set(CMAKE_PREFIX_PATH "${{ runner.temp }}/install")
80+ find_package(\${PROJECT_NAME} REQUIRED)
81+
82+ message(STATUS "Successfully found \${PROJECT_NAME}")
83+ EOF
84+
85+ # Test find_package
86+ cmake -B build -S .
87+
88+ - name : Test CPMFindPackage
89+ shell : bash
90+ run : |
91+ # Create test to verify CPMFindPackage works (tries find_package first, then CPM)
92+ mkdir -p ${{ runner.temp }}/test-cpm
93+ cd ${{ runner.temp }}/test-cpm
94+
95+ # Download CPM.cmake
96+ mkdir cmake
97+ curl -L https://github.com/cpm-cmake/CPM.cmake/releases/latest/download/get_cpm.cmake -o cmake/CPM.cmake
98+
99+ # Get project name from CMakeLists.txt
100+ PROJECT_NAME=$(grep -m1 "project(" ${{ github.workspace }}/CMakeLists.txt | sed 's/project(\(.*\))/\1/' | awk '{print $1}')
101+
102+ # Create test CMakeLists.txt that uses CPMFindPackage
103+ cat > CMakeLists.txt << EOF
104+ cmake_minimum_required(VERSION 3.20)
105+ project(test-cpm CXX)
106+
107+ set(CMAKE_PREFIX_PATH "${{ runner.temp }}/install")
108+ set(CPM_SOURCE_CACHE \${CMAKE_SOURCE_DIR}/.cache/cpm CACHE PATH "CPM cache")
109+ include(cmake/CPM.cmake)
110+
111+ # CPMFindPackage tries find_package first, then falls back to CPMAddPackage
112+ CPMFindPackage(
113+ NAME \${PROJECT_NAME}
114+ GITHUB_REPOSITORY ${{ github.repository }}
115+ GIT_TAG ${{ github.sha }}
116+ )
117+
118+ message(STATUS "Successfully acquired \${PROJECT_NAME} via CPMFindPackage")
119+ EOF
120+
121+ # Test CPMFindPackage (should find the installed version first)
122+ cmake -B build -S .
54123
55- - name : Setup Clang
56- uses : egor-tensin/setup-clang@v1
57- with :
58- version : latest
124+ clang-tidy :
125+ runs-on : ubuntu-latest
59126
60- - name : Install clang-tidy
61- run : sudo apt-get update && sudo apt-get install -y clang-tidy
127+ steps :
128+ - uses : actions/checkout@v5
62129
63- - name : Configure CMake with clang-tidy
64- run : cmake --preset=clang-tidy
130+ - name : Configure CMake with clang-tidy
131+ run : cmake --preset=clang-tidy
65132
66- - name : Build with clang-tidy
67- run : cmake --build --preset=clang-tidy
133+ - name : Build with clang-tidy
134+ run : cmake --build --preset=clang-tidy
68135
69- - name : Run tests with clang-tidy
70- run : ctest --preset=clang-tidy
136+ - name : Run tests with clang-tidy
137+ run : ctest --preset=clang-tidy
71138
72139 docs :
73140 runs-on : ubuntu-latest
@@ -76,27 +143,27 @@ jobs:
76143 id-token : write
77144 pages : write
78145 contents : read
79-
146+
80147 steps :
81- - uses : actions/checkout@v5
82-
83- - name : Install Doxygen
84- uses : ssciwr/doxygen-install@v1
85-
86- - name : Configure CMake
87- run : cmake --preset=docs
88-
89- - name : Build Documentation
90- run : cmake --build --preset=docs
91-
92- - name : Setup Pages
93- uses : actions/configure-pages@v5
94-
95- - name : Upload artifact
96- uses : actions/upload-pages-artifact@v3
97- with :
98- path : build/docs/html
99-
100- - name : Deploy to GitHub Pages
101- id : deployment
102- uses : actions/deploy-pages@v4
148+ - uses : actions/checkout@v5
149+
150+ - name : Install Doxygen
151+ uses : ssciwr/doxygen-install@v1
152+
153+ - name : Configure CMake
154+ run : cmake --preset=docs
155+
156+ - name : Build Documentation
157+ run : cmake --build --preset=docs
158+
159+ - name : Setup Pages
160+ uses : actions/configure-pages@v5
161+
162+ - name : Upload artifact
163+ uses : actions/upload-pages-artifact@v4
164+ with :
165+ path : build/docs/html
166+
167+ - name : Deploy to GitHub Pages
168+ id : deployment
169+ uses : actions/deploy-pages@v4
0 commit comments