Skip to content

;doc: changelogs: order releases by date (1.50.5 above 1.51) #18

;doc: changelogs: order releases by date (1.50.5 above 1.51)

;doc: changelogs: order releases by date (1.50.5 above 1.51) #18

# TRIGGER: Runs on any push to binaries-mac-arm64-hx or binaries branches.
# ACTION: Builds, tests and saves mac arm64 dynamic binaries with hx,
# using the ghc configured in hx.toml and the deps saved in hx.lock.
name: binaries-mac-arm64-hx
on:
push:
branches: [ binaries-mac-arm64-hx, binaries ]
workflow_dispatch:
jobs:
build:
runs-on: macos-26
# https://github.com/actions/runner-images/blob/main/images/macos/macos-26-arm64-Readme.md
env:
GH_TOKEN: ${{ github.token }} # lets `gh release download` authenticate & dodge rate limits
HX_AUTO_INSTALL: "true" # install missing GHC toolchain without prompting (hx wants true/false, not 1)
ghc: "9.14.1" # matches hx.toml [toolchain] ghc / stack.yaml compiler
cabal: "3.16.1.0" # cabal-install version to fetch (official self-contained binary)
steps:
- name: Show platform info
run: |
arch
uname -a
- name: Check out
uses: actions/checkout@v7
# have to fetch everything for git describe for --version
with:
fetch-depth: 0
- name: Check embedded files
run: |
tools/checkembeddedfiles
- name: Cache - hx toolchains (GHC bindist)
uses: actions/cache@v6
with:
path: ~/.hx
key: ${{ runner.os }}-arm64-hx-toolchain-${{ env.ghc }}
- name: Cache - hx compiled dependency store
uses: actions/cache@v6
with:
path: ~/Library/Caches/io.raskell.hx
key: ${{ runner.os }}-arm64-hx-store-${{ env.ghc }}-${{ hashFiles('hx.lock') }}
restore-keys: |
${{ runner.os }}-arm64-hx-store-${{ env.ghc }}-
- name: Cache - cabal Hackage index (used by the system cabal)
uses: actions/cache@v6
with:
path: ~/.cache/cabal
key: ${{ runner.os }}-arm64-cabal-index-${{ hashFiles('hx.lock') }}
restore-keys: |
${{ runner.os }}-arm64-cabal-index-
- name: Cache - cabal binary
uses: actions/cache@v6
with:
path: ~/.local/bin/cabal
key: ${{ runner.os }}-arm64-cabal-bin-${{ env.cabal }}
# NB: the project build (.hx/cabal/dist-newstyle) is deliberately NOT cached.
# hledger bakes the git commit into --version at compile time; a restored build
# is reused across commits (when hx.lock is unchanged), giving a stale commit.
# The expensive dependency compilation stays cached in the store above.
- name: Ensure ~/.local/bin exists and is in PATH
run: |
mkdir -p "$HOME/.local/bin"
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Install hx (latest release)
run: |
# download the latest mac arm64 release asset (a bare `hx` binary in a tarball)
mkdir -p /tmp/hxdl
gh release download --repo arcanist-sh/hx --pattern '*aarch64-apple-darwin.tar.gz' --dir /tmp/hxdl --clobber
tar xzf /tmp/hxdl/*aarch64-apple-darwin.tar.gz -C /tmp/hxdl
install -m 755 "$(find /tmp/hxdl -type f -name hx | head -1)" "$HOME/.local/bin/hx"
hx --version
hx doctor || true
- name: Install GHC and cabal
run: |
hx toolchain install --set "$ghc"
# hx can't install cabal without ghcup, so fetch the official cabal into
# ~/.local/bin - unless it's already there (restored from the cabal-binary cache).
# (The official cabal binary is self-contained and easier to cache than homebrew's binary.)
if ! command -v cabal >/dev/null; then
mkdir -p /tmp/cabaldl
curl -fsSL "https://downloads.haskell.org/cabal/cabal-install-$cabal/cabal-install-$cabal-aarch64-darwin.tar.xz" -o /tmp/cabaldl/cabal.tar.xz
tar xJf /tmp/cabaldl/cabal.tar.xz -C /tmp/cabaldl
install -m 755 "$(find /tmp/cabaldl -type f -name cabal | head -1)" "$HOME/.local/bin/cabal"
fi
cabal --version
# the system cabal has no Hackage index (hx's own ~/.cache/hx index isn't used by it),
# so download it, else dependency resolution fails with "unknown package".
# This should not be github-cached: it's incremental/cheap when cabal's ~/.cache/cabal is warm,
# and we want it to be fresh in case hx needs to find some newer dep.
cabal update
hx toolchain status || true # informational; hx build is the real check
- name: List dependencies
run: |
hx list
- name: Build hledger
# - name: Build hledger and run unit + doc tests
run: |
# no --release: that forces -O2; we use hx.toml [build] optimization = 1 to match stack's -O1
hx build -v
#hx test -v
- name: Collect built binaries onto PATH
run: |
# hx builds via cabal into .hx/cabal/dist-newstyle. The executable lands at
# .../<pkg>-<ver>/x/<exe>/build/<exe>/<exe> (default build), or
# .../<pkg>-<ver>/x/<exe>/opt/build/<exe>/<exe> (optimized/--release build),
# so the glob below (*build/) matches either.
for exe in hledger hledger-ui hledger-web; do
bin=$(find .hx/cabal/dist-newstyle -type f -name "$exe" -path "*/x/$exe/*build/$exe/$exe" | head -1)
if [[ -z "$bin" ]]; then
echo "ERROR: $exe executable not found under .hx/cabal/dist-newstyle" >&2
find .hx/cabal/dist-newstyle -type f -name "$exe" >&2 || true
exit 1
fi
echo "$exe -> $bin"
cp "$bin" "$HOME/.local/bin/$exe"
done
hledger --version
- name: Install shelltestrunner
run: |
# untap the runner's preinstalled aws/tap (unused) to silence brew's tap-trust warning
brew untap aws/tap 2>/dev/null || true
command -v shelltest >/dev/null || brew install shelltestrunner
shelltest --version
- name: Test functional tests
run: |
COLUMNS=80 shelltest --execdir -j16 hledger/test -x /_ -x ledger-compat/ledger-baseline -x ledger-compat/ledger-regress -x ledger-compat/ledger-collected
# - name: Test haddock generation
# run: |
# hx docs
# artifacts:
- name: Gather binaries
run: |
mkdir tmp
cp ~/.local/bin/hledger tmp
cp ~/.local/bin/hledger-ui tmp
cp ~/.local/bin/hledger-web tmp
cp hledger/embeddedfiles/*.1 tmp
cp hledger/embeddedfiles/*.info tmp
cp hledger/shell-completion/hledger-completion.bash tmp
strip tmp/hledger
strip tmp/hledger-ui
strip tmp/hledger-web
cd tmp
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-ui --version
./hledger-web --version
# upload-artifact loses execute permissions, so we tar the binaries to preserve them.
- name: Upload binaries artifact
uses: actions/upload-artifact@v7
with:
name: hledger-mac-arm64
path: tmp/hledger-mac-arm64.tar