Skip to content

Commit 7c222c3

Browse files
committed
Integrate CPack
1 parent d1f52d4 commit 7c222c3

2 files changed

Lines changed: 41 additions & 33 deletions

File tree

.github/workflows/test.yml

Lines changed: 28 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,20 @@ jobs:
8282
- name: Build (static, Release)
8383
run: cmake --build build/${{ matrix.preset }} --config Release
8484

85+
- name: Package
86+
working-directory: build/${{ matrix.preset }}
87+
run: cpack -C Release
88+
89+
- name: Upload package
90+
uses: actions/upload-artifact@v6
91+
with:
92+
name: package-${{ matrix.compiler }}-static
93+
path: |
94+
build/${{ matrix.preset }}/Eggs.Assert-*.tar.gz
95+
build/${{ matrix.preset }}/Eggs.Assert-*.zip
96+
if-no-files-found: error
97+
retention-days: 7
98+
8599
# -----------------------------------------------------------------------
86100
# Shared library build
87101
# -----------------------------------------------------------------------
@@ -100,6 +114,20 @@ jobs:
100114
- name: Build (shared, Release)
101115
run: cmake --build build/${{ matrix.preset }}-shared --config Release
102116

117+
- name: Package
118+
working-directory: build/${{ matrix.preset }}
119+
run: cpack -C Release
120+
121+
- name: Upload package
122+
uses: actions/upload-artifact@v6
123+
with:
124+
name: package-${{ matrix.compiler }}-shared
125+
path: |
126+
build/${{ matrix.preset }}/Eggs.Assert-*.tar.gz
127+
build/${{ matrix.preset }}/Eggs.Assert-*.zip
128+
if-no-files-found: error
129+
retention-days: 7
130+
103131
# -----------------------------------------------------------------------
104132
# FetchContent variant — simulates embedding via FetchContent_MakeAvailable
105133
# -----------------------------------------------------------------------
@@ -143,53 +171,21 @@ jobs:
143171
--prefix ${{ runner.temp }}/eggs-assert-install-static-debug
144172
--config Debug
145173

146-
- name: Upload installed package (static, Debug)
147-
uses: actions/upload-artifact@v6
148-
with:
149-
name: installed-package-${{ matrix.compiler }}-static-debug
150-
path: ${{ runner.temp }}/eggs-assert-install-static-debug
151-
if-no-files-found: error
152-
retention-days: 7
153-
154174
- name: Test Install (static, Release)
155175
run: cmake --install build/${{ matrix.preset }}
156176
--prefix ${{ runner.temp }}/eggs-assert-install-static-release
157177
--config Release
158178

159-
- name: Upload installed package (static, Release)
160-
uses: actions/upload-artifact@v6
161-
with:
162-
name: installed-package-${{ matrix.compiler }}-static-release
163-
path: ${{ runner.temp }}/eggs-assert-install-static-release
164-
if-no-files-found: error
165-
retention-days: 7
166-
167179
- name: Test Install (shared, Debug)
168180
run: cmake --install build/${{ matrix.preset }}-shared
169181
--prefix ${{ runner.temp }}/eggs-assert-install-shared-debug
170182
--config Debug
171183

172-
- name: Upload installed package (shared, Debug)
173-
uses: actions/upload-artifact@v6
174-
with:
175-
name: installed-package-${{ matrix.compiler }}-shared-debug
176-
path: ${{ runner.temp }}/eggs-assert-install-shared-debug
177-
if-no-files-found: error
178-
retention-days: 7
179-
180184
- name: Test Install (shared, Release)
181185
run: cmake --install build/${{ matrix.preset }}-shared
182186
--prefix ${{ runner.temp }}/eggs-assert-install-shared-release
183187
--config Release
184188

185-
- name: Upload installed package (shared, Release)
186-
uses: actions/upload-artifact@v6
187-
with:
188-
name: installed-package-${{ matrix.compiler }}-shared-release
189-
path: ${{ runner.temp }}/eggs-assert-install-shared-release
190-
if-no-files-found: error
191-
retention-days: 7
192-
193189
- name: Clean Source and Build Tree
194190
run: cmake -E rm -rf ./include ./src ./build
195191

CMakeLists.txt

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
cmake_minimum_required(VERSION 3.25)
99
project(
1010
Eggs.Assert
11+
VERSION 1.0.0
1112
DESCRIPTION "A C++23 assert library with stacktrace"
1213
LANGUAGES C CXX
1314
)
@@ -146,7 +147,7 @@ if(ENABLE_INSTALL)
146147

147148
write_basic_package_version_file(
148149
${CMAKE_CURRENT_BINARY_DIR}/eggs.assert-config-version.cmake
149-
VERSION 1.0.0
150+
VERSION ${PROJECT_VERSION}
150151
COMPATIBILITY SameMajorVersion
151152
)
152153

@@ -156,4 +157,15 @@ if(ENABLE_INSTALL)
156157
${CMAKE_CURRENT_BINARY_DIR}/eggs.assert-config-version.cmake
157158
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/eggs.assert
158159
)
160+
161+
set(CPACK_PACKAGE_NAME "Eggs.Assert")
162+
set(CPACK_PACKAGE_VENDOR "Agustin K-ballo Berge, Fusion Fenix")
163+
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${PROJECT_DESCRIPTION}")
164+
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.txt")
165+
if(WIN32)
166+
set(CPACK_GENERATOR ZIP)
167+
else()
168+
set(CPACK_GENERATOR TGZ)
169+
endif()
170+
include(CPack)
159171
endif()

0 commit comments

Comments
 (0)