Skip to content

Commit 5f315c2

Browse files
committed
Add workflow to build binaries
1 parent 4c3bb42 commit 5f315c2

File tree

1 file changed

+84
-0
lines changed

1 file changed

+84
-0
lines changed

.github/workflows/build.yaml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: Build su-exec
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
build-ubuntu:
9+
name: Ubuntu build
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v4
14+
15+
- name: Install build deps
16+
run: |
17+
sudo apt-get update
18+
sudo apt-get install -y build-essential
19+
20+
- name: Build
21+
run: make
22+
23+
- name: Show binary info
24+
run: |
25+
ls -l su-exec
26+
file su-exec
27+
28+
build-static:
29+
runs-on: ubuntu-latest
30+
strategy:
31+
fail-fast: false
32+
matrix:
33+
include:
34+
- platform: linux/amd64
35+
arch: amd64
36+
- platform: linux/arm64
37+
arch: arm64
38+
- platform: linux/ppc64le
39+
arch: ppc64le
40+
- platform: linux/riscv64
41+
arch: riscv64
42+
- platform: linux/s390x
43+
arch: s390x
44+
- platform: linux/arm/v7
45+
arch: armv7
46+
- platform: linux/386
47+
arch: x86
48+
49+
steps:
50+
- name: Checkout
51+
uses: actions/checkout@v4
52+
53+
- name: Enable QEMU
54+
uses: docker/setup-qemu-action@v3
55+
with:
56+
platforms: all
57+
58+
- name: Build static inside Alpine (${{ matrix.arch }})
59+
shell: bash
60+
run: |
61+
set -euxo pipefail
62+
63+
docker run --rm \
64+
--platform=${{ matrix.platform }} \
65+
-e HOST_UID="$(id -u)" \
66+
-e HOST_GID="$(id -g)" \
67+
-v "$PWD":/src -w /src \
68+
alpine:3.22 \
69+
sh -exc '
70+
apk add --no-cache build-base file
71+
make clean
72+
make su-exec
73+
./su-exec "$HOST_UID:$HOST_GID" make su-exec-static
74+
./su-exec "$HOST_UID:$HOST_GID" strip su-exec-static
75+
file su-exec-static
76+
'
77+
78+
mv su-exec-static su-exec-static-${{ matrix.arch }}
79+
80+
- name: Upload artifact (${{ matrix.arch }})
81+
uses: actions/upload-artifact@v4
82+
with:
83+
name: su-exec-static-${{ matrix.arch }}
84+
path: su-exec-static-${{ matrix.arch }}

0 commit comments

Comments
 (0)