Skip to content

Commit 4659f29

Browse files
committed
[ haskell-ci ] generated github actions for Haskell CI
1 parent 1b30112 commit 4659f29

File tree

1 file changed

+208
-0
lines changed

1 file changed

+208
-0
lines changed

.github/workflows/haskell-ci.yml

Lines changed: 208 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,208 @@
1+
# This GitHub workflow config has been generated by a script via
2+
#
3+
# haskell-ci 'github' '--irc-channels=irc.freenode.org#hackage' 'zlib.cabal' '--apt=zlib1g-dev' '--tests-jobs=>=7.4'
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.11.20210111
12+
#
13+
# REGENDATA ("0.11.20210111",["github","--irc-channels=irc.freenode.org#hackage","zlib.cabal","--apt=zlib1g-dev","--tests-jobs=>=7.4"])
14+
#
15+
name: Haskell-CI
16+
on:
17+
- push
18+
- pull_request
19+
jobs:
20+
irc:
21+
name: Haskell-CI (IRC notification)
22+
runs-on: ubuntu-18.04
23+
needs:
24+
- linux
25+
if: ${{ always() }}
26+
strategy:
27+
fail-fast: false
28+
steps:
29+
- name: IRC success notification (irc.freenode.org#hackage)
30+
uses: Gottox/[email protected]
31+
if: needs.linux.result == 'success'
32+
with:
33+
channel: "#hackage"
34+
message: "\x0313zlib\x03/\x0306${{ github.ref }}\x03 \x0314${{ github.sha }}\x03 https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} The build succeeded."
35+
nickname: github-actions
36+
server: irc.freenode.org
37+
- name: IRC failure notification (irc.freenode.org#hackage)
38+
uses: Gottox/[email protected]
39+
if: needs.linux.result != 'success'
40+
with:
41+
channel: "#hackage"
42+
message: "\x0313zlib\x03/\x0306${{ github.ref }}\x03 \x0314${{ github.sha }}\x03 https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} The build failed."
43+
nickname: github-actions
44+
server: irc.freenode.org
45+
linux:
46+
name: Haskell-CI Linux - GHC ${{ matrix.ghc }}
47+
runs-on: ubuntu-18.04
48+
container:
49+
image: buildpack-deps:bionic
50+
continue-on-error: ${{ matrix.allow-failure }}
51+
strategy:
52+
matrix:
53+
include:
54+
- ghc: 8.10.3
55+
allow-failure: false
56+
- ghc: 8.8.4
57+
allow-failure: false
58+
- ghc: 8.6.5
59+
allow-failure: false
60+
- ghc: 8.4.4
61+
allow-failure: false
62+
- ghc: 8.2.2
63+
allow-failure: false
64+
- ghc: 8.0.2
65+
allow-failure: false
66+
- ghc: 7.10.3
67+
allow-failure: false
68+
- ghc: 7.8.4
69+
allow-failure: false
70+
- ghc: 7.6.3
71+
allow-failure: false
72+
- ghc: 7.4.2
73+
allow-failure: false
74+
- ghc: 7.2.2
75+
allow-failure: false
76+
- ghc: 7.0.4
77+
allow-failure: false
78+
fail-fast: false
79+
steps:
80+
- name: apt
81+
run: |
82+
apt-get update
83+
apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common
84+
apt-add-repository -y 'ppa:hvr/ghc'
85+
apt-get update
86+
apt-get install -y ghc-$GHC_VERSION cabal-install-3.2 zlib1g-dev
87+
env:
88+
GHC_VERSION: ${{ matrix.ghc }}
89+
- name: Set PATH and environment variables
90+
run: |
91+
echo "$HOME/.cabal/bin" >> $GITHUB_PATH
92+
echo "LANG=C.UTF-8" >> $GITHUB_ENV
93+
echo "CABAL_DIR=$HOME/.cabal" >> $GITHUB_ENV
94+
echo "CABAL_CONFIG=$HOME/.cabal/config" >> $GITHUB_ENV
95+
HC=/opt/ghc/$GHC_VERSION/bin/ghc
96+
echo "HC=$HC" >> $GITHUB_ENV
97+
echo "HCPKG=/opt/ghc/$GHC_VERSION/bin/ghc-pkg" >> $GITHUB_ENV
98+
echo "HADDOCK=/opt/ghc/$GHC_VERSION/bin/haddock" >> $GITHUB_ENV
99+
echo "CABAL=/opt/cabal/3.2/bin/cabal -vnormal+nowrap" >> $GITHUB_ENV
100+
HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\d+)\.(\d+)\.(\d+)(\.(\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))')
101+
echo "HCNUMVER=$HCNUMVER" >> $GITHUB_ENV
102+
if [ $((HCNUMVER >= 70400)) -ne 0 ] ; then echo "ARG_TESTS=--enable-tests" >> $GITHUB_ENV ; else echo "ARG_TESTS=--disable-tests" >> $GITHUB_ENV ; fi
103+
echo "ARG_BENCH=--enable-benchmarks" >> $GITHUB_ENV
104+
echo "ARG_COMPILER=--ghc --with-compiler=/opt/ghc/$GHC_VERSION/bin/ghc" >> $GITHUB_ENV
105+
echo "GHCJSARITH=0" >> $GITHUB_ENV
106+
env:
107+
GHC_VERSION: ${{ matrix.ghc }}
108+
- name: env
109+
run: |
110+
env
111+
- name: write cabal config
112+
run: |
113+
mkdir -p $CABAL_DIR
114+
cat >> $CABAL_CONFIG <<EOF
115+
remote-build-reporting: anonymous
116+
write-ghc-environment-files: never
117+
remote-repo-cache: $CABAL_DIR/packages
118+
logs-dir: $CABAL_DIR/logs
119+
world-file: $CABAL_DIR/world
120+
extra-prog-path: $CABAL_DIR/bin
121+
symlink-bindir: $CABAL_DIR/bin
122+
installdir: $CABAL_DIR/bin
123+
build-summary: $CABAL_DIR/logs/build.log
124+
store-dir: $CABAL_DIR/store
125+
install-dirs user
126+
prefix: $CABAL_DIR
127+
repository hackage.haskell.org
128+
url: http://hackage.haskell.org/
129+
EOF
130+
cat $CABAL_CONFIG
131+
- name: versions
132+
run: |
133+
$HC --version || true
134+
$HC --print-project-git-commit-id || true
135+
$CABAL --version || true
136+
- name: update cabal index
137+
run: |
138+
$CABAL v2-update -v
139+
- name: install cabal-plan
140+
run: |
141+
mkdir -p $HOME/.cabal/bin
142+
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
143+
echo 'de73600b1836d3f55e32d80385acc055fd97f60eaa0ab68a755302685f5d81bc cabal-plan.xz' | sha256sum -c -
144+
xz -d < cabal-plan.xz > $HOME/.cabal/bin/cabal-plan
145+
rm -f cabal-plan.xz
146+
chmod a+x $HOME/.cabal/bin/cabal-plan
147+
cabal-plan --version
148+
- name: checkout
149+
uses: actions/checkout@v2
150+
with:
151+
path: source
152+
- name: sdist
153+
run: |
154+
mkdir -p sdist
155+
cd source || false
156+
$CABAL sdist all --output-dir $GITHUB_WORKSPACE/sdist
157+
- name: unpack
158+
run: |
159+
mkdir -p unpacked
160+
find sdist -maxdepth 1 -type f -name '*.tar.gz' -exec tar -C $GITHUB_WORKSPACE/unpacked -xzvf {} \;
161+
- name: generate cabal.project
162+
run: |
163+
PKGDIR_zlib="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/zlib-[0-9.]*')"
164+
echo "PKGDIR_zlib=${PKGDIR_zlib}" >> $GITHUB_ENV
165+
touch cabal.project
166+
touch cabal.project.local
167+
echo "packages: ${PKGDIR_zlib}" >> cabal.project
168+
if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo "package zlib" >> cabal.project ; fi
169+
if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi
170+
cat >> cabal.project <<EOF
171+
EOF
172+
$HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: $_ installed\n" unless /^(zlib)$/; }' >> cabal.project.local
173+
cat cabal.project
174+
cat cabal.project.local
175+
- name: dump install plan
176+
run: |
177+
$CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dry-run all
178+
cabal-plan
179+
- name: cache
180+
uses: actions/cache@v2
181+
with:
182+
key: ${{ runner.os }}-${{ matrix.ghc }}-${{ github.sha }}
183+
path: ~/.cabal/store
184+
restore-keys: ${{ runner.os }}-${{ matrix.ghc }}-
185+
- name: install dependencies
186+
run: |
187+
$CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --dependencies-only -j2 all
188+
$CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dependencies-only -j2 all
189+
- name: build w/o tests
190+
run: |
191+
$CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all
192+
- name: build
193+
run: |
194+
$CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --write-ghc-environment-files=always
195+
- name: tests
196+
run: |
197+
if [ $((HCNUMVER >= 70400)) -ne 0 ] ; then $CABAL v2-test $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --test-show-details=direct ; fi
198+
- name: cabal check
199+
run: |
200+
cd ${PKGDIR_zlib} || false
201+
${CABAL} -vnormal check
202+
- name: haddock
203+
run: |
204+
$CABAL v2-haddock $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH all
205+
- name: unconstrained build
206+
run: |
207+
rm -f cabal.project.local
208+
$CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all

0 commit comments

Comments
 (0)