Skip to content

Commit

Permalink
32-bit build for Linux (#14)
Browse files Browse the repository at this point in the history
* 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.
    * actions/runner#2115
    * actions/upload-artifact#361
    * actions/checkout#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.
  • Loading branch information
tfpf authored Jul 1, 2024
1 parent cf52a33 commit 984d74c
Showing 1 changed file with 36 additions and 13 deletions.
49 changes: 36 additions & 13 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

0 comments on commit 984d74c

Please sign in to comment.