Add workflow to build binaries #9
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build su-exec | |
| on: | |
| push: | |
| 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 }} |