Haskell CI #385
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Haskell CI | |
| on: | |
| push: | |
| branches: [ master ] | |
| pull_request: | |
| branches: [ master ] | |
| schedule: | |
| - cron: '0 0 * * *' | |
| 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 -${GHC_TEST_NUM:=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) | |
| ghc_exclude=( $GHC_EXCLUDE ) | |
| selected_filtered=() | |
| for ghc in $selected ; do | |
| printf '%s\0' "${ghc_exclude[@]}" | grep --quiet --color=never -F -x -z -- $ghc || selected_filtered+=( $ghc ) | |
| done | |
| unset ghc | |
| selected_json=$(echo -n ${selected_filtered[@]} | jq -c -r -R 'split(" ") | [ .[] | if length > 0 then . else empty end ]') | |
| echo "${selected}" | |
| echo "${selected_filtered}" | |
| echo "${selected_json}" | |
| echo ghc_versions="${selected_json}" >> "$GITHUB_OUTPUT" | |
| shell: bash | |
| env: | |
| GHC_TEST_NUM: ${{ vars.GHC_TEST_NUM }} | |
| GHC_EXCLUDE: ${{ vars.GHC_EXCLUDE }} | |
| 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 libffi8 libgmp-dev libgmp10 libncurses-dev pkg-config libtinfo6 libncurses6 | |
| - uses: haskell/ghcup-setup@v1 | |
| with: | |
| ghc: ${{ matrix.ghc }} | |
| cabal: latest | |
| - name: Build | |
| run: | | |
| set -eux | |
| cabal update | |
| cabal build --enable-tests --enable-benchmarks | |
| cabal test --test-show-details=direct filepath-tests | |
| cabal test --test-show-details=direct --test-options='--quickcheck-tests 50_000' filepath-equivalent-tests | |
| cabal test --test-show-details=direct abstract-filepath | |
| cabal haddock | |
| cabal check | |
| cabal sdist | |
| shell: bash | |
| - if: runner.os == 'Linux' | |
| run: cabal bench | |
| - if: runner.os == 'Linux' | |
| name: make all | |
| run: | | |
| set -eux | |
| export "PATH=$HOME/.cabal/bin:$PATH" | |
| cabal install --overwrite-policy=always --install-method=copy cpphs | |
| make all | |
| git diff --exit-code | |
| i386: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Run build (32 bit linux) | |
| uses: docker://hasufell/i386-alpine-haskell:3.12 | |
| with: | |
| args: sh -c "cabal update && cabal test" | |
| freebsd: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: [self-hosted, FreeBSD, X64] | |
| ghc: 9.4.8 | |
| - os: [self-hosted, FreeBSD, X64] | |
| ghc: 9.6.4 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install prerequisites | |
| run: | | |
| sudo pkg install -y curl gcc gmp gmake ncurses perl5 libffi libiconv git bash misc/compat10x misc/compat11x misc/compat12x gmake llvm14 | |
| - uses: haskell/ghcup-setup@v1 | |
| with: | |
| ghc: ${{ matrix.ghc }} | |
| cabal: latest | |
| - name: Run build | |
| run: | | |
| cabal update | |
| cabal test | |
| cabal bench |