Skip to content

Commit ec5eb8c

Browse files
committed
ci: multi-arch release builds (amd64 + arm64)
- Build libvmod_wasm.so for both linux/amd64 and linux/arm64 - Use QEMU + Docker Buildx for cross-compilation - .wasm modules attached once (architecture-independent) - Release assets: libvmod_wasm-<ver>-varnish9-linux-{amd64,arm64}.so + *.wasm
1 parent 4c9c34a commit ec5eb8c

1 file changed

Lines changed: 62 additions & 22 deletions

File tree

.github/workflows/release.yml

Lines changed: 62 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,64 @@ permissions:
99
contents: write
1010

1111
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
strategy:
15+
matrix:
16+
arch: [amd64, arm64]
17+
18+
steps:
19+
- uses: actions/checkout@v4
20+
21+
- name: Set up QEMU
22+
if: matrix.arch == 'arm64'
23+
uses: docker/setup-qemu-action@v3
24+
with:
25+
platforms: arm64
26+
27+
- name: Set up Docker Buildx
28+
uses: docker/setup-buildx-action@v3
29+
30+
- name: Build release image
31+
run: |
32+
docker buildx build \
33+
--platform linux/${{ matrix.arch }} \
34+
--load \
35+
-t vmod-wasm-release-${{ matrix.arch }} .
36+
37+
- name: Extract version from tag
38+
id: version
39+
run: echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"
40+
41+
- name: Extract artifacts
42+
run: |
43+
mkdir -p dist
44+
# Extract compiled VMOD (.so)
45+
docker run --rm --platform linux/${{ matrix.arch }} \
46+
vmod-wasm-release-${{ matrix.arch }} sh -c \
47+
'cat /src/.libs/libvmod_wasm.so' \
48+
> "dist/libvmod_wasm-${{ steps.version.outputs.version }}-varnish9-linux-${{ matrix.arch }}.so"
49+
# Extract .wasm modules (architecture-independent, only needed once)
50+
if [ "${{ matrix.arch }}" = "amd64" ]; then
51+
docker run --rm --platform linux/${{ matrix.arch }} \
52+
vmod-wasm-release-${{ matrix.arch }} tar -cf - \
53+
tests/wasm/edge_security_filter.wasm \
54+
tests/wasm/proxy_wasm_filter.wasm \
55+
tests/wasm/passthrough.wasm \
56+
tests/wasm/test_module.wasm \
57+
| tar -xf -
58+
cp tests/wasm/*.wasm dist/
59+
fi
60+
61+
- name: Upload artifacts
62+
uses: actions/upload-artifact@v4
63+
with:
64+
name: release-${{ matrix.arch }}
65+
path: dist/
66+
1267
release:
1368
runs-on: ubuntu-latest
69+
needs: build
1470

1571
steps:
1672
- uses: actions/checkout@v4
@@ -24,7 +80,6 @@ jobs:
2480
- name: Extract changelog section
2581
id: changelog
2682
run: |
27-
# Extract the section for this version from CHANGELOG.md
2883
version="${{ steps.version.outputs.version }}"
2984
notes=$(awk -v ver="$version" '
3085
/^## \[/ {
@@ -34,31 +89,17 @@ jobs:
3489
}
3590
found { print }
3691
' CHANGELOG.md)
37-
# Use delimiter for multiline output
3892
{
3993
echo "notes<<EOF"
4094
echo "$notes"
4195
echo "EOF"
4296
} >> "$GITHUB_OUTPUT"
4397
44-
- name: Build release artifacts
45-
run: |
46-
docker build -t vmod-wasm-release .
47-
# Extract .wasm modules
48-
docker run --rm vmod-wasm-release tar -cf - \
49-
tests/wasm/edge_security_filter.wasm \
50-
tests/wasm/proxy_wasm_filter.wasm \
51-
tests/wasm/passthrough.wasm \
52-
tests/wasm/test_module.wasm \
53-
| tar -xf -
54-
# Extract compiled VMOD (.so) for Varnish 9 / Linux amd64
55-
docker run --rm vmod-wasm-release sh -c \
56-
'find /src/.libs -name "libvmod_wasm.so" | head -1 | xargs cat' \
57-
> libvmod_wasm.so
58-
# Package artifacts
59-
mkdir -p dist
60-
cp tests/wasm/*.wasm dist/
61-
cp libvmod_wasm.so "dist/libvmod_wasm-${{ steps.version.outputs.version }}-varnish9-linux-amd64.so"
98+
- name: Download all artifacts
99+
uses: actions/download-artifact@v4
100+
with:
101+
path: dist
102+
merge-multiple: true
62103

63104
- name: Create GitHub Release
64105
env:
@@ -67,5 +108,4 @@ jobs:
67108
gh release create "$GITHUB_REF_NAME" \
68109
--title "$GITHUB_REF_NAME" \
69110
--notes "${{ steps.changelog.outputs.notes }}" \
70-
dist/*.wasm \
71-
dist/*.so
111+
dist/*

0 commit comments

Comments
 (0)