This commit is contained in:
@@ -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
|
||||
@@ -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}')"
|
||||
|
||||
Reference in New Issue
Block a user