ci: oldest: build with oldest GHC on push to eponymous branch

and ci: cleanups
This commit is contained in:
Simon Michael 2024-05-17 14:45:59 -10:00
parent 235cb3d8e2
commit 76ce328d5f
2 changed files with 173 additions and 21 deletions

View File

@ -1,10 +1,11 @@
# The main hledger continuous integration test workflow.
# The main hledger continuous integration tests.
# Builds all packages expecting no warnings, runs lots of tests,
# and on success, saves the binaries as an artifact.
# Code must pass this successfully before it can be merged or pushed to master
# (https://github.com/simonmichael/hledger/settings/branch_protection_rules/17386787).
name: ci
on:
# When manually triggered in github ui, it runs in master.
workflow_dispatch:
@ -41,8 +42,9 @@ on:
# - '!**.5'
# - '!**.info'
# - '!**.txt'
jobs:
citest:
ci:
runs-on: ubuntu-24.04
env:
# This workflow uses github's preinstalled ghc & stack on ubuntu.
@ -64,17 +66,19 @@ jobs:
with:
fetch-depth: 0
- name: Print some context for troubleshooting
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: |
echo $GITHUB_CONTEXT
# echo "$GITHUB_SHA"
# echo "$GITHUB_REF"
# echo "$GITHUB_HEAD_REF"
# echo "$GITHUB_BASE_REF"
# git log "$GITHUB_BASE_REF"..
# tools/commitlint "$GITHUB_BASE_REF"..
# - name: Print some context for troubleshooting
# env:
# GITHUB_CONTEXT: ${{ toJson(github) }}
# run: |
# echo $GITHUB_CONTEXT
# # echo "$GITHUB_SHA"
# # echo "$GITHUB_REF"
# # echo "$GITHUB_HEAD_REF"
# # echo "$GITHUB_BASE_REF"
# # git log "$GITHUB_BASE_REF"..
# # tools/commitlint "$GITHUB_BASE_REF"..
# EARLY CHECKS
- name: Check commit messages
# keep this step synced in all workflows which do it
@ -133,7 +137,7 @@ jobs:
tools/checkembeddedfiles
if: env.do-all
# things to be cached/restored:
# CACHES
- name: Uncache stack global package db
id: stack-global
@ -203,7 +207,8 @@ jobs:
${{ runner.os }}-hledger-web-stack-work-$ghc
if: env.do-all
# actions:
# ACTIONS
# one step at a time for faster & more focussed failures
# - name: Set up stack
# run: |
@ -225,15 +230,26 @@ jobs:
$stack build --test --bench --only-dependencies
if: env.do-all
# Packages are built one at a time to fail faster on error.
# Takes ~2m on a 2023 github worker.
- name: Build all hledger modules fast, warning free, run unit/doc/bench tests
# These take ~2m on a 2023 github worker.
- name: Build/test hledger-lib
run: |
$stack install --fast --ghc-options=-Werror --test --bench hledger-lib
if: env.do-all
- name: Build/test hledger
run: |
$stack install --fast --ghc-options=-Werror --test --bench hledger
if: env.do-all
- name: Build/test hledger-ui
run: |
$stack install --fast --ghc-options=-Werror --test --bench hledger-ui
if: env.do-all
- name: Build/test hledger-web
run: |
$stack install --fast --ghc-options=-Werror --test --bench hledger-web
# --ghc-options=-split-sections --no-terminal
if: env.do-all
- name: Install shelltestrunner
@ -264,6 +280,8 @@ jobs:
# # --no-print-missing-docs is 600% quieter
# if: env.do-all
# ARTIFACTS
- name: Gather binaries
id: exes
run: |
@ -281,7 +299,7 @@ jobs:
# upload-artifact loses execute permissions, so we tar the binaries to preserve them.
# github UI always zips artifacts when they are downloaded, so we don't bother compressing the tar.
# Unfortunately it means users must both unzip and untar.
- name: Upload binaries artifact
- name: Upload binaries
uses: actions/upload-artifact@v4
with:
name: hledger-linux-x64
@ -290,7 +308,7 @@ jobs:
# snippets
# SNIPPETS
# how to set a context variable, and an attempt to make a nice artifact version suffix:
# echo "::set-output name=version::$(git branch --show-current | sed 's/-.*//')-$(git rev-parse --short HEAD)"

134
.github/workflows/oldest.yml vendored Normal file
View File

@ -0,0 +1,134 @@
# Test that hledger still builds with the oldest supported GHC version.
name: oldest
on:
# When there's a push to the oldest branch, it runs in that branch.
push:
branches: [ oldest ]
# If manually triggered in github ui, it runs in master.
workflow_dispatch:
jobs:
oldest:
runs-on: ubuntu-24.04
env:
# This workflow uses github's preinstalled ghc & stack on ubuntu.
# Keep these synced with the latest ghc version at https://github.com/actions/runner-images/blob/ubuntu22/20240514.2/images/ubuntu/Ubuntu2404-Readme.md#haskell-tools
#
# caching id for this ghc's build artifacts:
ghc: 8107
# stack config for this ghc:
stack: stack --stack-yaml=stack8.10.yaml
steps:
- name: Check out
uses: actions/checkout@v4
# have to fetch everything for git describe for hledger's --version
with:
fetch-depth: 0
# CACHES
- name: Uncache stack global package db
id: stack-global
uses: actions/cache@v4
with:
path: ~/.stack
# XXX if stack.yaml is a symlink, this fails with
# Error: The template is not valid. .github/workflows/push.yml (Line: 103, Col: 14): hashFiles('**.yaml') failed.
# Fail to hash files under directory '/home/runner/work/hledger/hledger'
key: ${{ runner.os }}-stack-global-$ghc-${{ hashFiles('**.yaml') }}
restore-keys: |
${{ runner.os }}-stack-global-$ghc
- name: Uncache stack-installed programs in ~/.local/bin
id: stack-programs
uses: actions/cache@v4
with:
path: ~/.local/bin
key: ${{ runner.os }}-stack-programs-$ghc-${{ hashFiles('**.yaml') }}
restore-keys: |
${{ runner.os }}-stack-programs-$ghc
- name: Uncache .stack-work
uses: actions/cache@v4
with:
path: .stack-work
key: ${{ runner.os }}-stack-work-$ghc-${{ hashFiles('**.yaml') }}
restore-keys: |
${{ runner.os }}-stack-work-$ghc
- name: Uncache hledger-lib/.stack-work
uses: actions/cache@v4
with:
path: hledger-lib/.stack-work
key: ${{ runner.os }}-hledger-lib-stack-work-$ghc-${{ hashFiles('hledger-lib/package.yaml') }}
restore-keys: |
${{ runner.os }}-hledger-lib-stack-work-$ghc
- name: Uncache hledger/.stack-work
uses: actions/cache@v4
with:
path: hledger/.stack-work
key: ${{ runner.os }}-hledger-stack-work-$ghc-${{ hashFiles('hledger/package.yaml') }}
restore-keys: |
${{ runner.os }}-hledger-stack-work-$ghc
- name: Uncache hledger-ui/.stack-work
uses: actions/cache@v4
with:
path: hledger-ui/.stack-work
key: ${{ runner.os }}-hledger-ui-stack-work-$ghc-${{ hashFiles('hledger-ui/package.yaml') }}
restore-keys: |
${{ runner.os }}-hledger-ui-stack-work-$ghc
- name: Uncache hledger-web/.stack-work
uses: actions/cache@v4
with:
path: hledger-web/.stack-work
key: ${{ runner.os }}-hledger-web-stack-work-$ghc-${{ hashFiles('hledger-web/package.yaml') }}
restore-keys: |
${{ runner.os }}-hledger-web-stack-work-$ghc
# ACTIONS
# one step at a time for faster & more focussed failures
- name: Install old GHC
run: |
$stack setup --install-ghc
- name: Install haskell deps
run: |
$stack build --test --bench --only-dependencies
- name: Build/test hledger-lib
run: |
$stack install --fast --ghc-options=-Werror --test --bench hledger-lib
- name: Build/test hledger
run: |
$stack install --fast --ghc-options=-Werror --test --bench hledger
- name: Build/test hledger-ui
run: |
$stack install --fast --ghc-options=-Werror --test --bench hledger-ui
- name: Build/test hledger-webb
run: |
$stack install --fast --ghc-options=-Werror --test --bench hledger-web
- name: Install shelltestrunner
run: |
export PATH=~/.local/bin:$PATH
if [[ ! -x ~/.local/bin/shelltest ]]; then $stack install shelltestrunner-1.10; fi
shelltest --version
if: env.do-all
- name: Test functional tests (excluding addons)
run: |
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
# XXX run the bin/ func tests corresponding to the GHC version enabled above, only
if: env.do-all