Skip to content

Commit 86537e9

Browse files
committed
Add Haskell-CI
1 parent 8593706 commit 86537e9

File tree

2 files changed

+243
-0
lines changed

2 files changed

+243
-0
lines changed

Diff for: .github/workflows/haskell-ci.yml

+230
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,230 @@
1+
# This GitHub workflow config has been generated by a script via
2+
#
3+
# haskell-ci 'github' 'cabal.project'
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/andreasabel/haskell-ci
10+
#
11+
# version: 0.19.20241021
12+
#
13+
# REGENDATA ("0.19.20241021",["github","cabal.project"])
14+
#
15+
name: Haskell-CI
16+
on:
17+
push:
18+
branches:
19+
- master
20+
pull_request:
21+
branches:
22+
- master
23+
jobs:
24+
linux:
25+
name: Haskell-CI - Linux - ${{ matrix.compiler }}
26+
runs-on: ubuntu-20.04
27+
timeout-minutes:
28+
60
29+
container:
30+
image: buildpack-deps:jammy
31+
continue-on-error: ${{ matrix.allow-failure }}
32+
strategy:
33+
matrix:
34+
include:
35+
- compiler: ghc-9.10.1
36+
compilerKind: ghc
37+
compilerVersion: 9.10.1
38+
setup-method: ghcup
39+
allow-failure: false
40+
- compiler: ghc-9.8.2
41+
compilerKind: ghc
42+
compilerVersion: 9.8.2
43+
setup-method: ghcup
44+
allow-failure: false
45+
- compiler: ghc-9.6.6
46+
compilerKind: ghc
47+
compilerVersion: 9.6.6
48+
setup-method: ghcup
49+
allow-failure: false
50+
- compiler: ghc-9.4.8
51+
compilerKind: ghc
52+
compilerVersion: 9.4.8
53+
setup-method: ghcup
54+
allow-failure: false
55+
- compiler: ghc-9.2.8
56+
compilerKind: ghc
57+
compilerVersion: 9.2.8
58+
setup-method: ghcup
59+
allow-failure: false
60+
- compiler: ghc-9.0.2
61+
compilerKind: ghc
62+
compilerVersion: 9.0.2
63+
setup-method: ghcup
64+
allow-failure: false
65+
- compiler: ghc-8.10.7
66+
compilerKind: ghc
67+
compilerVersion: 8.10.7
68+
setup-method: ghcup
69+
allow-failure: false
70+
- compiler: ghc-8.8.4
71+
compilerKind: ghc
72+
compilerVersion: 8.8.4
73+
setup-method: ghcup
74+
allow-failure: false
75+
- compiler: ghc-8.6.5
76+
compilerKind: ghc
77+
compilerVersion: 8.6.5
78+
setup-method: ghcup
79+
allow-failure: false
80+
fail-fast: false
81+
steps:
82+
- name: apt
83+
run: |
84+
apt-get update
85+
apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common libtinfo5
86+
mkdir -p "$HOME/.ghcup/bin"
87+
curl -sL https://downloads.haskell.org/ghcup/0.1.30.0/x86_64-linux-ghcup-0.1.30.0 > "$HOME/.ghcup/bin/ghcup"
88+
chmod a+x "$HOME/.ghcup/bin/ghcup"
89+
"$HOME/.ghcup/bin/ghcup" config add-release-channel https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-prereleases-0.0.8.yaml;
90+
"$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false)
91+
"$HOME/.ghcup/bin/ghcup" install cabal 3.12.1.0 || (cat "$HOME"/.ghcup/logs/*.* && false)
92+
env:
93+
HCKIND: ${{ matrix.compilerKind }}
94+
HCNAME: ${{ matrix.compiler }}
95+
HCVER: ${{ matrix.compilerVersion }}
96+
- name: Set PATH and environment variables
97+
run: |
98+
echo "$HOME/.cabal/bin" >> $GITHUB_PATH
99+
echo "LANG=C.UTF-8" >> "$GITHUB_ENV"
100+
echo "CABAL_DIR=$HOME/.cabal" >> "$GITHUB_ENV"
101+
echo "CABAL_CONFIG=$HOME/.cabal/config" >> "$GITHUB_ENV"
102+
HCDIR=/opt/$HCKIND/$HCVER
103+
HC=$("$HOME/.ghcup/bin/ghcup" whereis ghc "$HCVER")
104+
HCPKG=$(echo "$HC" | sed 's#ghc$#ghc-pkg#')
105+
HADDOCK=$(echo "$HC" | sed 's#ghc$#haddock#')
106+
echo "HC=$HC" >> "$GITHUB_ENV"
107+
echo "HCPKG=$HCPKG" >> "$GITHUB_ENV"
108+
echo "HADDOCK=$HADDOCK" >> "$GITHUB_ENV"
109+
echo "CABAL=$HOME/.ghcup/bin/cabal-3.12.1.0 -vnormal+nowrap" >> "$GITHUB_ENV"
110+
HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\d+)\.(\d+)\.(\d+)(\.(\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))')
111+
echo "HCNUMVER=$HCNUMVER" >> "$GITHUB_ENV"
112+
echo "ARG_TESTS=--enable-tests" >> "$GITHUB_ENV"
113+
echo "ARG_BENCH=--enable-benchmarks" >> "$GITHUB_ENV"
114+
echo "HEADHACKAGE=false" >> "$GITHUB_ENV"
115+
echo "ARG_COMPILER=--$HCKIND --with-compiler=$HC" >> "$GITHUB_ENV"
116+
echo "GHCJSARITH=0" >> "$GITHUB_ENV"
117+
env:
118+
HCKIND: ${{ matrix.compilerKind }}
119+
HCNAME: ${{ matrix.compiler }}
120+
HCVER: ${{ matrix.compilerVersion }}
121+
- name: env
122+
run: |
123+
env
124+
- name: write cabal config
125+
run: |
126+
mkdir -p $CABAL_DIR
127+
cat >> $CABAL_CONFIG <<EOF
128+
remote-build-reporting: anonymous
129+
write-ghc-environment-files: never
130+
remote-repo-cache: $CABAL_DIR/packages
131+
logs-dir: $CABAL_DIR/logs
132+
world-file: $CABAL_DIR/world
133+
extra-prog-path: $CABAL_DIR/bin
134+
symlink-bindir: $CABAL_DIR/bin
135+
installdir: $CABAL_DIR/bin
136+
build-summary: $CABAL_DIR/logs/build.log
137+
store-dir: $CABAL_DIR/store
138+
install-dirs user
139+
prefix: $CABAL_DIR
140+
repository hackage.haskell.org
141+
url: http://hackage.haskell.org/
142+
EOF
143+
cat >> $CABAL_CONFIG <<EOF
144+
program-default-options
145+
ghc-options: $GHCJOBS +RTS -M3G -RTS
146+
EOF
147+
cat $CABAL_CONFIG
148+
- name: versions
149+
run: |
150+
$HC --version || true
151+
$HC --print-project-git-commit-id || true
152+
$CABAL --version || true
153+
- name: update cabal index
154+
run: |
155+
$CABAL v2-update -v
156+
- name: install cabal-plan
157+
run: |
158+
mkdir -p $HOME/.cabal/bin
159+
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
160+
echo 'f62ccb2971567a5f638f2005ad3173dba14693a45154c1508645c52289714cb2 cabal-plan.xz' | sha256sum -c -
161+
xz -d < cabal-plan.xz > $HOME/.cabal/bin/cabal-plan
162+
rm -f cabal-plan.xz
163+
chmod a+x $HOME/.cabal/bin/cabal-plan
164+
cabal-plan --version
165+
- name: checkout
166+
uses: actions/checkout@v4
167+
with:
168+
path: source
169+
submodules: "true"
170+
- name: initial cabal.project for sdist
171+
run: |
172+
touch cabal.project
173+
echo "packages: $GITHUB_WORKSPACE/source/." >> cabal.project
174+
cat cabal.project
175+
- name: sdist
176+
run: |
177+
mkdir -p sdist
178+
$CABAL sdist all --output-dir $GITHUB_WORKSPACE/sdist
179+
- name: unpack
180+
run: |
181+
mkdir -p unpacked
182+
find sdist -maxdepth 1 -type f -name '*.tar.gz' -exec tar -C $GITHUB_WORKSPACE/unpacked -xzvf {} \;
183+
- name: generate cabal.project
184+
run: |
185+
PKGDIR_plt_test_lab3="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/plt-test-lab3-[0-9.]*')"
186+
echo "PKGDIR_plt_test_lab3=${PKGDIR_plt_test_lab3}" >> "$GITHUB_ENV"
187+
rm -f cabal.project cabal.project.local
188+
touch cabal.project
189+
touch cabal.project.local
190+
echo "packages: ${PKGDIR_plt_test_lab3}" >> cabal.project
191+
echo "package plt-test-lab3" >> cabal.project
192+
echo " ghc-options: -Werror=missing-methods" >> cabal.project
193+
cat >> cabal.project <<EOF
194+
EOF
195+
$HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: any.$_ installed\n" unless /^(plt-test-lab3)$/; }' >> cabal.project.local
196+
cat cabal.project
197+
cat cabal.project.local
198+
- name: dump install plan
199+
run: |
200+
$CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dry-run all
201+
cabal-plan
202+
- name: restore cache
203+
uses: actions/cache/restore@v4
204+
with:
205+
key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }}
206+
path: ~/.cabal/store
207+
restore-keys: ${{ runner.os }}-${{ matrix.compiler }}-
208+
- name: install dependencies
209+
run: |
210+
$CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --dependencies-only -j2 all
211+
$CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dependencies-only -j2 all
212+
- name: build w/o tests
213+
run: |
214+
$CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all
215+
- name: build
216+
run: |
217+
$CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --write-ghc-environment-files=always
218+
- name: haddock
219+
run: |
220+
if [ $((HCNUMVER >= 90000)) -ne 0 ] ; then $CABAL v2-haddock --disable-documentation --haddock-all $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH all ; fi
221+
- name: unconstrained build
222+
run: |
223+
rm -f cabal.project.local
224+
$CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all
225+
- name: save cache
226+
uses: actions/cache/save@v4
227+
if: always()
228+
with:
229+
key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }}
230+
path: ~/.cabal/store

Diff for: cabal.haskell-ci

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
branches: master
2+
3+
submodules: True
4+
-- We need the lab2-testsuite submodule
5+
6+
installed: +all
7+
-- We build with the GHC-shipped libraries.
8+
9+
cabal-check: False
10+
-- `cabal check` rejects our package because of `license: NONE`.
11+
12+
haddock: >= 9.0
13+
-- The `haddock`s for GHC 8.x choke on `lab2.hs`.

0 commit comments

Comments
 (0)