Skip to content

Commit abe1d3f

Browse files
committed
Add haskell-ci
1 parent 885c20e commit abe1d3f

File tree

5 files changed

+489
-476
lines changed

5 files changed

+489
-476
lines changed

.github/workflows/haskell-ci.yml

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

0 commit comments

Comments
 (0)