Skip to content

Commit 7d5df79

Browse files
committed
Integrate CPack
1 parent ca7c00d commit 7d5df79

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 }}-static --config Release
8484

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

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

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

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

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

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

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)