From 984d74ced99b895939256012f36af356536a57e5 Mon Sep 17 00:00:00 2001 From: Vishal Pankaj Chandratreya <19171016+tfpf@users.noreply.github.com> Date: Mon, 1 Jul 2024 23:18:53 +0530 Subject: [PATCH] 32-bit build for Linux (#14) * Separated Linux build jobs from macOS and Windows build jobs. * 32-bit binaries for Linux must be built in a 32-bit container. I used Debian. * Hence, it made sense to use a 64-bit Debian container to build the 64-bit binaries, ditching Ubuntu. * Used older versions of the checkout and upload actions for Linux builds. * The newer versions don't work in containers. * https://github.com/actions/runner/issues/2115 * https://github.com/actions/upload-artifact/issues/361 * https://github.com/actions/checkout/issues/1681 * Consequently, the an older version of the corresponding download action must be used. * The older upload action doesn't recognise wildcard patters, so specified the `bin` directory to upload. * Did the same for the newer upload action for consistency. * Moved `env` next to the step which requires the token. * Tried to build the binaries in ARM containers, but the Linux runner is an AMD64 machine, so it didn't work. * The macOS runner which is an ARM machine does not have Docker, so couldn't use it, either. --- .github/workflows/package.yml | 49 +++++++++++++++++++++++++---------- 1 file changed, 36 insertions(+), 13 deletions(-) diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index dd7cc53..969d247 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -7,42 +7,65 @@ on: workflow_dispatch: jobs: - build: + build_macos_windows: name: build on ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: matrix: - os: [macos-13, macos-14, ubuntu-22.04, windows-2022] + os: [macos-13, macos-14, windows-2022] steps: - uses: actions/checkout@v4 - - if: runner.os == 'Linux' - run: sudo apt install libnotify-dev - run: make -j release CC=gcc working-directory: custom-prompt - uses: actions/upload-artifact@v4 with: name: ${{ matrix.os }} - path: 'custom-prompt/bin/*' + path: 'custom-prompt/bin' + + build_linux: + name: build on ${{ matrix.arch }}/debian:12 + runs-on: ubuntu-22.04 + container: ${{ matrix.arch }}/debian:12 + strategy: + matrix: + arch: [amd64, i386] + steps: + - run: apt update && apt install -y build-essential git libnotify-dev libx11-dev + - uses: actions/checkout@v1 + - run: make -j release + working-directory: custom-prompt + - uses: actions/upload-artifact@v1 + with: + name: ${{ matrix.arch }} + path: 'custom-prompt/bin' release: if: github.ref_type == 'tag' - needs: build + needs: [build_macos_windows, build_linux] runs-on: ubuntu-22.04 - env: - GH_TOKEN: ${{ github.token }} permissions: write-all steps: - uses: actions/checkout@v4 - uses: actions/download-artifact@v4 + - uses: actions/download-artifact@v1 + with: + name: amd64 + - uses: actions/download-artifact@v1 + with: + name: i386 - run: chmod +x . -R - - run: tar czf custom-prompt-amd64-macos.tgz * + - run: tar vczf custom-prompt-amd64-macos.tgz * working-directory: macos-13 - - run: tar czf custom-prompt-aarch64-macos.tgz * + - run: tar vczf custom-prompt-aarch64-macos.tgz * working-directory: macos-14 - - run: tar czf custom-prompt-amd64-linux.tgz * - working-directory: ubuntu-22.04 - - run: tar czf custom-prompt-amd64-windows.tgz * + - run: tar vczf custom-prompt-amd64-windows.tgz * working-directory: windows-2022 + - run: tar vczf custom-prompt-amd64-linux.tgz * + working-directory: amd64 + - run: tar vczf custom-prompt-i386-linux.tgz * + working-directory: i386 - run: | gh release create ${{ github.ref_name }} -t ${{ github.ref_name }} -n 'Release intended as proof-of-concept. Binaries are dynamically-linked.' gh release upload ${{ github.ref_name }} */*.tgz + env: + GH_TOKEN: ${{ github.token }}