From 60c2a9a5f8160f091bcc375ac0633e6937e64c7e Mon Sep 17 00:00:00 2001 From: James Brechtel Date: Mon, 11 May 2026 21:37:55 -0400 Subject: [PATCH] Adds gitea build and upx compression --- .gitea/workflows/build.yml | 41 ++++++++++++++++++++++++++++++++++++++ scripts/build | 14 +++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 .gitea/workflows/build.yml diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml new file mode 100644 index 0000000..e716982 --- /dev/null +++ b/.gitea/workflows/build.yml @@ -0,0 +1,41 @@ +name: Build +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + build: + runs-on: ubuntu-latest + container: + image: ghcr.io/flipstone/haskell-tools:debian-ghc-9.10.3-5d6640d + env: + STACK_ROOT: /tmp/.stack-root + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Cache Stack + uses: actions/cache@v4 + with: + path: /tmp/.stack-root + key: stack-${{ runner.os }}-${{ hashFiles('stack.yaml', 'package.yaml', 'converge.cabal') }} + restore-keys: stack-${{ runner.os }}- + + - name: Build + run: stack build --copy-bins --local-bin-path /tmp/build + + - name: Compress with UPX + run: | + UPX_VERSION="5.1.1" + curl -fsSL "https://github.com/upx/upx/releases/download/v${UPX_VERSION}/upx-${UPX_VERSION}-amd64_linux.tar.xz" \ + | tar -xJ -C /tmp + /tmp/upx-${UPX_VERSION}-amd64_linux/upx /tmp/build/converge + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: converge + path: /tmp/build/converge + compression-level: 0 diff --git a/scripts/build b/scripts/build index 0f79140..2b1718e 100755 --- a/scripts/build +++ b/scripts/build @@ -5,4 +5,18 @@ cd "$(dirname "${BASH_SOURCE[0]}")/.." echo "Formatting with fourmolu..." ./hs fourmolu --mode inplace app/ src/ test/ +echo "Building..." ./hs stack build --copy-bins --local-bin-path /work/build + +echo "Compressing with UPX..." +./hs bash -c ' + UPX_VERSION="5.1.1" + UPX_URL="https://github.com/upx/upx/releases/download/v${UPX_VERSION}/upx-${UPX_VERSION}-amd64_linux.tar.xz" + UPX_DIR="/tmp/upx-${UPX_VERSION}-amd64_linux" + if [ ! -x "${UPX_DIR}/upx" ]; then + curl -fsSL "${UPX_URL}" | tar -xJ -C /tmp + fi + "${UPX_DIR}/upx" /work/build/converge +' + +echo "Done: $(ls -lh build/converge | awk '{print $5}')"