diff --git a/.github/workflows/automated-build.yml b/.github/workflows/automated-build.yml index c76c0a4..a5aea55 100644 --- a/.github/workflows/automated-build.yml +++ b/.github/workflows/automated-build.yml @@ -12,64 +12,4 @@ permissions: jobs: build-static: - name: Build (${{ matrix.label }}) - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - include: - - label: amd64 - cc: gcc - extra_arch: "" - packages: "libdrm-dev" - lib_path: /usr/lib/x86_64-linux-gnu - - label: arm64 - cc: aarch64-linux-gnu-gcc - extra_arch: arm64 - packages: "gcc-aarch64-linux-gnu libc6-dev-arm64-cross libdrm-dev:arm64" - lib_path: /usr/lib/aarch64-linux-gnu - - label: arm - cc: arm-linux-gnueabihf-gcc - extra_arch: armhf - packages: "gcc-arm-linux-gnueabihf libc6-dev-armhf-cross libdrm-dev:armhf" - lib_path: /usr/lib/arm-linux-gnueabihf - - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Set up build environment - run: | - set -euxo pipefail - if [ -n "${{ matrix.extra_arch }}" ]; then - sudo sed -i '/^Signed-By:/a Architectures: amd64' /etc/apt/sources.list.d/ubuntu.sources - sudo sh -c "printf '%s\n' \ - 'deb [arch=${{ matrix.extra_arch }}] http://ports.ubuntu.com/ubuntu-ports noble main universe' \ - 'deb [arch=${{ matrix.extra_arch }}] http://ports.ubuntu.com/ubuntu-ports noble-updates main universe' \ - 'deb [arch=${{ matrix.extra_arch }}] http://ports.ubuntu.com/ubuntu-ports noble-backports main universe' \ - 'deb [arch=${{ matrix.extra_arch }}] http://ports.ubuntu.com/ubuntu-ports noble-security main universe' \ - > /etc/apt/sources.list.d/ubuntu-ports-${{ matrix.extra_arch }}.list" - sudo dpkg --add-architecture ${{ matrix.extra_arch }} - fi - sudo apt-get update - sudo apt-get install -y --no-install-recommends \ - build-essential make pkg-config file \ - ${{ matrix.packages }} - - - name: Build static binary - run: | - set -euxo pipefail - make clean - make CC=${{ matrix.cc }} \ - CFLAGS="-O2 -pipe -pedantic -Wall -I /usr/include/libdrm" \ - LDFLAGS="-static -ldrm -L${{ matrix.lib_path }}" - file drm-framebuffer | tee file.out - grep -qi "statically linked" file.out - cp drm-framebuffer drm-framebuffer-${{ matrix.label }} - - - name: Upload artifact - uses: actions/upload-artifact@v4 - with: - name: drm-framebuffer-${{ matrix.label }} - path: drm-framebuffer-${{ matrix.label }} - if-no-files-found: error + uses: ./.github/workflows/shared-static-multi-arch-build.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..de66138 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,30 @@ +name: Release Static Multi-Arch Binaries + +on: + push: + tags: + - "v*" + +permissions: + contents: write + +jobs: + build-static: + uses: ./.github/workflows/shared-static-multi-arch-build.yml + + create-release: + name: Create release + runs-on: ubuntu-latest + needs: build-static + steps: + - name: Download artifacts + uses: actions/download-artifact@v4.1.3 + with: + path: dist + pattern: drm-framebuffer-* + merge-multiple: true + + - name: Publish release assets + uses: softprops/action-gh-release@v2 + with: + files: dist/drm-framebuffer-* diff --git a/.github/workflows/shared-static-multi-arch-build.yml b/.github/workflows/shared-static-multi-arch-build.yml new file mode 100644 index 0000000..8423c9d --- /dev/null +++ b/.github/workflows/shared-static-multi-arch-build.yml @@ -0,0 +1,68 @@ +name: Shared Static Multi-Arch Build + +on: + workflow_call: + +jobs: + build-static: + name: Build (${{ matrix.label }}) + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: + - label: amd64 + cc: gcc + extra_arch: "" + packages: "libdrm-dev" + lib_path: /usr/lib/x86_64-linux-gnu + - label: arm64 + cc: aarch64-linux-gnu-gcc + extra_arch: arm64 + packages: "gcc-aarch64-linux-gnu libc6-dev-arm64-cross libdrm-dev:arm64" + lib_path: /usr/lib/aarch64-linux-gnu + - label: arm + cc: arm-linux-gnueabihf-gcc + extra_arch: armhf + packages: "gcc-arm-linux-gnueabihf libc6-dev-armhf-cross libdrm-dev:armhf" + lib_path: /usr/lib/arm-linux-gnueabihf + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up build environment + run: | + set -euxo pipefail + if [ -n "${{ matrix.extra_arch }}" ]; then + sudo sed -i '/^Signed-By:/a Architectures: amd64' /etc/apt/sources.list.d/ubuntu.sources + sudo sh -c "printf '%s\n' \ + 'deb [arch=${{ matrix.extra_arch }}] http://ports.ubuntu.com/ubuntu-ports noble main universe' \ + 'deb [arch=${{ matrix.extra_arch }}] http://ports.ubuntu.com/ubuntu-ports noble-updates main universe' \ + 'deb [arch=${{ matrix.extra_arch }}] http://ports.ubuntu.com/ubuntu-ports noble-backports main universe' \ + 'deb [arch=${{ matrix.extra_arch }}] http://ports.ubuntu.com/ubuntu-ports noble-security main universe' \ + > /etc/apt/sources.list.d/ubuntu-ports-${{ matrix.extra_arch }}.list" + sudo dpkg --add-architecture ${{ matrix.extra_arch }} + fi + sudo apt-get update + sudo apt-get install -y --no-install-recommends \ + build-essential make pkg-config file \ + ${{ matrix.packages }} + + - name: Build static binary + run: | + set -euxo pipefail + make clean + make CC=${{ matrix.cc }} \ + CFLAGS="-O2 -pipe -pedantic -Wall -I /usr/include/libdrm" \ + LDFLAGS="-static -ldrm -L${{ matrix.lib_path }}" + file drm-framebuffer | tee file.out + grep -qi "statically linked" file.out + cp drm-framebuffer drm-framebuffer-${{ matrix.label }} + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: drm-framebuffer-${{ matrix.label }} + path: drm-framebuffer-${{ matrix.label }} + if-no-files-found: error