Skip to content

Commit b88691f

Browse files
committed
Dynamic CI
1 parent 71f3739 commit b88691f

1 file changed

Lines changed: 54 additions & 40 deletions

File tree

.github/workflows/ci.yml

Lines changed: 54 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,55 @@ defaults:
1010
shell: bash
1111

1212
jobs:
13+
tool-output:
14+
runs-on: ubuntu-latest
15+
outputs:
16+
ghc_versions: ${{ steps.gen_output.outputs.ghc_versions }}
17+
18+
steps:
19+
20+
- uses: haskell/ghcup-setup@v1
21+
22+
- name: Generate output
23+
id: gen_output
24+
run: |
25+
echo "${GHC_TEST_NUM}"
26+
echo "${GHC_EXCLUDE}"
27+
28+
all="$(ghcup -s GHCupURL list -r -t ghc -c available)"
29+
rec=$(echo "${all}" | grep recommended | awk '{ print $2 }')
30+
latest=$(echo "${all}" | grep latest | awk '{ print $2 }')
31+
32+
other_major=$(echo "${all}" | awk '{ print $2 }' | awk -F '.' '{ print $1 "." $2}' | sort -Vu | tail -${GHC_TEST_NUM:=5})
33+
other=$(for v in $other_major ; do point_releases=$(echo "$all" | awk '{ print $2 }' | grep --color=never "^$v.") ; echo "${point_releases}" | tail -n1 ; done)
34+
35+
selected=$(echo -n ${rec} ${latest} ${other} | tr " " "\n" | sort -Vu)
36+
ghc_exclude=( $GHC_EXCLUDE )
37+
selected_filtered=()
38+
for ghc in $selected ; do
39+
printf '%s\0' "${ghc_exclude[@]}" | grep --quiet --color=never -F -x -z -- $ghc || selected_filtered+=( $ghc )
40+
done
41+
unset ghc
42+
selected_json=$(echo -n ${selected_filtered[@]} | jq -c -r -R 'split(" ") | [ .[] | if length > 0 then . else empty end ]')
43+
44+
echo "${selected}"
45+
echo "${selected_filtered}"
46+
echo "${selected_json}"
47+
48+
echo ghc_versions="${selected_json}" >> "$GITHUB_OUTPUT"
49+
shell: bash
50+
env:
51+
GHC_TEST_NUM: ${{ vars.GHC_TEST_NUM }}
52+
GHC_EXCLUDE: ${{ vars.GHC_EXCLUDE }}
53+
1354
build:
1455
runs-on: ${{ matrix.os }}
56+
needs: ["tool-output"]
1557
strategy:
1658
fail-fast: true
1759
matrix:
18-
os: [ubuntu-24.04, macOS-latest]
19-
ghc: ['9.14', '9.12', '9.10', '9.8', '9.6', '9.4', '9.2', '9.0', '8.10', '8.8', '8.6']
20-
exclude:
21-
- os: macos-latest
22-
ghc: '9.0'
23-
- os: macos-latest
24-
ghc: '8.10'
25-
- os: macos-latest
26-
ghc: '8.8'
27-
- os: macos-latest
28-
ghc: '8.6'
60+
os: [ubuntu-latest, ubuntu-24.04-arm, macOS-15-intel, macOS-latest]
61+
ghc: ${{ fromJSON(needs.tool-output.outputs.ghc_versions) }}
2962
steps:
3063
- uses: actions/checkout@v4
3164

@@ -35,6 +68,12 @@ jobs:
3568
ghc: ${{ matrix.ghc }}
3669
cabal: latest
3770

71+
- name: Install dependencies (Ubuntu)
72+
if: runner.os == 'Linux'
73+
run: |
74+
sudo apt-get -y update
75+
sudo apt-get -y install build-essential curl libffi-dev libgmp-dev libncurses-dev pkg-config
76+
3877
- if: runner.os == 'macOS'
3978
name: Install system deps via brew
4079
run: brew install coreutils autoconf automake
@@ -47,6 +86,7 @@ jobs:
4786
dist-newstyle
4887
key: ${{ runner.os }}-${{ matrix.ghc }}-${{ github.sha }}
4988
restore-keys: ${{ runner.os }}-${{ matrix.ghc }}-
89+
5090
- name: Build
5191
run: |
5292
ghc --version
@@ -58,6 +98,7 @@ jobs:
5898
cabal get unix-*.tar.gz
5999
cd unix-*/
60100
cabal test -f+non-portable-tests all --test-show-details=direct
101+
61102
- name: Haddock
62103
run: |
63104
cabal haddock --disable-documentation
@@ -123,43 +164,16 @@ jobs:
123164
with:
124165
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"
125166

126-
arm:
127-
runs-on: [self-hosted, Linux, ARM64]
128-
strategy:
129-
fail-fast: false
130-
matrix:
131-
arch: [arm32v7, arm64v8]
132-
steps:
133-
- uses: docker://hasufell/arm64v8-ubuntu-haskell:focal
134-
name: Cleanup
135-
with:
136-
args: "find . -mindepth 1 -maxdepth 1 -exec rm -rf -- {} +"
137-
138-
- name: Checkout code
139-
uses: actions/checkout@v4
140-
141-
- if: matrix.arch == 'arm32v7'
142-
uses: docker://hasufell/arm32v7-ubuntu-haskell:focal
143-
name: Run build (arm32v7 linux)
144-
with:
145-
args: sh -c "cabal update && autoreconf -i && cabal test all --test-show-details=direct"
146-
147-
- if: matrix.arch == 'arm64v8'
148-
uses: docker://hasufell/arm64v8-ubuntu-haskell:focal
149-
name: Run build (arm64v8 linux)
150-
with:
151-
args: sh -c "cabal update && autoreconf -i && cabal test all --test-show-details=direct"
152-
153167
freebsd:
154168
runs-on: ${{ matrix.os }}
155169
strategy:
156170
fail-fast: false
157171
matrix:
158172
include:
159-
- os: [self-hosted, FreeBSD, X64]
160-
ghc: 9.4
161173
- os: [self-hosted, FreeBSD, X64]
162174
ghc: 9.6
175+
- os: [self-hosted, FreeBSD, X64]
176+
ghc: 9.14
163177
steps:
164178
- name: Checkout code
165179
uses: actions/checkout@v4

0 commit comments

Comments
 (0)