From 30630b9cc1c996e38b3a0ccfa101d2c6da076fb4 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Wed, 28 May 2025 14:43:20 -1000 Subject: [PATCH] ;ci: binaries: simplify, cleanup --- .github/workflows/README | 2 + .github/workflows/_binaries-windows-arm64.yml | 9 +-- .github/workflows/binaries-linux-x64.yml | 22 +++++-- .github/workflows/binaries-mac-arm64.yml | 58 +++++++---------- .github/workflows/binaries-mac-x64.yml | 62 ++++++++----------- .github/workflows/binaries-windows-x64.yml | 61 +++--------------- 6 files changed, 80 insertions(+), 134 deletions(-) diff --git a/.github/workflows/README b/.github/workflows/README index c6135d6e3..c1420d721 100644 --- a/.github/workflows/README +++ b/.github/workflows/README @@ -37,3 +37,5 @@ https://github.com/mxschmitt/action-tmate https://kodimensional.dev/github-actions "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 diff --git a/.github/workflows/_binaries-windows-arm64.yml b/.github/workflows/_binaries-windows-arm64.yml index a70622f0a..dbcc99276 100644 --- a/.github/workflows/_binaries-windows-arm64.yml +++ b/.github/workflows/_binaries-windows-arm64.yml @@ -36,7 +36,7 @@ jobs: restore-keys: | ${{ 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 uses: actions/cache@v4 with: @@ -85,12 +85,9 @@ jobs: restore-keys: | ${{ runner.os }}-hledger-web-stack-work - - name: Check preinstalled stack version - run: | - which stack - printf "stack: "; stack --version + # actions - - name: Install GHC + - name: Install haskell tools if needed # if: steps.stack-programs-dir.outputs.cache-hit != 'true' # set PATH=C:\Users\runneradmin\AppData\Local\Programs\stack\local\bin;%PATH% run: | diff --git a/.github/workflows/binaries-linux-x64.yml b/.github/workflows/binaries-linux-x64.yml index a464643cd..94c5cb53e 100644 --- a/.github/workflows/binaries-linux-x64.yml +++ b/.github/workflows/binaries-linux-x64.yml @@ -25,7 +25,7 @@ jobs: # things to be cached/restored (needs tar) - - name: process cache of ghcup-installed tools + - name: process cache of ~/.ghcup id: ghcup uses: actions/cache@v4 with: @@ -34,7 +34,7 @@ jobs: restore-keys: | ${{ runner.os }}-ghcup - - name: process cache of cabal-installed libs + - name: process cache of ~/.cabal id: cabal uses: actions/cache@v4 with: @@ -45,6 +45,14 @@ jobs: # 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 # uses: haskell/ghcup-setup@v1 @@ -55,8 +63,8 @@ jobs: - name: Install haskell tools if needed 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/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/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/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 install cabal 3.14.2.0 && ghcup set cabal 3.14.2.0; fi; printf "cabal: "; cabal --version - name: Update cabal package index run: | @@ -82,6 +90,12 @@ jobs: strip tmp/hledger-web cd tmp 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-ui --version ./hledger-web --version diff --git a/.github/workflows/binaries-mac-arm64.yml b/.github/workflows/binaries-mac-arm64.yml index e1602d0a5..cccf331a2 100644 --- a/.github/workflows/binaries-mac-arm64.yml +++ b/.github/workflows/binaries-mac-arm64.yml @@ -30,18 +30,9 @@ jobs: brew install ripgrep tools/checkembeddedfiles - # things to be cached/restored: + # caching - - name: process cache of stack global package db - 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 + - name: process cache of stack-installed ~/.local/bin id: stack-programs uses: actions/cache@v4 with: @@ -50,7 +41,16 @@ jobs: restore-keys: | ${{ 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 with: path: .stack-work @@ -92,35 +92,20 @@ jobs: # actions: - - name: Add .ghcup/bin to PATH for following steps + - name: Ensure ~/.local/bin exists and is in PATH 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: | - if [[ ! -x ~/.ghcup/bin/ghcup ]]; then - 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 + 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 stack --version - - - 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 + $stack setup --install-ghc --verbosity=error - name: Install haskell deps run: | - $stack build --test --only-dependencies --dry-run - $stack build --test --only-dependencies + $stack build --test --only-dependencies --verbosity=error - name: List dep versions run: | @@ -167,7 +152,10 @@ jobs: strip tmp/hledger-ui strip tmp/hledger-web 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-ui --version ./hledger-web --version diff --git a/.github/workflows/binaries-mac-x64.yml b/.github/workflows/binaries-mac-x64.yml index 47e26ac25..4b1804810 100644 --- a/.github/workflows/binaries-mac-x64.yml +++ b/.github/workflows/binaries-mac-x64.yml @@ -30,18 +30,9 @@ jobs: brew install ripgrep tools/checkembeddedfiles - # things to be cached/restored: + # caching - - name: process cache of stack global package db - 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 + - name: process cache of stack-installed ~/.local/bin id: stack-programs uses: actions/cache@v4 with: @@ -50,7 +41,16 @@ jobs: restore-keys: | ${{ 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 with: path: .stack-work @@ -92,35 +92,24 @@ jobs: # actions: - - name: Add .ghcup/bin to PATH for following steps + - name: Ensure ~/.local/bin exists and is in PATH 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 with ghcup if needed + - name: Install haskell tools if needed 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 ~/.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 - #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 - - - 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 + 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 + stack --version + $stack setup --install-ghc --verbosity=error - name: Install haskell deps run: | - $stack build --test --only-dependencies --dry-run - $stack build --test --only-dependencies + $stack build --test --only-dependencies --verbosity=error - - name: List dep versions - run: | - $stack exec -- ghc-pkg list + # - name: List dep versions + # run: | + # $stack exec -- ghc-pkg list - name: Build hledger and test unit tests, doc tests run: | @@ -154,7 +143,10 @@ jobs: strip tmp/hledger-ui strip tmp/hledger-web 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-ui --version ./hledger-web --version diff --git a/.github/workflows/binaries-windows-x64.yml b/.github/workflows/binaries-windows-x64.yml index 96f8c8999..29a22cc98 100644 --- a/.github/workflows/binaries-windows-x64.yml +++ b/.github/workflows/binaries-windows-x64.yml @@ -12,6 +12,9 @@ jobs: defaults: run: shell: bash + env: + # use preinstalled ghc 9.12.2 + stack: stack --system-ghc --no-install-ghc --stack-yaml stack912.yaml steps: - name: Check out @@ -33,7 +36,7 @@ jobs: restore-keys: | ${{ 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 uses: actions/cache@v4 with: @@ -82,51 +85,11 @@ jobs: restore-keys: | ${{ runner.os }}-hledger-web-stack-work - # - name: showStuff - # 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 + # actions - name: Install haskell deps run: | - stack build --test --only-dependencies --dry-run - stack build --test --only-dependencies + $stack build --test --only-dependencies --verbosity=error - name: List dep versions run: | @@ -134,18 +97,8 @@ jobs: - name: Build all hledger modules warning free, optimised and minimised 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" - # --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: