;ci: binaries: simplify, cleanup

This commit is contained in:
Simon Michael 2025-05-28 14:43:20 -10:00
parent e259fe75f6
commit 30630b9cc1
6 changed files with 80 additions and 134 deletions

View File

@ -37,3 +37,5 @@ https://github.com/mxschmitt/action-tmate
https://kodimensional.dev/github-actions https://kodimensional.dev/github-actions
"Dead simple cross-platform GitHub Actions for Haskell" "Dead simple cross-platform GitHub Actions for Haskell"
https://github.com/actions/runner-images/tree/main?tab=readme-ov-file#available-images
https://github.com/actions/partner-runner-images/tree/main?tab=readme-ov-file#available-images

View File

@ -36,7 +36,7 @@ jobs:
restore-keys: | restore-keys: |
${{ runner.os }}-appdata-local-programs-stack ${{ runner.os }}-appdata-local-programs-stack
- name: process cache of global stack dir - name: process cache of stack global dir
id: stack-global-package-db id: stack-global-package-db
uses: actions/cache@v4 uses: actions/cache@v4
with: with:
@ -85,12 +85,9 @@ jobs:
restore-keys: | restore-keys: |
${{ runner.os }}-hledger-web-stack-work ${{ runner.os }}-hledger-web-stack-work
- name: Check preinstalled stack version # actions
run: |
which stack
printf "stack: "; stack --version
- name: Install GHC - name: Install haskell tools if needed
# if: steps.stack-programs-dir.outputs.cache-hit != 'true' # if: steps.stack-programs-dir.outputs.cache-hit != 'true'
# set PATH=C:\Users\runneradmin\AppData\Local\Programs\stack\local\bin;%PATH% # set PATH=C:\Users\runneradmin\AppData\Local\Programs\stack\local\bin;%PATH%
run: | run: |

View File

@ -25,7 +25,7 @@ jobs:
# things to be cached/restored (needs tar) # things to be cached/restored (needs tar)
- name: process cache of ghcup-installed tools - name: process cache of ~/.ghcup
id: ghcup id: ghcup
uses: actions/cache@v4 uses: actions/cache@v4
with: with:
@ -34,7 +34,7 @@ jobs:
restore-keys: | restore-keys: |
${{ runner.os }}-ghcup ${{ runner.os }}-ghcup
- name: process cache of cabal-installed libs - name: process cache of ~/.cabal
id: cabal id: cabal
uses: actions/cache@v4 uses: actions/cache@v4
with: with:
@ -45,6 +45,14 @@ jobs:
# actions: # actions:
# - name: Check tool versions
# run: |
# which ghcup; ghcup --version
# which stack; stack --version
# which cabal; cabal --version
# which ghc; ghc --version
# no preinstalled tools because using alpine container
# - name: Install haskell ghcup # - name: Install haskell ghcup
# uses: haskell/ghcup-setup@v1 # uses: haskell/ghcup-setup@v1
@ -55,8 +63,8 @@ jobs:
- name: Install haskell tools if needed - name: Install haskell tools if needed
run: | run: |
if [[ ! -x ~/.ghcup/bin/ghcup ]]; then mkdir -p ~/.ghcup/bin && curl https://downloads.haskell.org/~ghcup/x86_64-linux-ghcup > ~/.ghcup/bin/ghcup && chmod +x ~/.ghcup/bin/ghcup; fi; printf "ghcup: "; ghcup --version if [[ ! -x ~/.ghcup/bin/ghcup ]]; then mkdir -p ~/.ghcup/bin && curl https://downloads.haskell.org/~ghcup/x86_64-linux-ghcup > ~/.ghcup/bin/ghcup && chmod +x ~/.ghcup/bin/ghcup; fi; printf "ghcup: "; ghcup --version
if [[ ! -x ~/.ghcup/bin/ghc-9.12.2 ]]; then ~/.ghcup/bin/ghcup install ghc 9.12.2 && ~/.ghcup/bin/ghcup set ghc 9.12.2; fi; printf "ghc: "; ghc --version if [[ ! -x ~/.ghcup/bin/ghc-9.12.2 ]]; then ghcup install ghc 9.12.2 && ghcup set ghc 9.12.2; fi; printf "ghc: "; ghc --version
if [[ ! -x ~/.ghcup/bin/cabal ]]; then ~/.ghcup/bin/ghcup install cabal 3.14.2.0 && ~/.ghcup/bin/ghcup set cabal 3.14.2.0; fi; printf "cabal: "; cabal --version if [[ ! -x ~/.ghcup/bin/cabal ]]; then ghcup install cabal 3.14.2.0 && ghcup set cabal 3.14.2.0; fi; printf "cabal: "; cabal --version
- name: Update cabal package index - name: Update cabal package index
run: | run: |
@ -82,6 +90,12 @@ jobs:
strip tmp/hledger-web strip tmp/hledger-web
cd tmp cd tmp
tar cvf hledger-linux-x64.tar hledger hledger-ui hledger-web *.1 *.info hledger-completion.bash tar cvf hledger-linux-x64.tar hledger hledger-ui hledger-web *.1 *.info hledger-completion.bash
ldd hledger || true
ldd hledger-ui || true
ldd hledger-web || true
# file hledger
# file hledger-ui
# file hledger-web
./hledger --version ./hledger --version
./hledger-ui --version ./hledger-ui --version
./hledger-web --version ./hledger-web --version

View File

@ -30,18 +30,9 @@ jobs:
brew install ripgrep brew install ripgrep
tools/checkembeddedfiles tools/checkembeddedfiles
# things to be cached/restored: # caching
- name: process cache of stack global package db - name: process cache of stack-installed ~/.local/bin
id: stack-global
uses: actions/cache@v4
with:
path: ~/.stack
key: ${{ runner.os }}-arm64-stack-global-${{ hashFiles('**.yaml') }}
restore-keys: |
${{ runner.os }}-arm64-stack-global
- name: process cache of stack-installed programs in ~/.local/bin
id: stack-programs id: stack-programs
uses: actions/cache@v4 uses: actions/cache@v4
with: with:
@ -50,7 +41,16 @@ jobs:
restore-keys: | restore-keys: |
${{ runner.os }}-arm64-stack-programs ${{ runner.os }}-arm64-stack-programs
- name: process cache of .stack-work - name: process cache of ~/.stack
id: stack-global
uses: actions/cache@v4
with:
path: ~/.stack
key: ${{ runner.os }}-arm64-stack-global-${{ hashFiles('**.yaml') }}
restore-keys: |
${{ runner.os }}-arm64-stack-global
- name: process cache of ./.stack-work
uses: actions/cache@v4 uses: actions/cache@v4
with: with:
path: .stack-work path: .stack-work
@ -92,35 +92,20 @@ jobs:
# actions: # actions:
- name: Add .ghcup/bin to PATH for following steps - name: Ensure ~/.local/bin exists and is in PATH
run: | run: |
echo "$HOME/.ghcup/bin/" >> $GITHUB_PATH mkdir -p "$HOME/.local/bin"
echo "$HOME/.local/bin/" >> $GITHUB_PATH
- name: Install stack with ghcup if needed - name: Install haskell tools if needed
run: | run: |
if [[ ! -x ~/.ghcup/bin/ghcup ]]; then if [[ ! -x ~/.local/bin/stack ]]; then curl -sL https://get.haskellstack.org/stable/osx-aarch64.tar.gz | gtar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack'; chmod a+x ~/.local/bin/stack; fi
mkdir -p ~/.ghcup/bin && curl https://downloads.haskell.org/~ghcup/aarch64-apple-darwin-ghcup > ~/.ghcup/bin/ghcup && chmod +x ~/.ghcup/bin/ghcup
fi
ghcup --version
if [[ ! -x ~/.ghcup/bin/stack ]]; then
~/.ghcup/bin/ghcup install stack 3.1.1 && ~/.ghcup/bin/ghcup set stack 3.1.1
fi
stack --version stack --version
$stack setup --install-ghc --verbosity=error
- name: Install GHC (with stack)
run: |
$stack setup --install-ghc
# - name: Install GHC (with ghcup)
# run: |
# mkdir -p ~/.ghcup/bin && curl -sL https://downloads.haskell.org/~ghcup/arm64-apple-darwin-ghcup > ~/.ghcup/bin/ghcup && chmod +x ~/.ghcup/bin/ghcup
# ~/.ghcup/bin/ghcup install --set ghc 9.2.4 # && ~/.ghcup/bin/ghcup install stack
# echo "$HOME/.ghcup/bin/" >> $GITHUB_PATH
- name: Install haskell deps - name: Install haskell deps
run: | run: |
$stack build --test --only-dependencies --dry-run $stack build --test --only-dependencies --verbosity=error
$stack build --test --only-dependencies
- name: List dep versions - name: List dep versions
run: | run: |
@ -167,7 +152,10 @@ jobs:
strip tmp/hledger-ui strip tmp/hledger-ui
strip tmp/hledger-web strip tmp/hledger-web
cd tmp cd tmp
tar cvf hledger-mac-arm64.tar hledger hledger-ui hledger-web *.1 *.info hledger-completion.bash gtar cvf hledger-mac-arm64.tar hledger hledger-ui hledger-web *.1 *.info hledger-completion.bash
otool -L hledger
otool -L hledger-ui
otool -L hledger-web
./hledger --version ./hledger --version
./hledger-ui --version ./hledger-ui --version
./hledger-web --version ./hledger-web --version

View File

@ -30,18 +30,9 @@ jobs:
brew install ripgrep brew install ripgrep
tools/checkembeddedfiles tools/checkembeddedfiles
# things to be cached/restored: # caching
- name: process cache of stack global package db - name: process cache of stack-installed ~/.local/bin
id: stack-global
uses: actions/cache@v4
with:
path: ~/.stack
key: ${{ runner.os }}-x64-stack-global-${{ hashFiles('**.yaml') }}
restore-keys: |
${{ runner.os }}-x64-stack-global
- name: process cache of stack-installed programs in ~/.local/bin
id: stack-programs id: stack-programs
uses: actions/cache@v4 uses: actions/cache@v4
with: with:
@ -50,7 +41,16 @@ jobs:
restore-keys: | restore-keys: |
${{ runner.os }}-x64-stack-programs ${{ runner.os }}-x64-stack-programs
- name: process cache of .stack-work - name: process cache of ~/.stack
id: stack-global
uses: actions/cache@v4
with:
path: ~/.stack
key: ${{ runner.os }}-x64-stack-global-${{ hashFiles('**.yaml') }}
restore-keys: |
${{ runner.os }}-x64-stack-global
- name: process cache of ./.stack-work
uses: actions/cache@v4 uses: actions/cache@v4
with: with:
path: .stack-work path: .stack-work
@ -92,35 +92,24 @@ jobs:
# actions: # actions:
- name: Add .ghcup/bin to PATH for following steps - name: Ensure ~/.local/bin exists and is in PATH
run: | run: |
echo "$HOME/.ghcup/bin/" >> $GITHUB_PATH mkdir -p "$HOME/.local/bin"
echo "$HOME/.local/bin/" >> $GITHUB_PATH
# XXX occasionally we need to force a cache flush, or tools eventually become too old (Cabal tends to break old stack, eg) - name: Install haskell tools if needed
- name: Install haskell tools with ghcup if needed
run: | run: |
if [[ ! -x ~/.ghcup/bin/ghcup ]]; then mkdir -p ~/.ghcup/bin && curl https://downloads.haskell.org/~ghcup/x86_64-apple-darwin-ghcup > ~/.ghcup/bin/ghcup && chmod +x ~/.ghcup/bin/ghcup; fi; printf "ghcup: "; ghcup --version if [[ ! -x ~/.local/bin/stack ]]; then curl -sL https://get.haskellstack.org/stable/osx-x86_64.tar.gz | gtar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack'; chmod a+x ~/.local/bin/stack; fi
if [[ ! -x ~/.ghcup/bin/stack ]]; then ~/.ghcup/bin/ghcup install stack 3.1.1 && ~/.ghcup/bin/ghcup set stack 3.1.1; fi; printf "stack: "; stack --version stack --version
#if [[ ! -x ~/.ghcup/bin/ghc-9.8.4 ]]; then ~/.ghcup/bin/ghcup install ghc 9.8.2 && ~/.ghcup/bin/ghcup set ghc 9.8.2; fi; printf "ghc: "; ghc --version $stack setup --install-ghc --verbosity=error
- name: Install GHC with stack
run: |
$stack setup --install-ghc
# - name: Install GHC (with ghcup)
# run: |
# mkdir -p ~/.ghcup/bin && curl -sL https://downloads.haskell.org/~ghcup/x86_64-apple-darwin-ghcup > ~/.ghcup/bin/ghcup && chmod +x ~/.ghcup/bin/ghcup
# ~/.ghcup/bin/ghcup install --set ghc 9.2.4 # && ~/.ghcup/bin/ghcup install stack
# echo "$HOME/.ghcup/bin/" >> $GITHUB_PATH
- name: Install haskell deps - name: Install haskell deps
run: | run: |
$stack build --test --only-dependencies --dry-run $stack build --test --only-dependencies --verbosity=error
$stack build --test --only-dependencies
- name: List dep versions # - name: List dep versions
run: | # run: |
$stack exec -- ghc-pkg list # $stack exec -- ghc-pkg list
- name: Build hledger and test unit tests, doc tests - name: Build hledger and test unit tests, doc tests
run: | run: |
@ -154,7 +143,10 @@ jobs:
strip tmp/hledger-ui strip tmp/hledger-ui
strip tmp/hledger-web strip tmp/hledger-web
cd tmp cd tmp
tar cvf hledger-mac-x64.tar hledger hledger-ui hledger-web *.1 *.info hledger-completion.bash gtar cvf hledger-mac-x64.tar hledger hledger-ui hledger-web *.1 *.info hledger-completion.bash
otool -L hledger
otool -L hledger-ui
otool -L hledger-web
./hledger --version ./hledger --version
./hledger-ui --version ./hledger-ui --version
./hledger-web --version ./hledger-web --version

View File

@ -12,6 +12,9 @@ jobs:
defaults: defaults:
run: run:
shell: bash shell: bash
env:
# use preinstalled ghc 9.12.2
stack: stack --system-ghc --no-install-ghc --stack-yaml stack912.yaml
steps: steps:
- name: Check out - name: Check out
@ -33,7 +36,7 @@ jobs:
restore-keys: | restore-keys: |
${{ runner.os }}-appdata-local-programs-stack ${{ runner.os }}-appdata-local-programs-stack
- name: process cache of global stack dir - name: process cache of stack global dir
id: stack-global-package-db id: stack-global-package-db
uses: actions/cache@v4 uses: actions/cache@v4
with: with:
@ -82,51 +85,11 @@ jobs:
restore-keys: | restore-keys: |
${{ runner.os }}-hledger-web-stack-work ${{ runner.os }}-hledger-web-stack-work
# - name: showStuff # actions
# run: |
# ls -lFRa /c/users/runneradmin/appdata/roaming/stack
# ls -lFRa /c/users/runneradmin/appdata/local/programs/stack
# actions:
# - name: Add stack local bin to PATH
# run: echo "::add-path::C:\Users\runneradmin\AppData\Roaming\stack\local\bin"
# - name: Install stack
# run: |
# mkdir -p ~/.local/bin
# export PATH=~/.local/bin:$PATH
# if [[ ! -x ~/.local/bin/stack ]]; then curl -sL https://get.haskellstack.org/stable/linux-x86_64.tar.gz | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack'; chmod a+x ~/.local/bin/stack; fi
# $stack --version
# env:
# stack: ${{ matrix.plan.stack }}
# - name: Install stack
# #if: steps.stack-programs-dir.outputs.cache-hit != 'true'
# # this step is needed to get stack.exe into PATH, for now
# run: |
# curl -sL https://get.haskellstack.org/stable/windows-x86_64.zip -o stack.zip
# 7z x stack.zip stack.exe
# which stack
# printf "stack: "; stack --version
# which ./stack
# printf "./stack: "; ./stack --version
- name: Check preinstalled stack version
run: |
which stack
printf "stack: "; stack --version
# - name: Install GHC
# # if: steps.stack-programs-dir.outputs.cache-hit != 'true'
# # set PATH=C:\Users\runneradmin\AppData\Local\Programs\stack\local\bin;%PATH%
# run: |
# stack setup --install-ghc
- name: Install haskell deps - name: Install haskell deps
run: | run: |
stack build --test --only-dependencies --dry-run $stack build --test --only-dependencies --verbosity=error
stack build --test --only-dependencies
- name: List dep versions - name: List dep versions
run: | run: |
@ -134,18 +97,8 @@ jobs:
- name: Build all hledger modules warning free, optimised and minimised - name: Build all hledger modules warning free, optimised and minimised
run: | run: |
stack install --test --force-dirty --ghc-options=-fforce-recomp --ghc-options=-Werror $stack install --test --force-dirty --ghc-options=-fforce-recomp --ghc-options=-Werror
# --ghc-options=-split-sections doesn't work on windows, "too many sections" # --ghc-options=-split-sections doesn't work on windows, "too many sections"
# --pedantic
# - name: Install shelltestrunner
## - export PATH=~/.local/bin:$PATH
# - if [[ ! -x ~/.local/bin/shelltest ]]; then stack install shelltestrunner-1.10; fi
# - shelltest --version
# run hledger-lib/hledger functional tests, skipping the ones for addons
## - export PATH=~/.local/bin:$PATH
#- COLUMNS=80 stack exec -- shelltest --execdir -j16 hledger/test -x /_ -x /addons -x ledger-compat/ledger-baseline -x ledger-compat/ledger-regress -x ledger-compat/ledger-collected
# artifacts: # artifacts: