Skip to content

Commit cf1af4d

Browse files
authored
ci : update + packages (#146)
* Add simple Debian package * Update CI configuration * Add cpack Deb package for libggwave-dev * Add `make deb` top level target and CI job * Ensure `make deb` packages are deterministic Update CMakeLists.txt to make cpack generated Debian packages deterministic build outputs by: - Setting SOURCE_DATE_EPOCH to 0 - Executing `git log -1 --pretty=%ct` and storing the result in SOURCE_DATE_EPOCH, overriding 0 - Export SOURCE_DATE_EPOCH to the environment - Explicitly prefix the execution of the cpack command in the custom target `deb_c_library` with SOURCE_DATE_EPOCH Update `README.md-tmpl.md` and `README.md` to document new `make deb` target. The Makefile for the Python bindings already handle deterministic building with the same strategy. * libc6, not libc
1 parent 2bf3d67 commit cf1af4d

File tree

12 files changed

+353
-52
lines changed

12 files changed

+353
-52
lines changed

.github/workflows/build.yml

Lines changed: 141 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,91 @@ name: CI
22
on: [push]
33

44
jobs:
5-
ubuntu-18_04-gcc:
6-
runs-on: ubuntu-18.04
5+
6+
ubuntu-24_04-python3-ggwave-deb:
7+
runs-on: ubuntu-24.04
8+
9+
steps:
10+
- name: Clone
11+
uses: actions/checkout@v1
12+
with:
13+
submodules: recursive
14+
15+
- name: Dependencies
16+
run: |
17+
sudo apt update
18+
sudo apt install cython3 build-essential debhelper-compat
19+
sudo apt install dh-python python3-all-dev python3-build
20+
sudo apt install python3-cogapp python3-venv
21+
22+
- name: Build Debian package for Python bindings
23+
run: |
24+
cd bindings/python
25+
make deb
26+
27+
ubuntu-24_04-libggwave-dev-deb:
28+
runs-on: ubuntu-24.04
29+
strategy:
30+
matrix:
31+
build: [Release]
32+
33+
steps:
34+
- name: Clone
35+
uses: actions/checkout@v1
36+
with:
37+
submodules: recursive
38+
39+
- name: Dependencies
40+
run: |
41+
sudo apt update
42+
sudo apt install build-essential
43+
44+
- name: Build Debian package for libggwave
45+
run: |
46+
cmake . -DGGWAVE_BUILD_EXAMPLES=OFF -DCMAKE_BUILD_TYPE=${{ matrix.build }}
47+
make
48+
cpack
49+
50+
- name: Inspect generated Debian package
51+
run: |
52+
dpkg --contents dist/libggwave-dev_*.deb
53+
dpkg -I dist/libggwave-dev_*.deb
54+
sha256sum dist/libggwave-dev_*.deb
55+
56+
ubuntu-24_04-target-deb:
57+
runs-on: ubuntu-24.04
58+
strategy:
59+
matrix:
60+
build: [Release]
61+
62+
steps:
63+
- name: Clone
64+
uses: actions/checkout@v1
65+
with:
66+
submodules: recursive
67+
68+
- name: Dependencies
69+
run: |
70+
sudo apt update
71+
sudo apt install cython3 build-essential debhelper-compat
72+
sudo apt install dh-python python3-all-dev python3-build
73+
sudo apt install python3-cogapp python3-venv
74+
75+
- name: Build Debian packages
76+
run: |
77+
cmake . -DGGWAVE_BUILD_EXAMPLES=OFF -DCMAKE_BUILD_TYPE=${{ matrix.build }}
78+
make deb
79+
80+
- name: Inspect generated Debian packages
81+
run: |
82+
dpkg --contents dist/libggwave*.deb
83+
dpkg -I dist/libggwave*.deb
84+
dpkg --contents dist/python3*.deb
85+
dpkg -I dist/python3*.deb
86+
sha256sum dist/*.deb
87+
88+
ubuntu-24_04-gcc:
89+
runs-on: ubuntu-24.04
790

891
strategy:
992
matrix:
@@ -17,10 +100,10 @@ jobs:
17100

18101
- name: Dependencies
19102
run: |
20-
sudo apt-get update
21-
sudo apt-get install build-essential xorg-dev libglu1-mesa-dev
22-
sudo apt-get install cmake;
23-
sudo apt-get install libsdl2-dev;
103+
sudo apt update
104+
sudo apt install build-essential xorg-dev libglu1-mesa-dev
105+
sudo apt install cmake
106+
sudo apt install libsdl2-dev
24107
25108
- name: Configure
26109
run: cmake . -DCMAKE_BUILD_TYPE=${{ matrix.build }}
@@ -31,12 +114,14 @@ jobs:
31114
ctest --output-on-failure
32115
./bin/test-ggwave-cpp --full
33116
34-
ubuntu-18_04-python:
35-
runs-on: ubuntu-18.04
117+
ubuntu-24_04-python:
118+
runs-on: ubuntu-24.04
36119

37120
strategy:
121+
fail-fast: false
38122
matrix:
39-
python-version: [3.5, 3.6, 3.7, 3.8]
123+
build: [Release]
124+
python-version: [3.8.18, 3.9.20, 3.11.11, 3.12.9]
40125

41126
steps:
42127
- name: Clone
@@ -51,20 +136,23 @@ jobs:
51136

52137
- name: Dependencies
53138
run: |
54-
sudo apt-get update
55-
sudo apt-get install build-essential
56-
sudo apt-get install cmake;
139+
sudo apt update
140+
sudo apt install build-essential
141+
sudo apt install cmake
142+
python3 -m venv venv
143+
source venv/bin/activate && pip install setuptools cython cogapp
57144
58145
- name: Configure
59146
run: cmake . -DGGWAVE_SUPPORT_PYTHON=ON -DGGWAVE_BUILD_EXAMPLES=OFF -DCMAKE_BUILD_TYPE=${{ matrix.build }}
60147

61148
- name: Build
62149
run: |
150+
source venv/bin/activate
63151
make
64152
ctest --output-on-failure
65153
66-
ubuntu-18_04-gcc-sanitized:
67-
runs-on: ubuntu-18.04
154+
ubuntu-24_04-gcc-sanitized:
155+
runs-on: ubuntu-24.04
68156

69157
strategy:
70158
matrix:
@@ -78,9 +166,9 @@ jobs:
78166

79167
- name: Dependencies
80168
run: |
81-
sudo apt-get update
82-
sudo apt-get install build-essential
83-
sudo apt-get install cmake;
169+
sudo apt update
170+
sudo apt install build-essential
171+
sudo apt install cmake
84172
85173
- name: Configure
86174
run: cmake . -DCMAKE_BUILD_TYPE=Debug -DGGWAVE_BUILD_EXAMPLES=OFF -DGGWAVE_SANITIZE_${{ matrix.sanitizer }}=ON
@@ -90,8 +178,8 @@ jobs:
90178
make
91179
ctest --output-on-failure
92180
93-
ubuntu-18_04-clang:
94-
runs-on: ubuntu-18.04
181+
ubuntu-24_04-clang:
182+
runs-on: ubuntu-24.04
95183

96184
strategy:
97185
matrix:
@@ -105,10 +193,10 @@ jobs:
105193

106194
- name: Dependencies
107195
run: |
108-
sudo apt-get update
109-
sudo apt-get install build-essential xorg-dev libglu1-mesa-dev
110-
sudo apt-get install cmake;
111-
sudo apt-get install libsdl2-dev;
196+
sudo apt update
197+
sudo apt install build-essential xorg-dev libglu1-mesa-dev
198+
sudo apt install cmake
199+
sudo apt install libsdl2-dev
112200
113201
- name: Configure
114202
run: cmake . -DCMAKE_BUILD_TYPE=${{ matrix.build }} -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang
@@ -145,7 +233,7 @@ jobs:
145233
ctest --output-on-failure
146234
147235
emscripten:
148-
runs-on: ubuntu-18.04
236+
runs-on: ubuntu-24.04
149237

150238
strategy:
151239
matrix:
@@ -176,28 +264,32 @@ jobs:
176264
emcmake cmake . -DCMAKE_BUILD_TYPE=${{ matrix.build }}
177265
make && ctest --output-on-failure
178266
179-
# windows-msys2:
180-
# runs-on: windows-latest
181-
# defaults:
182-
# run:
183-
# shell: msys2 {0}
184-
# steps:
185-
# - name: Clone
186-
# uses: actions/checkout@v1
187-
# with:
188-
# submodules: recursive
189-
#
190-
# - name: Dependencies
191-
# uses: msys2/setup-msys2@v2
192-
# with:
193-
# msystem: MINGW64
194-
# update: true
195-
# install: cmake make mingw-w64-x86_64-dlfcn mingw-w64-x86_64-gcc mingw-w64-x86_64-SDL2
196-
#
197-
# - name: Configure
198-
# run: cmake . -DCMAKE_BUILD_TYPE=${{ matrix.build }}
199-
#
200-
# - name: Build
201-
# run: |
202-
# make
203-
# ctest --output-on-failure
267+
windows-msys2:
268+
runs-on: windows-latest
269+
defaults:
270+
run:
271+
shell: msys2 {0}
272+
strategy:
273+
matrix:
274+
build: [Release]
275+
steps:
276+
- name: Clone
277+
uses: actions/checkout@v1
278+
with:
279+
submodules: recursive
280+
281+
- name: Dependencies
282+
uses: msys2/setup-msys2@v2
283+
with:
284+
msystem: MINGW64
285+
update: true
286+
install: make mingw-w64-x86_64-cmake mingw-w64-x86_64-dlfcn mingw-w64-x86_64-gcc mingw-w64-x86_64-SDL2 mingw-w64-x86_64-cmake
287+
288+
- name: Configure
289+
run: cmake . -DCMAKE_BUILD_TYPE=${{ matrix.build }} -G "Unix Makefiles"
290+
291+
- name: Build
292+
run: |
293+
ls -alh .
294+
make
295+
ctest --output-on-failure

CMakeLists.txt

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,3 +98,74 @@ endif()
9898
if (GGWAVE_BUILD_EXAMPLES)
9999
add_subdirectory(examples)
100100
endif()
101+
102+
103+
104+
set(CPACK_COMPONENTS_GROUPING ALL_COMPONENTS_IN_ONE)
105+
set(CPACK_DEB_COMPONENT_INSTALL YES)
106+
set(CPACK_DEBIAN_FILE_NAME DEB-DEFAULT)
107+
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6")
108+
set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "https://github.com/ggerganov/ggwave")
109+
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Georgi Gerganov")
110+
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS YES)
111+
set(CPACK_GENERATOR DEB)
112+
SET(CPACK_OUTPUT_FILE_PREFIX "${CMAKE_SOURCE_DIR}/dist")
113+
set(CPACK_PACKAGE_CONTACT "ggerganov@gmail.com")
114+
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Tiny data-over-sound library")
115+
set(CPACK_PACKAGE_INSTALL_DIRECTORY ${CPACK_PACKAGE_NAME})
116+
set(CPACK_PACKAGE_NAME "libggwave-dev")
117+
set(CPACK_PACKAGE_VENDOR "ggwave")
118+
set(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
119+
set(CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR})
120+
set(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH})
121+
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
122+
set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
123+
set(CPACK_STRIP_FILES YES)
124+
set(CPACK_VERBATIM_VARIABLES YES)
125+
include(CPack)
126+
127+
set(DEB_PYTHON_BUILD_DIR "${CMAKE_SOURCE_DIR}/bindings/python/")
128+
set(DEB_PYTHON_OUTPUT_FILE_PREFIX "${DEB_PYTHON_BUILD_DIR}/dist")
129+
130+
set(ENV{SOURCE_DATE_EPOCH} "0")
131+
execute_process(
132+
COMMAND git log -1 --pretty=%ct
133+
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
134+
TIMEOUT 1
135+
OUTPUT_VARIABLE SOURCE_DATE_EPOCH
136+
OUTPUT_STRIP_TRAILING_WHITESPACE
137+
)
138+
set(ENV{SOURCE_DATE_EPOCH} ${SOURCE_DATE_EPOCH})
139+
140+
add_custom_target(deb_python_binding
141+
COMMAND cd ${DEB_PYTHON_BUILD_DIR} && make deb
142+
COMMENT "Building Debian package for Python binding"
143+
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
144+
)
145+
146+
add_custom_target(deb_c_library
147+
COMMAND SOURCE_DATE_EPOCH=${SOURCE_DATE_EPOCH} cpack
148+
COMMENT "Building Debian package for C library"
149+
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
150+
)
151+
152+
add_custom_target(deb_python_move
153+
COMMAND mv ${DEB_PYTHON_OUTPUT_FILE_PREFIX}/*.deb ${CPACK_OUTPUT_FILE_PREFIX}/
154+
COMMENT "Moving Debian package for Python binding into ${CPACK_OUTPUT_FILE_PREFIX}/"
155+
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
156+
DEPENDS deb_python_binding deb_c_library
157+
)
158+
159+
add_custom_target(deb
160+
COMMAND sha256sum ${CPACK_OUTPUT_FILE_PREFIX}/*
161+
COMMENT "Debian package sha256 hashes"
162+
DEPENDS deb_c_library deb_python_binding deb_python_move
163+
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
164+
)
165+
166+
add_custom_command(TARGET deb
167+
POST_BUILD
168+
COMMAND ls -alh ${CPACK_OUTPUT_FILE_PREFIX}/*
169+
COMMENT "SOURCE_DATE_EPOCH=${SOURCE_DATE_EPOCH}"
170+
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
171+
)

README-tmpl.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,24 @@ make
157157
./bin/ggwave-cli
158158
```
159159

160+
#### Local Debian packages
161+
162+
Build reproducible `libggwave-dev` and `python3-ggwave` Debian packages:
163+
```bash
164+
# Fetch source
165+
git clone https://github.com/ggerganov/ggwave --recursive
166+
cd ggwave
167+
168+
# Configure
169+
cmake . -DGGWAVE_BUILD_EXAMPLES=OFF -DCMAKE_BUILD_TYPE=Release
170+
171+
# Build
172+
make deb
173+
174+
# Install
175+
sudo dpkg -i dist/*.deb
176+
```
177+
160178
### Emscripten
161179

162180
```bash

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,24 @@ make
159159
./bin/ggwave-cli
160160
```
161161

162+
#### Local Debian packages
163+
164+
Build reproducible `libggwave-dev` and `python3-ggwave` Debian packages:
165+
```bash
166+
# Fetch source
167+
git clone https://github.com/ggerganov/ggwave --recursive
168+
cd ggwave
169+
170+
# Configure
171+
cmake . -DGGWAVE_BUILD_EXAMPLES=OFF -DCMAKE_BUILD_TYPE=Release
172+
173+
# Build
174+
make deb
175+
176+
# Install
177+
sudo dpkg -i dist/*.deb
178+
```
179+
162180
### Emscripten
163181

164182
```bash

0 commit comments

Comments
 (0)