Skip to content

Commit 6497587

Browse files
authored
Merge pull request #10 from qfpl/new-ci
ci: Move off haskell-ci
2 parents 66f3981 + 1d6ee89 commit 6497587

File tree

1 file changed

+45
-246
lines changed

1 file changed

+45
-246
lines changed

.github/workflows/haskell-ci.yml

Lines changed: 45 additions & 246 deletions
Original file line numberDiff line numberDiff line change
@@ -1,256 +1,55 @@
1-
# This GitHub workflow config has been generated by a script via
2-
#
3-
# haskell-ci 'github' 'ban-instance.cabal'
4-
#
5-
# To regenerate the script (for example after adjusting tested-with) run
6-
#
7-
# haskell-ci regenerate
8-
#
9-
# For more information, see https://github.com/haskell-CI/haskell-ci
10-
#
11-
# version: 0.19.20250605
12-
#
13-
# REGENDATA ("0.19.20250605",["github","ban-instance.cabal"])
14-
#
15-
name: Haskell-CI
1+
name: CI
162
on:
173
- push
184
- pull_request
5+
196
jobs:
20-
linux:
21-
name: Haskell-CI - Linux - ${{ matrix.compiler }}
7+
generate-matrix:
8+
name: Generate matrix
229
runs-on: ubuntu-24.04
23-
timeout-minutes:
24-
60
25-
container:
26-
image: buildpack-deps:jammy
27-
continue-on-error: ${{ matrix.allow-failure }}
10+
outputs:
11+
matrix: ${{ steps.set-matrix.outputs.matrix }}
12+
steps:
13+
- id: set-matrix
14+
uses: kleidukos/get-tested@v0.1.9.1
15+
with:
16+
cabal-file: ban-instance.cabal
17+
ubuntu-version: '24.04'
18+
19+
build:
20+
name: GHC ${{ matrix.ghc }} on ${{ matrix.os }}
21+
needs: generate-matrix
22+
runs-on: ${{ matrix.os }}
2823
strategy:
29-
matrix:
30-
include:
31-
- compiler: ghc-9.12.2
32-
compilerKind: ghc
33-
compilerVersion: 9.12.2
34-
setup-method: ghcup
35-
allow-failure: false
36-
- compiler: ghc-9.10.2
37-
compilerKind: ghc
38-
compilerVersion: 9.10.2
39-
setup-method: ghcup
40-
allow-failure: false
41-
- compiler: ghc-9.8.2
42-
compilerKind: ghc
43-
compilerVersion: 9.8.2
44-
setup-method: ghcup
45-
allow-failure: false
46-
- compiler: ghc-9.6.5
47-
compilerKind: ghc
48-
compilerVersion: 9.6.5
49-
setup-method: ghcup
50-
allow-failure: false
51-
- compiler: ghc-9.4.5
52-
compilerKind: ghc
53-
compilerVersion: 9.4.5
54-
setup-method: ghcup
55-
allow-failure: false
56-
- compiler: ghc-9.2.7
57-
compilerKind: ghc
58-
compilerVersion: 9.2.7
59-
setup-method: ghcup
60-
allow-failure: false
61-
- compiler: ghc-9.0.1
62-
compilerKind: ghc
63-
compilerVersion: 9.0.1
64-
setup-method: ghcup
65-
allow-failure: false
66-
- compiler: ghc-8.10.7
67-
compilerKind: ghc
68-
compilerVersion: 8.10.7
69-
setup-method: ghcup
70-
allow-failure: false
71-
- compiler: ghc-8.8.1
72-
compilerKind: ghc
73-
compilerVersion: 8.8.1
74-
setup-method: ghcup
75-
allow-failure: false
76-
- compiler: ghc-8.6.5
77-
compilerKind: ghc
78-
compilerVersion: 8.6.5
79-
setup-method: ghcup
80-
allow-failure: false
81-
- compiler: ghc-8.4.4
82-
compilerKind: ghc
83-
compilerVersion: 8.4.4
84-
setup-method: ghcup
85-
allow-failure: false
86-
- compiler: ghc-8.2.2
87-
compilerKind: ghc
88-
compilerVersion: 8.2.2
89-
setup-method: ghcup
90-
allow-failure: false
91-
- compiler: ghc-8.0.2
92-
compilerKind: ghc
93-
compilerVersion: 8.0.2
94-
setup-method: ghcup
95-
allow-failure: false
96-
fail-fast: false
24+
matrix: ${{ fromJSON(needs.generate-matrix.outputs.matrix) }}
9725
steps:
98-
- name: apt-get install
99-
run: |
100-
apt-get update
101-
apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common libtinfo5 libnuma-dev
102-
- name: Install GHCup
103-
run: |
104-
mkdir -p "$HOME/.ghcup/bin"
105-
curl -sL https://downloads.haskell.org/ghcup/0.1.50.1/x86_64-linux-ghcup-0.1.50.1 > "$HOME/.ghcup/bin/ghcup"
106-
chmod a+x "$HOME/.ghcup/bin/ghcup"
107-
- name: Install cabal-install
108-
run: |
109-
"$HOME/.ghcup/bin/ghcup" install cabal 3.14.2.0 || (cat "$HOME"/.ghcup/logs/*.* && false)
110-
echo "CABAL=$HOME/.ghcup/bin/cabal-3.14.2.0 -vnormal+nowrap" >> "$GITHUB_ENV"
111-
- name: Install GHC (GHCup)
112-
if: matrix.setup-method == 'ghcup'
113-
run: |
114-
"$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false)
115-
HC=$("$HOME/.ghcup/bin/ghcup" whereis ghc "$HCVER")
116-
HCPKG=$(echo "$HC" | sed 's#ghc$#ghc-pkg#')
117-
HADDOCK=$(echo "$HC" | sed 's#ghc$#haddock#')
118-
echo "HC=$HC" >> "$GITHUB_ENV"
119-
echo "HCPKG=$HCPKG" >> "$GITHUB_ENV"
120-
echo "HADDOCK=$HADDOCK" >> "$GITHUB_ENV"
121-
env:
122-
HCKIND: ${{ matrix.compilerKind }}
123-
HCNAME: ${{ matrix.compiler }}
124-
HCVER: ${{ matrix.compilerVersion }}
125-
- name: Set PATH and environment variables
126-
run: |
127-
echo "$HOME/.cabal/bin" >> $GITHUB_PATH
128-
echo "LANG=C.UTF-8" >> "$GITHUB_ENV"
129-
echo "CABAL_DIR=$HOME/.cabal" >> "$GITHUB_ENV"
130-
echo "CABAL_CONFIG=$HOME/.cabal/config" >> "$GITHUB_ENV"
131-
HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\d+)\.(\d+)\.(\d+)(\.(\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))')
132-
echo "HCNUMVER=$HCNUMVER" >> "$GITHUB_ENV"
133-
echo "ARG_TESTS=--enable-tests" >> "$GITHUB_ENV"
134-
echo "ARG_BENCH=--enable-benchmarks" >> "$GITHUB_ENV"
135-
echo "HEADHACKAGE=false" >> "$GITHUB_ENV"
136-
echo "ARG_COMPILER=--$HCKIND --with-compiler=$HC" >> "$GITHUB_ENV"
137-
env:
138-
HCKIND: ${{ matrix.compilerKind }}
139-
HCNAME: ${{ matrix.compiler }}
140-
HCVER: ${{ matrix.compilerVersion }}
141-
- name: env
142-
run: |
143-
env
144-
- name: write cabal config
145-
run: |
146-
mkdir -p $CABAL_DIR
147-
cat >> $CABAL_CONFIG <<EOF
148-
remote-build-reporting: anonymous
149-
write-ghc-environment-files: never
150-
remote-repo-cache: $CABAL_DIR/packages
151-
logs-dir: $CABAL_DIR/logs
152-
world-file: $CABAL_DIR/world
153-
extra-prog-path: $CABAL_DIR/bin
154-
symlink-bindir: $CABAL_DIR/bin
155-
installdir: $CABAL_DIR/bin
156-
build-summary: $CABAL_DIR/logs/build.log
157-
store-dir: $CABAL_DIR/store
158-
install-dirs user
159-
prefix: $CABAL_DIR
160-
repository hackage.haskell.org
161-
url: http://hackage.haskell.org/
162-
EOF
163-
cat >> $CABAL_CONFIG <<EOF
164-
program-default-options
165-
ghc-options: $GHCJOBS +RTS -M3G -RTS
166-
EOF
167-
cat $CABAL_CONFIG
168-
- name: versions
169-
run: |
170-
$HC --version || true
171-
$HC --print-project-git-commit-id || true
172-
$CABAL --version || true
173-
- name: update cabal index
174-
run: |
175-
$CABAL v2-update -v
176-
- name: install cabal-plan
177-
run: |
178-
mkdir -p $HOME/.cabal/bin
179-
curl -sL https://github.com/haskell-hvr/cabal-plan/releases/download/v0.7.3.0/cabal-plan-0.7.3.0-x86_64-linux.xz > cabal-plan.xz
180-
echo 'f62ccb2971567a5f638f2005ad3173dba14693a45154c1508645c52289714cb2 cabal-plan.xz' | sha256sum -c -
181-
xz -d < cabal-plan.xz > $HOME/.cabal/bin/cabal-plan
182-
rm -f cabal-plan.xz
183-
chmod a+x $HOME/.cabal/bin/cabal-plan
184-
cabal-plan --version
185-
- name: checkout
186-
uses: actions/checkout@v4
26+
- uses: actions/checkout@v6
27+
28+
- uses: haskell-actions/setup@v2
29+
id: setup
18730
with:
188-
path: source
189-
- name: initial cabal.project for sdist
190-
run: |
191-
touch cabal.project
192-
echo "packages: $GITHUB_WORKSPACE/source/." >> cabal.project
193-
cat cabal.project
194-
- name: sdist
195-
run: |
196-
mkdir -p sdist
197-
$CABAL sdist all --output-dir $GITHUB_WORKSPACE/sdist
198-
- name: unpack
199-
run: |
200-
mkdir -p unpacked
201-
find sdist -maxdepth 1 -type f -name '*.tar.gz' -exec tar -C $GITHUB_WORKSPACE/unpacked -xzvf {} \;
202-
- name: generate cabal.project
203-
run: |
204-
PKGDIR_ban_instance="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/ban-instance-[0-9.]*')"
205-
echo "PKGDIR_ban_instance=${PKGDIR_ban_instance}" >> "$GITHUB_ENV"
206-
rm -f cabal.project cabal.project.local
207-
touch cabal.project
208-
touch cabal.project.local
209-
echo "packages: ${PKGDIR_ban_instance}" >> cabal.project
210-
if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo "package ban-instance" >> cabal.project ; fi
211-
if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi
212-
cat >> cabal.project <<EOF
31+
ghc-version: ${{ matrix.ghc }}
32+
cabal-version: 'latest'
33+
34+
- name: Write cabal.project
35+
run: |
36+
cat > cabal.project <<EOF
37+
packages: .
38+
documentation: True
39+
tests: True
21340
EOF
214-
$HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: any.$_ installed\n" unless /^(ban-instance)$/; }' >> cabal.project.local
215-
cat cabal.project
216-
cat cabal.project.local
217-
- name: dump install plan
218-
run: |
219-
$CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dry-run all
220-
cabal-plan
221-
- name: restore cache
222-
uses: actions/cache/restore@v4
223-
with:
224-
key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }}
225-
path: ~/.cabal/store
226-
restore-keys: ${{ runner.os }}-${{ matrix.compiler }}-
227-
- name: install dependencies
228-
run: |
229-
$CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --dependencies-only -j2 all
230-
$CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dependencies-only -j2 all
231-
- name: build w/o tests
232-
run: |
233-
$CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all
234-
- name: build
235-
run: |
236-
$CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --write-ghc-environment-files=always
237-
- name: tests
238-
run: |
239-
$CABAL v2-test $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --test-show-details=direct
240-
- name: cabal check
241-
run: |
242-
cd ${PKGDIR_ban_instance} || false
243-
${CABAL} -vnormal check
244-
- name: haddock
245-
run: |
246-
$CABAL v2-haddock --disable-documentation --haddock-all $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH all
247-
- name: unconstrained build
248-
run: |
249-
rm -f cabal.project.local
250-
$CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all
251-
- name: save cache
252-
if: always()
253-
uses: actions/cache/save@v4
41+
42+
- run: cabal update
43+
- run: cabal freeze
44+
45+
- uses: actions/cache@v5
25446
with:
255-
key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }}
256-
path: ~/.cabal/store
47+
path: ${{ steps.setup.outputs.cabal-store }}
48+
key: ${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('cabal.project.freeze') }}
49+
restore-keys: ${{ runner.os }}-${{ matrix.ghc }}-
50+
51+
- run: cabal build all
52+
- run: cabal test all --test-show-details=direct
53+
- run: cabal haddock all
54+
- run: cabal check
55+
- run: cabal sdist

0 commit comments

Comments
 (0)