Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 87 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: Build su-exec

on:
push:
branches: ["**"]
tags:
- "v*"
pull_request:

jobs:
build-ubuntu:
name: Ubuntu build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install build deps
run: |
sudo apt-get update
sudo apt-get install -y build-essential

- name: Build
run: make

- name: Show binary info
run: |
ls -l su-exec
file su-exec

build-static:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- platform: linux/amd64
arch: amd64
- platform: linux/arm64
arch: arm64
- platform: linux/ppc64le
arch: ppc64le
- platform: linux/riscv64
arch: riscv64
- platform: linux/s390x
arch: s390x
- platform: linux/arm/v7
arch: armv7
- platform: linux/386
arch: x86

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Enable QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: all

- name: Build static inside Alpine (${{ matrix.arch }})
shell: bash
run: |
set -euxo pipefail

docker run --rm \
--platform=${{ matrix.platform }} \
-e HOST_UID="$(id -u)" \
-e HOST_GID="$(id -g)" \
-v "$PWD":/src -w /src \
alpine:3.22 \
sh -exc '
apk add --no-cache build-base file
make clean
make su-exec
./su-exec "$HOST_UID:$HOST_GID" make su-exec-static
./su-exec "$HOST_UID:$HOST_GID" strip su-exec-static
file su-exec-static
'

mv su-exec-static su-exec-static-${{ matrix.arch }}

- name: Upload artifact (${{ matrix.arch }})
uses: actions/upload-artifact@v4
with:
name: su-exec-static-${{ matrix.arch }}
path: su-exec-static-${{ matrix.arch }}