Skip to content

Commit 617720f

Browse files
Michal Stanekstanek-michal
authored andcommitted
ci: add GitHub Actions release workflow (amd64/arm64; gnu, glibc217, musl); strip; tarballs; checksums; CHANGES body
1 parent 2c9e534 commit 617720f

File tree

1 file changed

+327
-0
lines changed

1 file changed

+327
-0
lines changed

.github/workflows/release.yml

Lines changed: 327 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,327 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
workflow_dispatch: {}
8+
9+
permissions:
10+
contents: write
11+
12+
concurrency:
13+
group: release-${{ github.ref }}
14+
cancel-in-progress: true
15+
16+
env:
17+
TAG: ${{ github.ref_name }}
18+
19+
jobs:
20+
build-gnu-amd64:
21+
name: Build linux-amd64-gnu
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v4
26+
with:
27+
submodules: recursive
28+
29+
- name: Build with Docker (Ubuntu GNU)
30+
run: |
31+
make docker
32+
33+
- name: Strip binaries and libs
34+
shell: bash
35+
run: |
36+
set -euo pipefail
37+
# Executables
38+
for f in quark-mon quark-btf quark-test quark-kube-talker; do
39+
if [[ -f "$f" ]]; then strip --strip-unneeded "$f" || true; fi
40+
done
41+
# Static executables (may not exist on all targets)
42+
for f in quark-mon-static quark-btf-static quark-test-static; do
43+
if [[ -f "$f" ]]; then strip --strip-unneeded "$f" || true; fi
44+
done
45+
# Static libraries
46+
for f in libquark.a libquark_big.a; do
47+
if [[ -f "$f" ]]; then strip -g "$f" || true; fi
48+
done
49+
50+
- name: Package artifacts
51+
shell: bash
52+
run: |
53+
set -euo pipefail
54+
PKG="quark-${TAG}-linux-amd64-gnu"
55+
ROOT="dist/${PKG}"
56+
mkdir -p "$ROOT/bin" "$ROOT/bin-static" "$ROOT/lib" "$ROOT/include" "$ROOT/man"
57+
# Binaries
58+
install -m 0755 quark-mon quark-btf quark-test quark-kube-talker "$ROOT/bin/"
59+
# Static binaries (if present)
60+
for f in quark-mon-static quark-btf-static quark-test-static; do
61+
[[ -f "$f" ]] && install -m 0755 "$f" "$ROOT/bin-static/" || true
62+
done
63+
# Libraries
64+
install -m 0644 libquark.a libquark_big.a "$ROOT/lib/"
65+
# Minimal SDK headers
66+
install -m 0644 quark.h "$ROOT/include/"
67+
# Man pages and docs
68+
for f in *.3 *.7 *.8; do
69+
[[ -f "$f" ]] && install -m 0644 "$f" "$ROOT/man/" || true
70+
done
71+
# Notices
72+
install -m 0644 LICENSE.txt NOTICE.txt CHANGES "$ROOT/"
73+
# Tarball + checksum
74+
mkdir -p dist
75+
tar -C "$ROOT" -czf "dist/${PKG}.tar.gz" .
76+
sha256sum "dist/${PKG}.tar.gz" > "dist/${PKG}.tar.gz.sha256"
77+
rm -rf "$ROOT"
78+
79+
- name: Upload artifact
80+
uses: actions/upload-artifact@v4
81+
with:
82+
name: quark-${{ env.TAG }}-linux-amd64-gnu
83+
path: |
84+
dist/quark-${{ env.TAG }}-linux-amd64-gnu.tar.gz
85+
dist/quark-${{ env.TAG }}-linux-amd64-gnu.tar.gz.sha256
86+
87+
build-gnu-amd64-glibc217:
88+
name: Build linux-amd64-gnu-glibc217 (CentOS 7)
89+
runs-on: ubuntu-latest
90+
steps:
91+
- name: Checkout
92+
uses: actions/checkout@v4
93+
with:
94+
submodules: recursive
95+
96+
- name: Build with Docker (CentOS 7)
97+
run: |
98+
make centos7
99+
100+
- name: Strip binaries and libs
101+
shell: bash
102+
run: |
103+
set -euo pipefail
104+
# Executables
105+
for f in quark-mon quark-btf quark-test quark-kube-talker; do
106+
if [[ -f "$f" ]]; then strip --strip-unneeded "$f" || true; fi
107+
done
108+
# Static executables (unlikely on this target, but try)
109+
for f in quark-mon-static quark-btf-static quark-test-static; do
110+
if [[ -f "$f" ]]; then strip --strip-unneeded "$f" || true; fi
111+
done
112+
# Static libraries
113+
for f in libquark.a libquark_big.a; do
114+
if [[ -f "$f" ]]; then strip -g "$f" || true; fi
115+
done
116+
117+
- name: Package artifacts
118+
shell: bash
119+
run: |
120+
set -euo pipefail
121+
PKG="quark-${TAG}-linux-amd64-gnu-glibc217"
122+
ROOT="dist/${PKG}"
123+
mkdir -p "$ROOT/bin" "$ROOT/bin-static" "$ROOT/lib" "$ROOT/include" "$ROOT/man"
124+
# Binaries
125+
install -m 0755 quark-mon quark-btf quark-test quark-kube-talker "$ROOT/bin/"
126+
# Static binaries (if present)
127+
for f in quark-mon-static quark-btf-static quark-test-static; do
128+
[[ -f "$f" ]] && install -m 0755 "$f" "$ROOT/bin-static/" || true
129+
done
130+
# Libraries
131+
install -m 0644 libquark.a libquark_big.a "$ROOT/lib/"
132+
# Minimal SDK headers
133+
install -m 0644 quark.h "$ROOT/include/"
134+
# Man pages and docs
135+
for f in *.3 *.7 *.8; do
136+
[[ -f "$f" ]] && install -m 0644 "$f" "$ROOT/man/" || true
137+
done
138+
# Notices
139+
install -m 0644 LICENSE.txt NOTICE.txt CHANGES "$ROOT/"
140+
# Tarball + checksum
141+
mkdir -p dist
142+
tar -C "$ROOT" -czf "dist/${PKG}.tar.gz" .
143+
sha256sum "dist/${PKG}.tar.gz" > "dist/${PKG}.tar.gz.sha256"
144+
rm -rf "$ROOT"
145+
146+
- name: Upload artifact
147+
uses: actions/upload-artifact@v4
148+
with:
149+
name: quark-${{ env.TAG }}-linux-amd64-gnu-glibc217
150+
path: |
151+
dist/quark-${{ env.TAG }}-linux-amd64-gnu-glibc217.tar.gz
152+
dist/quark-${{ env.TAG }}-linux-amd64-gnu-glibc217.tar.gz.sha256
153+
154+
build-gnu-arm64:
155+
name: Build linux-arm64-gnu
156+
runs-on: ubuntu-latest
157+
steps:
158+
- name: Checkout
159+
uses: actions/checkout@v4
160+
with:
161+
submodules: recursive
162+
163+
- name: Build with Docker (ARM64 cross-compile)
164+
run: |
165+
make docker-cross-arm64
166+
167+
- name: Strip binaries and libs (in Docker for aarch64)
168+
shell: bash
169+
run: |
170+
set -euo pipefail
171+
# Use builder image to run the appropriate aarch64 strip
172+
docker run -q \
173+
-v "$PWD":"$PWD" \
174+
-w "$PWD" \
175+
-u "$(id -u):$(id -g)" \
176+
quark-builder \
177+
bash -lc '
178+
set -e
179+
for f in quark-mon quark-btf quark-test quark-kube-talker; do
180+
[[ -f "$f" ]] && aarch64-linux-gnu-strip --strip-unneeded "$f" || true;
181+
done
182+
for f in quark-mon-static quark-btf-static quark-test-static; do
183+
[[ -f "$f" ]] && aarch64-linux-gnu-strip --strip-unneeded "$f" || true;
184+
done
185+
for f in libquark.a libquark_big.a; do
186+
[[ -f "$f" ]] && aarch64-linux-gnu-strip -g "$f" || true;
187+
done'
188+
189+
- name: Package artifacts
190+
shell: bash
191+
run: |
192+
set -euo pipefail
193+
PKG="quark-${TAG}-linux-arm64-gnu"
194+
ROOT="dist/${PKG}"
195+
mkdir -p "$ROOT/bin" "$ROOT/bin-static" "$ROOT/lib" "$ROOT/include" "$ROOT/man"
196+
# Binaries
197+
install -m 0755 quark-mon quark-btf quark-test quark-kube-talker "$ROOT/bin/"
198+
# Static binaries (if present)
199+
for f in quark-mon-static quark-btf-static quark-test-static; do
200+
[[ -f "$f" ]] && install -m 0755 "$f" "$ROOT/bin-static/" || true
201+
done
202+
# Libraries
203+
install -m 0644 libquark.a libquark_big.a "$ROOT/lib/"
204+
# Minimal SDK headers
205+
install -m 0644 quark.h "$ROOT/include/"
206+
# Man pages and docs
207+
for f in *.3 *.7 *.8; do
208+
[[ -f "$f" ]] && install -m 0644 "$f" "$ROOT/man/" || true
209+
done
210+
# Notices
211+
install -m 0644 LICENSE.txt NOTICE.txt CHANGES "$ROOT/"
212+
# Tarball + checksum
213+
mkdir -p dist
214+
tar -C "$ROOT" -czf "dist/${PKG}.tar.gz" .
215+
sha256sum "dist/${PKG}.tar.gz" > "dist/${PKG}.tar.gz.sha256"
216+
rm -rf "$ROOT"
217+
218+
- name: Upload artifact
219+
uses: actions/upload-artifact@v4
220+
with:
221+
name: quark-${{ env.TAG }}-linux-arm64-gnu
222+
path: |
223+
dist/quark-${{ env.TAG }}-linux-arm64-gnu.tar.gz
224+
dist/quark-${{ env.TAG }}-linux-arm64-gnu.tar.gz.sha256
225+
226+
build-musl-amd64:
227+
name: Build linux-amd64-musl
228+
runs-on: ubuntu-latest
229+
steps:
230+
- name: Checkout
231+
uses: actions/checkout@v4
232+
with:
233+
submodules: recursive
234+
235+
- name: Build with Docker (Alpine musl)
236+
run: |
237+
make alpine
238+
239+
- name: Strip binaries and libs
240+
shell: bash
241+
run: |
242+
set -euo pipefail
243+
# Executables
244+
for f in quark-mon quark-btf quark-test quark-kube-talker; do
245+
if [[ -f "$f" ]]; then strip --strip-unneeded "$f" || true; fi
246+
done
247+
# Static executables (musl static expected here)
248+
for f in quark-mon-static quark-btf-static quark-test-static; do
249+
if [[ -f "$f" ]]; then strip --strip-unneeded "$f" || true; fi
250+
done
251+
# Static libraries
252+
for f in libquark.a libquark_big.a; do
253+
if [[ -f "$f" ]]; then strip -g "$f" || true; fi
254+
done
255+
256+
- name: Package artifacts
257+
shell: bash
258+
run: |
259+
set -euo pipefail
260+
PKG="quark-${TAG}-linux-amd64-musl"
261+
ROOT="dist/${PKG}"
262+
mkdir -p "$ROOT/bin" "$ROOT/bin-static" "$ROOT/lib" "$ROOT/include" "$ROOT/man"
263+
# Binaries
264+
install -m 0755 quark-mon quark-btf quark-test quark-kube-talker "$ROOT/bin/"
265+
# Static binaries (if present)
266+
for f in quark-mon-static quark-btf-static quark-test-static; do
267+
[[ -f "$f" ]] && install -m 0755 "$f" "$ROOT/bin-static/" || true
268+
done
269+
# Libraries
270+
install -m 0644 libquark.a libquark_big.a "$ROOT/lib/"
271+
# Minimal SDK headers
272+
install -m 0644 quark.h "$ROOT/include/"
273+
# Man pages and docs
274+
for f in *.3 *.7 *.8; do
275+
[[ -f "$f" ]] && install -m 0644 "$f" "$ROOT/man/" || true
276+
done
277+
# Notices
278+
install -m 0644 LICENSE.txt NOTICE.txt CHANGES "$ROOT/"
279+
# Tarball + checksum
280+
mkdir -p dist
281+
tar -C "$ROOT" -czf "dist/${PKG}.tar.gz" .
282+
sha256sum "dist/${PKG}.tar.gz" > "dist/${PKG}.tar.gz.sha256"
283+
rm -rf "$ROOT"
284+
285+
- name: Upload artifact
286+
uses: actions/upload-artifact@v4
287+
with:
288+
name: quark-${{ env.TAG }}-linux-amd64-musl
289+
path: |
290+
dist/quark-${{ env.TAG }}-linux-amd64-musl.tar.gz
291+
dist/quark-${{ env.TAG }}-linux-amd64-musl.tar.gz.sha256
292+
293+
publish:
294+
name: Publish GitHub Release
295+
runs-on: ubuntu-latest
296+
needs:
297+
- build-gnu-amd64
298+
- build-gnu-amd64-glibc217
299+
- build-gnu-arm64
300+
- build-musl-amd64
301+
steps:
302+
- name: Checkout
303+
uses: actions/checkout@v4
304+
305+
- name: Download all build artifacts
306+
uses: actions/download-artifact@v4
307+
with:
308+
path: dist
309+
merge-multiple: true
310+
311+
- name: Generate combined SHA256SUMS
312+
shell: bash
313+
run: |
314+
set -euo pipefail
315+
cd dist
316+
sha256sum *.tar.gz > SHA256SUMS
317+
318+
- name: Create GitHub Release
319+
uses: softprops/action-gh-release@v1
320+
with:
321+
tag_name: ${{ env.TAG }}
322+
body_path: CHANGES
323+
files: |
324+
dist/*.tar.gz
325+
dist/*.tar.gz.sha256
326+
dist/SHA256SUMS
327+

0 commit comments

Comments
 (0)