Skip to content

Instantly share code, notes, and snippets.

@storopoli
Created January 31, 2026 20:31
Show Gist options
  • Select an option

  • Save storopoli/a641f0a45fe9b4433200d82d71566f85 to your computer and use it in GitHub Desktop.

Select an option

Save storopoli/a641f0a45fe9b4433200d82d71566f85 to your computer and use it in GitHub Desktop.
Comprehensive Haskell CI
jobs:
tool-output:
runs-on: ubuntu-latest
outputs:
ghc_versions: ${{ steps.gen_output.outputs.ghc_versions }}
steps:
- uses: haskell/ghcup-setup@v1
- name: Generate output
id: gen_output
run: |
all="$(ghcup -s GHCupURL list -r -t ghc -c available)"
rec=$(echo "${all}" | grep recommended | awk '{ print $2 }')
latest=$(echo "${all}" | grep latest | awk '{ print $2 }')
other_major=$(echo "${all}" | awk '{ print $2 }' | awk -F '.' '{ print $1 "." $2}' | sort -Vu | tail -5)
other=$(for v in $other_major ; do point_releases=$(echo "$all" | awk '{ print $2 }' | grep --color=never "^$v.") ; echo "${point_releases}" | tail -n1 ; done)
selected=$(echo -n ${rec} ${latest} ${other} | tr " " "\n" | sort -Vu)
selected_json=$(echo -n $selected | jq -c -r -R 'split(" ") | [ .[] | if length > 0 then . else empty end ]')
echo "${selected}"
echo "${selected_json}"
echo ghc_versions="${selected_json}" >> "$GITHUB_OUTPUT"
build:
runs-on: ${{ matrix.os }}
needs: ["tool-output"]
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, ubuntu-24.04-arm, macOS-15-intel, macOS-latest, windows-latest]
ghc: ${{ fromJSON(needs.tool-output.outputs.ghc_versions) }}
steps:
- uses: actions/checkout@v4
- name: Install dependencies (Ubuntu)
if: runner.os == 'Linux'
run: |
sudo apt-get -y update
sudo apt-get -y install build-essential curl libffi-dev libgmp-dev libncurses-dev pkg-config
- uses: haskell/ghcup-setup@v1
with:
ghc: ${{ matrix.ghc }}
cabal: latest
- name: Build
run: |
cabal update
cabal test --test-show-details=direct all
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment