@@ -0,0 +1,255 @@
1+# This GitHub workflow config has been generated by a script via
2+#
3+# haskell-ci 'github' '--config=cabal.haskell-ci' 'effective.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.13.20210606
12+#
13+# REGENDATA ("0.13.20210606",["github","--config=cabal.haskell-ci","effective.cabal"])
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-18.04
27+ container:
28+ image: buildpack-deps:bionic
29+ continue-on-error: ${{ matrix.allow-failure }}
30+ strategy:
31+ matrix:
32+ include:
33+ - compiler: ghc-9.2.0.20210422
34+ compilerKind: ghc
35+ compilerVersion: 9.2.0.20210422
36+ setup-method: ghcup
37+ allow-failure: true
38+ - compiler: ghc-9.0.1
39+ compilerKind: ghc
40+ compilerVersion: 9.0.1
41+ setup-method: hvr-ppa
42+ allow-failure: false
43+ - compiler: ghc-8.10.4
44+ compilerKind: ghc
45+ compilerVersion: 8.10.4
46+ setup-method: hvr-ppa
47+ allow-failure: false
48+ - compiler: ghc-8.8.4
49+ compilerKind: ghc
50+ compilerVersion: 8.8.4
51+ setup-method: hvr-ppa
52+ allow-failure: false
53+ - compiler: ghc-8.6.5
54+ compilerKind: ghc
55+ compilerVersion: 8.6.5
56+ setup-method: hvr-ppa
57+ allow-failure: false
58+ - compiler: ghc-8.4.4
59+ compilerKind: ghc
60+ compilerVersion: 8.4.4
61+ setup-method: hvr-ppa
62+ allow-failure: false
63+ - compiler: ghc-8.2.2
64+ compilerKind: ghc
65+ compilerVersion: 8.2.2
66+ setup-method: hvr-ppa
67+ allow-failure: false
68+ - compiler: ghc-8.0.2
69+ compilerKind: ghc
70+ compilerVersion: 8.0.2
71+ setup-method: hvr-ppa
72+ allow-failure: false
73+ fail-fast: false
74+ steps:
75+ - name: apt
76+ run: |
77+ apt-get update
78+ apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common libtinfo5
79+ if [ "${{ matrix.setup-method }}" = ghcup ]; then
80+ mkdir -p "$HOME/.ghcup/bin"
81+ curl -sL https://downloads.haskell.org/ghcup/0.1.14.1/x86_64-linux-ghcup-0.1.14.1 > "$HOME/.ghcup/bin/ghcup"
82+ chmod a+x "$HOME/.ghcup/bin/ghcup"
83+ "$HOME/.ghcup/bin/ghcup" install ghc "$HCVER"
84+ "$HOME/.ghcup/bin/ghcup" install cabal 3.4.0.0
85+ else
86+ apt-add-repository -y 'ppa:hvr/ghc'
87+ apt-get update
88+ apt-get install -y "$HCNAME" cabal-install-3.4
89+ fi
90+ env:
91+ HCKIND: ${{ matrix.compilerKind }}
92+ HCNAME: ${{ matrix.compiler }}
93+ HCVER: ${{ matrix.compilerVersion }}
94+ - name: Set PATH and environment variables
95+ run: |
96+ echo "$HOME/.cabal/bin" >> $GITHUB_PATH
97+ echo "LANG=C.UTF-8" >> "$GITHUB_ENV"
98+ echo "CABAL_DIR=$HOME/.cabal" >> "$GITHUB_ENV"
99+ echo "CABAL_CONFIG=$HOME/.cabal/config" >> "$GITHUB_ENV"
100+ HCDIR=/opt/$HCKIND/$HCVER
101+ if [ "${{ matrix.setup-method }}" = ghcup ]; then
102+ HC=$HOME/.ghcup/bin/$HCKIND-$HCVER
103+ echo "HC=$HC" >> "$GITHUB_ENV"
104+ echo "HCPKG=$HOME/.ghcup/bin/$HCKIND-pkg-$HCVER" >> "$GITHUB_ENV"
105+ echo "HADDOCK=$HOME/.ghcup/bin/haddock-$HCVER" >> "$GITHUB_ENV"
106+ echo "CABAL=$HOME/.ghcup/bin/cabal-3.4.0.0 -vnormal+nowrap" >> "$GITHUB_ENV"
107+ else
108+ HC=$HCDIR/bin/$HCKIND
109+ echo "HC=$HC" >> "$GITHUB_ENV"
110+ echo "HCPKG=$HCDIR/bin/$HCKIND-pkg" >> "$GITHUB_ENV"
111+ echo "HADDOCK=$HCDIR/bin/haddock" >> "$GITHUB_ENV"
112+ echo "CABAL=/opt/cabal/3.4/bin/cabal -vnormal+nowrap" >> "$GITHUB_ENV"
113+ fi
114+
115+ HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\d+)\.(\d+)\.(\d+)(\.(\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))')
116+ echo "HCNUMVER=$HCNUMVER" >> "$GITHUB_ENV"
117+ echo "ARG_TESTS=--enable-tests" >> "$GITHUB_ENV"
118+ echo "ARG_BENCH=--enable-benchmarks" >> "$GITHUB_ENV"
119+ if [ $((HCNUMVER >= 90200)) -ne 0 ] ; then echo "HEADHACKAGE=true" >> "$GITHUB_ENV" ; else echo "HEADHACKAGE=false" >> "$GITHUB_ENV" ; fi
120+ echo "ARG_COMPILER=--$HCKIND --with-compiler=$HC" >> "$GITHUB_ENV"
121+ echo "GHCJSARITH=0" >> "$GITHUB_ENV"
122+ env:
123+ HCKIND: ${{ matrix.compilerKind }}
124+ HCNAME: ${{ matrix.compiler }}
125+ HCVER: ${{ matrix.compilerVersion }}
126+ - name: env
127+ run: |
128+ env
129+ - name: write cabal config
130+ run: |
131+ mkdir -p $CABAL_DIR
132+ cat >> $CABAL_CONFIG <<EOF
133+ remote-build-reporting: anonymous
134+ write-ghc-environment-files: never
135+ remote-repo-cache: $CABAL_DIR/packages
136+ logs-dir: $CABAL_DIR/logs
137+ world-file: $CABAL_DIR/world
138+ extra-prog-path: $CABAL_DIR/bin
139+ symlink-bindir: $CABAL_DIR/bin
140+ installdir: $CABAL_DIR/bin
141+ build-summary: $CABAL_DIR/logs/build.log
142+ store-dir: $CABAL_DIR/store
143+ install-dirs user
144+ prefix: $CABAL_DIR
145+ repository hackage.haskell.org
146+ url: http://hackage.haskell.org/
147+ EOF
148+ if $HEADHACKAGE; then
149+ cat >> $CABAL_CONFIG <<EOF
150+ repository head.hackage.ghc.haskell.org
151+ url: https://ghc.gitlab.haskell.org/head.hackage/
152+ secure: True
153+ root-keys: 7541f32a4ccca4f97aea3b22f5e593ba2c0267546016b992dfadcd2fe944e55d
154+ 26021a13b401500c8eb2761ca95c61f2d625bfef951b939a8124ed12ecf07329
155+ f76d08be13e9a61a377a85e2fb63f4c5435d40f8feb3e12eb05905edb8cdea89
156+ key-threshold: 3
157+ EOF
158+ fi
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: cache (tools)
169+ uses: actions/cache@v2
170+ with:
171+ key: ${{ runner.os }}-${{ matrix.compiler }}-tools-60139de7
172+ path: ~/.haskell-ci-tools
173+ - name: install cabal-plan
174+ run: |
175+ mkdir -p $HOME/.cabal/bin
176+ curl -sL https://github.com/haskell-hvr/cabal-plan/releases/download/v0.6.2.0/cabal-plan-0.6.2.0-x86_64-linux.xz > cabal-plan.xz
177+ echo 'de73600b1836d3f55e32d80385acc055fd97f60eaa0ab68a755302685f5d81bc cabal-plan.xz' | sha256sum -c -
178+ xz -d < cabal-plan.xz > $HOME/.cabal/bin/cabal-plan
179+ rm -f cabal-plan.xz
180+ chmod a+x $HOME/.cabal/bin/cabal-plan
181+ cabal-plan --version
182+ - name: install doctest
183+ run: |
184+ if [ $((HCNUMVER < 90000)) -ne 0 ] ; then $CABAL --store-dir=$HOME/.haskell-ci-tools/store v2-install $ARG_COMPILER --ignore-project -j2 doctest --constraint='doctest ^>=0.17' ; fi
185+ if [ $((HCNUMVER < 90000)) -ne 0 ] ; then doctest --version ; fi
186+ - name: checkout
187+ uses: actions/checkout@v2
188+ with:
189+ path: source
190+ - name: initial cabal.project for sdist
191+ run: |
192+ touch cabal.project
193+ echo "packages: $GITHUB_WORKSPACE/source/." >> cabal.project
194+ cat cabal.project
195+ - name: sdist
196+ run: |
197+ mkdir -p sdist
198+ $CABAL sdist all --output-dir $GITHUB_WORKSPACE/sdist
199+ - name: unpack
200+ run: |
201+ mkdir -p unpacked
202+ find sdist -maxdepth 1 -type f -name '*.tar.gz' -exec tar -C $GITHUB_WORKSPACE/unpacked -xzvf {} \;
203+ - name: generate cabal.project
204+ run: |
205+ PKGDIR_effective="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/effective-[0-9.]*')"
206+ echo "PKGDIR_effective=${PKGDIR_effective}" >> "$GITHUB_ENV"
207+ rm -f cabal.project cabal.project.local
208+ touch cabal.project
209+ touch cabal.project.local
210+ echo "packages: ${PKGDIR_effective}" >> cabal.project
211+ if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo "package effective" >> cabal.project ; fi
212+ if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi
213+ cat >> cabal.project <<EOF
214+ EOF
215+ if $HEADHACKAGE; then
216+ echo "allow-newer: $($HCPKG list --simple-output | sed -E 's/([a-zA-Z-]+)-[0-9.]+/*:\1,/g')" >> cabal.project
217+ fi
218+ $HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: $_ installed\n" unless /^(effective)$/; }' >> cabal.project.local
219+ cat cabal.project
220+ cat cabal.project.local
221+ - name: dump install plan
222+ run: |
223+ $CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dry-run all
224+ cabal-plan
225+ - name: cache
226+ uses: actions/cache@v2
227+ with:
228+ key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }}
229+ path: ~/.cabal/store
230+ restore-keys: ${{ runner.os }}-${{ matrix.compiler }}-
231+ - name: install dependencies
232+ run: |
233+ $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --dependencies-only -j2 all
234+ $CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dependencies-only -j2 all
235+ - name: build w/o tests
236+ run: |
237+ $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all
238+ - name: build
239+ run: |
240+ $CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --write-ghc-environment-files=always
241+ - name: doctest
242+ run: |
243+ if [ $((HCNUMVER < 90000)) -ne 0 ] ; then cd ${PKGDIR_effective} || false ; fi
244+ if [ $((HCNUMVER < 90000)) -ne 0 ] ; then doctest -XBangPatterns -XConstraintKinds -XDataKinds -XDefaultSignatures -XDeriveFunctor -XFlexibleContexts -XFlexibleInstances -XFunctionalDependencies -XGADTs -XGeneralizedNewtypeDeriving -XInstanceSigs -XLambdaCase -XNamedFieldPuns -XRankNTypes -XRecordWildCards -XRoleAnnotations -XScopedTypeVariables -XStandaloneDeriving -XStrictData -XTupleSections -XTypeApplications -XTypeInType -XTypeFamilies -XTypeOperators src ; fi
245+ - name: cabal check
246+ run: |
247+ cd ${PKGDIR_effective} || false
248+ ${CABAL} -vnormal check
249+ - name: haddock
250+ run: |
251+ $CABAL v2-haddock $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH all
252+ - name: unconstrained build
253+ run: |
254+ rm -f cabal.project.local
255+ $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all