Fix Gitea build: use ./hs wrapper, cache .stack-root, run upx on host
Build / build (push) Failing after 7s
Build / build (push) Failing after 7s
This commit is contained in:
@@ -9,8 +9,7 @@ jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
IMAGE: ghcr.io/flipstone/haskell-tools:debian-ghc-9.10.3-5d6640d
|
||||
STACK_ROOT: /tmp/.stack-root
|
||||
CONVERGE_HASKELL_TOOLS_IMAGE: ghcr.io/flipstone/haskell-tools:debian-ghc-9.10.3-5d6640d
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
@@ -18,35 +17,25 @@ jobs:
|
||||
- name: Cache Stack
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: /tmp/.stack-root
|
||||
path: .stack-root
|
||||
key: stack-${{ runner.os }}-${{ hashFiles('stack.yaml', 'package.yaml', 'converge.cabal') }}
|
||||
restore-keys: stack-${{ runner.os }}-
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
docker run --rm \
|
||||
-v "$(pwd):/work" \
|
||||
-v "/tmp/.stack-root:/stack-root" \
|
||||
-e STACK_ROOT=/stack-root \
|
||||
-w /work \
|
||||
"$IMAGE" \
|
||||
stack build --copy-bins --local-bin-path /work/build
|
||||
mkdir -p .stack-root build
|
||||
./hs stack build --copy-bins --local-bin-path /work/build
|
||||
|
||||
- name: Compress with UPX
|
||||
run: |
|
||||
docker run --rm \
|
||||
-v "$(pwd):/work" \
|
||||
-w /work \
|
||||
"$IMAGE" \
|
||||
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_ARCHIVE="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
|
||||
curl -fsSL "https://github.com/upx/upx/releases/download/v${UPX_VERSION}/${UPX_ARCHIVE}" \
|
||||
| tar -xJ -C /tmp
|
||||
fi
|
||||
"${UPX_DIR}/upx" /work/build/converge
|
||||
'
|
||||
${UPX_DIR}/upx build/converge
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
|
||||
Reference in New Issue
Block a user