Skip to content

Commit

Permalink
Perform the install phase to get stripping from cabal
Browse files Browse the repository at this point in the history
  • Loading branch information
tchoutri committed Jun 25, 2024
1 parent 6f17151 commit 22fb1ee
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 9 deletions.
19 changes: 14 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,21 @@ jobs:
uses: actions/[email protected]
with:
path: ${{ steps.setup-haskell.outputs.cabal-store }}
key: ${{ runner.os }}-ghc-${{ matrix.ghc }}-cabal-${{ hashFiles('**/plan.json') }}
key: ${{ runner.os }}-ghc-${{ matrix.ghc }}-${{ hashFiles('**/plan.json') }}
restore-keys: ${{ runner.os }}-ghc-${{ matrix.ghc }}-

- name: Build
run: cabal build --project-file=cabal.release.project

- name: Test
run: cabal test --project-file=cabal.release.project all

- name: Install
run: cabal install --project-file=cabal.release.project --installdir=distribution

- name: Package the confer-head executable
run: |
CONFER_EXEC=$(cabal list-bin --project-file=cabal.release.project confer:exe:confer)
CONFER_EXEC=distribution/confer
.github/workflows/process-binaries.sh
DIR=$(dirname $CONFER_EXEC)
FILE=$(basename $CONFER_EXEC)
Expand Down Expand Up @@ -107,8 +113,8 @@ jobs:
- uses: actions/cache@v4
with:
path: ${{ steps.setup-haskell.outputs.cabal-store }}
key: ${{ runner.os }}-ghc-9.8.2-cabal-${{ hashFiles('**/plan.json') }}
restore-keys: ${{ runner.os }}-ghc-9.8.2-
key: ${{ runner.os }}-ghc-${{ steps.setup.outputs.ghc-version }}-${{ hashFiles('**/plan.json') }}
restore-keys: ${{ runner.os }}-${{ steps.setup.outputs.ghc-version }}-

- name: Enable statically linked executables
run: |
Expand All @@ -120,9 +126,12 @@ jobs:
- name: Test
run: cabal test --project-file=cabal.release.project all

- name: Install
run: cabal install --project-file=cabal.release.project --installdir=distribution

- name: Tar cabal head executable
run: |
CONFER_EXEC=$(cabal list-bin --project-file=cabal.release.project confer:exe:confer)
CONFER_EXEC=distribution/confer
.github/workflows/process-binaries.sh
DIR=$(dirname $CONFER_EXEC)
FILE=$(basename $CONFER_EXEC)
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/process-binaries.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#!/usr/bin/env bash

CONFER_EXEC=$(cabal list-bin --project-file=cabal.release.project confer:exe:confer)
CONFER_PATH="distribution/confer"

ldd $CONFER_EXEC
ldd $CONFER_PATH
file $CONFER_PATH

case "$(uname -s)" in
Linux*) strip $CONFER_EXEC && upx -9 $CONFER_EXEC;;
Darwin*) strip $CONFER_EXEC;;
Linux*) upx -9 $CONFER_PATH;;
Darwin*) echo "upx crashes on macOS Ventura and above" ;;
esac
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ tags.mtime
.hpc
*.tix
*.local
distribution
2 changes: 2 additions & 0 deletions cabal.release.project
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import: cabal.project

installdir: distribution

optimization: 2

documentation: False
Expand Down

0 comments on commit 22fb1ee

Please sign in to comment.