Skip to content

ci

ci #1642

Workflow file for this run

name: ci
on:
push:
pull_request:
schedule:
- cron: 0 0 * * *
defaults:
run:
shell: bash
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: |
echo "${GHC_TEST_NUM}"
echo "${GHC_EXCLUDE}"
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: true
matrix:
os: [ubuntu-latest, ubuntu-24.04-arm, macOS-15-intel, macOS-latest]
ghc: ${{ fromJSON(needs.tool-output.outputs.ghc_versions) }}
steps:
- uses: actions/checkout@v4
- name: Install GHCup
uses: haskell/ghcup-setup@v1
with:
ghc: ${{ matrix.ghc }}
cabal: latest
- 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
- if: runner.os == 'macOS'
name: Install system deps via brew
run: brew install coreutils autoconf automake
- uses: actions/cache@v4
name: Cache cabal stuff
with:
path: |
~/.cabal/store
dist-newstyle
key: ${{ runner.os }}-${{ matrix.ghc }}-${{ github.sha }}
restore-keys: ${{ runner.os }}-${{ matrix.ghc }}-
- name: Build
run: |
ghc --version
cabal --version
cabal update
autoreconf --version
autoreconf -i
cabal sdist -z -o .
cabal get unix-*.tar.gz
cd unix-*/
cabal test -f+non-portable-tests all --test-show-details=direct
- name: Haddock
run: |
cabal haddock --disable-documentation
redhat-ubi9:
runs-on: ubuntu-24.04
container:
image: redhat/ubi9:latest
steps:
- name: Install prerequisites
run: |
yum install -y gcc gmp gmp-devel make ncurses xz perl autoconf
- name: Install GHCup
uses: haskell/ghcup-setup@v1
with:
ghc: latest
cabal: latest
- uses: actions/checkout@v4
- name: Test
run: |
cabal --version
cabal update
autoreconf --version
autoreconf -i
cabal test -f+non-portable-tests --allow-newer='splitmix:base' all --test-show-details=direct
fedora37:
runs-on: ubuntu-latest
container:
image: fedora:37
steps:
- name: Install prerequisites
run: |
dnf install -y gcc gmp gmp-devel make ncurses ncurses-compat-libs xz perl autoconf
- name: Install GHCup
uses: haskell/ghcup-setup@v1
with:
ghc: latest
cabal: latest
- uses: actions/checkout@v4
- name: Test
run: |
cabal --version
cabal update
autoreconf --version
autoreconf -i
# test filepath >= 1.5
cabal test -f+non-portable-tests --constraint='filepath >= 1.5.0.0' --allow-newer='splitmix:base' all --test-show-details=direct
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 "apk update && apk add --no-cache autoconf automake make && cabal update && autoreconf --version && autoreconf -i && cabal v2-test --constraint 'optparse-applicative -process' --constraint 'QuickCheck +old-random' --constraint 'tasty -unix' all"
freebsd:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: [self-hosted, FreeBSD, X64]
ghc: 9.6
- os: [self-hosted, FreeBSD, X64]
ghc: 9.14
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 autoconf
- name: Install GHCup
uses: haskell/ghcup-setup@v1
with:
ghc: ${{ matrix.ghc }}
cabal: latest
- name: Run build
run: |
autoreconf --version
autoreconf -i
cabal update
cabal sdist -z -o .
cabal get unix-*.tar.gz
cd unix-*/
cabal test -f+non-portable-tests all --test-show-details=direct