Skip to content

Commit 058606a

Browse files
Michal Stanekstanek-michal
authored andcommitted
build: add install and dist targets; ci: use make dist, draft releases, rename to glibc/glibc217, add version check and prepare-release workflow
1 parent 617720f commit 058606a

File tree

3 files changed

+176
-171
lines changed

3 files changed

+176
-171
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Prepare Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: "Release version (e.g., 0.6)"
8+
required: true
9+
10+
permissions:
11+
contents: write
12+
pull-requests: write
13+
14+
jobs:
15+
bump-version:
16+
name: Bump QUARK_VERSION and open PR
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v4
21+
with:
22+
submodules: false
23+
24+
- name: Create bump branch
25+
id: prep
26+
shell: bash
27+
run: |
28+
set -euo pipefail
29+
VERSION="${{ inputs.version }}"
30+
BRANCH="release/bump-v${VERSION}"
31+
echo "branch=$BRANCH" >> "$GITHUB_OUTPUT"
32+
git checkout -b "$BRANCH"
33+
# Update QUARK_VERSION to exact VERSION (no trailing 'a')
34+
perl -0777 -pe "s/(#define\s+QUARK_VERSION\s+")([^"]+)(")/\1${VERSION}\3/" -i quark.h
35+
echo "Updated quark.h to QUARK_VERSION=${VERSION}"
36+
git add quark.h
37+
git commit -m "release: bump QUARK_VERSION to ${VERSION}"
38+
39+
- name: Create Pull Request
40+
uses: peter-evans/create-pull-request@v6
41+
with:
42+
branch: ${{ steps.prep.outputs.branch }}
43+
title: "release: bump QUARK_VERSION to ${{ inputs.version }}"
44+
body: |
45+
This PR bumps QUARK_VERSION to `${{ inputs.version }}` in quark.h.
46+
47+
After merging, push the release tag `v${{ inputs.version }}` to trigger the release workflow.
48+
commit-message: "release: bump QUARK_VERSION to ${{ inputs.version }}"
49+
base: ${{ github.ref_name }}
50+
labels: release
51+

.github/workflows/release.yml

Lines changed: 61 additions & 171 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ env:
1717
TAG: ${{ github.ref_name }}
1818

1919
jobs:
20-
build-gnu-amd64:
21-
name: Build linux-amd64-gnu
20+
build-glibc-amd64:
21+
name: Build linux-amd64-glibc
2222
runs-on: ubuntu-latest
2323
steps:
2424
- name: Checkout
@@ -30,47 +30,14 @@ jobs:
3030
run: |
3131
make docker
3232
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-
5033
- name: Package artifacts
5134
shell: bash
5235
run: |
5336
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
37+
PKG="quark-${TAG}-linux-amd64-glibc"
38+
ROOT="stage/${PKG}"
39+
mkdir -p "${ROOT}"
40+
make dist DESTDIR="${ROOT}"
7441
mkdir -p dist
7542
tar -C "$ROOT" -czf "dist/${PKG}.tar.gz" .
7643
sha256sum "dist/${PKG}.tar.gz" > "dist/${PKG}.tar.gz.sha256"
@@ -79,13 +46,13 @@ jobs:
7946
- name: Upload artifact
8047
uses: actions/upload-artifact@v4
8148
with:
82-
name: quark-${{ env.TAG }}-linux-amd64-gnu
49+
name: quark-${{ env.TAG }}-linux-amd64-glibc
8350
path: |
84-
dist/quark-${{ env.TAG }}-linux-amd64-gnu.tar.gz
85-
dist/quark-${{ env.TAG }}-linux-amd64-gnu.tar.gz.sha256
51+
dist/quark-${{ env.TAG }}-linux-amd64-glibc.tar.gz
52+
dist/quark-${{ env.TAG }}-linux-amd64-glibc.tar.gz.sha256
8653
87-
build-gnu-amd64-glibc217:
88-
name: Build linux-amd64-gnu-glibc217 (CentOS 7)
54+
build-glibc217-amd64:
55+
name: Build linux-amd64-glibc217 (CentOS 7)
8956
runs-on: ubuntu-latest
9057
steps:
9158
- name: Checkout
@@ -97,47 +64,14 @@ jobs:
9764
run: |
9865
make centos7
9966
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-
11767
- name: Package artifacts
11868
shell: bash
11969
run: |
12070
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
71+
PKG="quark-${TAG}-linux-amd64-glibc217"
72+
ROOT="stage/${PKG}"
73+
mkdir -p "${ROOT}"
74+
make dist DESTDIR="${ROOT}"
14175
mkdir -p dist
14276
tar -C "$ROOT" -czf "dist/${PKG}.tar.gz" .
14377
sha256sum "dist/${PKG}.tar.gz" > "dist/${PKG}.tar.gz.sha256"
@@ -146,13 +80,13 @@ jobs:
14680
- name: Upload artifact
14781
uses: actions/upload-artifact@v4
14882
with:
149-
name: quark-${{ env.TAG }}-linux-amd64-gnu-glibc217
83+
name: quark-${{ env.TAG }}-linux-amd64-glibc217
15084
path: |
151-
dist/quark-${{ env.TAG }}-linux-amd64-gnu-glibc217.tar.gz
152-
dist/quark-${{ env.TAG }}-linux-amd64-gnu-glibc217.tar.gz.sha256
85+
dist/quark-${{ env.TAG }}-linux-amd64-glibc217.tar.gz
86+
dist/quark-${{ env.TAG }}-linux-amd64-glibc217.tar.gz.sha256
15387
154-
build-gnu-arm64:
155-
name: Build linux-arm64-gnu
88+
build-glibc-arm64:
89+
name: Build linux-arm64-glibc
15690
runs-on: ubuntu-latest
15791
steps:
15892
- name: Checkout
@@ -164,52 +98,14 @@ jobs:
16498
run: |
16599
make docker-cross-arm64
166100
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-
189101
- name: Package artifacts
190102
shell: bash
191103
run: |
192104
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
105+
PKG="quark-${TAG}-linux-arm64-glibc"
106+
ROOT="stage/${PKG}"
107+
mkdir -p "${ROOT}"
108+
make dist DESTDIR="${ROOT}"
213109
mkdir -p dist
214110
tar -C "$ROOT" -czf "dist/${PKG}.tar.gz" .
215111
sha256sum "dist/${PKG}.tar.gz" > "dist/${PKG}.tar.gz.sha256"
@@ -218,10 +114,10 @@ jobs:
218114
- name: Upload artifact
219115
uses: actions/upload-artifact@v4
220116
with:
221-
name: quark-${{ env.TAG }}-linux-arm64-gnu
117+
name: quark-${{ env.TAG }}-linux-arm64-glibc
222118
path: |
223-
dist/quark-${{ env.TAG }}-linux-arm64-gnu.tar.gz
224-
dist/quark-${{ env.TAG }}-linux-arm64-gnu.tar.gz.sha256
119+
dist/quark-${{ env.TAG }}-linux-arm64-glibc.tar.gz
120+
dist/quark-${{ env.TAG }}-linux-arm64-glibc.tar.gz.sha256
225121
226122
build-musl-amd64:
227123
name: Build linux-amd64-musl
@@ -236,47 +132,14 @@ jobs:
236132
run: |
237133
make alpine
238134
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-
256135
- name: Package artifacts
257136
shell: bash
258137
run: |
259138
set -euo pipefail
260139
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
140+
ROOT="stage/${PKG}"
141+
mkdir -p "${ROOT}"
142+
make dist DESTDIR="${ROOT}"
280143
mkdir -p dist
281144
tar -C "$ROOT" -czf "dist/${PKG}.tar.gz" .
282145
sha256sum "dist/${PKG}.tar.gz" > "dist/${PKG}.tar.gz.sha256"
@@ -294,14 +157,40 @@ jobs:
294157
name: Publish GitHub Release
295158
runs-on: ubuntu-latest
296159
needs:
297-
- build-gnu-amd64
298-
- build-gnu-amd64-glibc217
299-
- build-gnu-arm64
160+
- build-glibc-amd64
161+
- build-glibc217-amd64
162+
- build-glibc-arm64
300163
- build-musl-amd64
301164
steps:
302165
- name: Checkout
303166
uses: actions/checkout@v4
304167

168+
- name: Verify QUARK_VERSION vs tag
169+
shell: bash
170+
run: |
171+
set -euo pipefail
172+
TAG="${TAG}"
173+
VER_TAG="${TAG#v}"
174+
BASE_VER=$(echo "$VER_TAG" | sed -E 's/-rc[0-9]+$//')
175+
HDR_VER=$(grep -E '^[[:space:]]*#define[[:space:]]+QUARK_VERSION' quark.h | sed -E 's/.*"([^"]+)".*/\1/')
176+
if [[ "$VER_TAG" == *-rc* ]]; then
177+
# For -rc tags, expect header to be BASE_VER with trailing 'a'
178+
if [[ "$HDR_VER" != "${BASE_VER}a" ]]; then
179+
echo "QUARK_VERSION ($HDR_VER) must be ${BASE_VER}a for RC tags ($TAG)" >&2
180+
exit 1
181+
fi
182+
else
183+
# For final releases, expect exact match and no trailing 'a'
184+
if [[ "$HDR_VER" != "$BASE_VER" ]]; then
185+
echo "QUARK_VERSION ($HDR_VER) must equal $BASE_VER for tag $TAG" >&2
186+
exit 1
187+
fi
188+
if [[ "$HDR_VER" == *a ]]; then
189+
echo "QUARK_VERSION ($HDR_VER) must not end with 'a' for final release" >&2
190+
exit 1
191+
fi
192+
fi
193+
305194
- name: Download all build artifacts
306195
uses: actions/download-artifact@v4
307196
with:
@@ -320,8 +209,9 @@ jobs:
320209
with:
321210
tag_name: ${{ env.TAG }}
322211
body_path: CHANGES
212+
draft: true
213+
prerelease: ${{ contains(env.TAG, '-rc') }}
323214
files: |
324215
dist/*.tar.gz
325216
dist/*.tar.gz.sha256
326217
dist/SHA256SUMS
327-

0 commit comments

Comments
 (0)