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