Skip to content

Commit 7e5898d

Browse files
authored
Merge pull request #201 from bgamari/wip/ci
Add GitHub Actions-based CI
2 parents 9659951 + 0e042ec commit 7e5898d

3 files changed

Lines changed: 244 additions & 1 deletion

File tree

.github/workflows/haskell-ci.yml

Lines changed: 242 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,242 @@
1+
# This GitHub workflow config has been generated by a script via
2+
#
3+
# haskell-ci 'github' 'binary.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.15.20220812
12+
#
13+
# REGENDATA ("0.15.20220812",["github","binary.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:bionic
27+
continue-on-error: ${{ matrix.allow-failure }}
28+
strategy:
29+
matrix:
30+
include:
31+
- compiler: ghc-9.4.1
32+
compilerKind: ghc
33+
compilerVersion: 9.4.1
34+
setup-method: ghcup
35+
allow-failure: false
36+
- compiler: ghc-9.2.3
37+
compilerKind: ghc
38+
compilerVersion: 9.2.3
39+
setup-method: ghcup
40+
allow-failure: false
41+
- compiler: ghc-9.0.2
42+
compilerKind: ghc
43+
compilerVersion: 9.0.2
44+
setup-method: ghcup
45+
allow-failure: false
46+
- compiler: ghc-8.10.7
47+
compilerKind: ghc
48+
compilerVersion: 8.10.7
49+
setup-method: ghcup
50+
allow-failure: false
51+
- compiler: ghc-8.8.3
52+
compilerKind: ghc
53+
compilerVersion: 8.8.3
54+
setup-method: hvr-ppa
55+
allow-failure: false
56+
- compiler: ghc-8.6.5
57+
compilerKind: ghc
58+
compilerVersion: 8.6.5
59+
setup-method: hvr-ppa
60+
allow-failure: false
61+
- compiler: ghc-8.4.4
62+
compilerKind: ghc
63+
compilerVersion: 8.4.4
64+
setup-method: hvr-ppa
65+
allow-failure: false
66+
- compiler: ghc-8.2.2
67+
compilerKind: ghc
68+
compilerVersion: 8.2.2
69+
setup-method: hvr-ppa
70+
allow-failure: false
71+
- compiler: ghc-8.0.2
72+
compilerKind: ghc
73+
compilerVersion: 8.0.2
74+
setup-method: hvr-ppa
75+
allow-failure: false
76+
fail-fast: false
77+
steps:
78+
- name: apt
79+
run: |
80+
apt-get update
81+
apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common libtinfo5
82+
if [ "${{ matrix.setup-method }}" = ghcup ]; then
83+
mkdir -p "$HOME/.ghcup/bin"
84+
curl -sL https://downloads.haskell.org/ghcup/0.1.18.0/x86_64-linux-ghcup-0.1.18.0 > "$HOME/.ghcup/bin/ghcup"
85+
chmod a+x "$HOME/.ghcup/bin/ghcup"
86+
"$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false)
87+
"$HOME/.ghcup/bin/ghcup" install cabal 3.6.2.0 || (cat "$HOME"/.ghcup/logs/*.* && false)
88+
else
89+
apt-add-repository -y 'ppa:hvr/ghc'
90+
apt-get update
91+
apt-get install -y "$HCNAME"
92+
mkdir -p "$HOME/.ghcup/bin"
93+
curl -sL https://downloads.haskell.org/ghcup/0.1.18.0/x86_64-linux-ghcup-0.1.18.0 > "$HOME/.ghcup/bin/ghcup"
94+
chmod a+x "$HOME/.ghcup/bin/ghcup"
95+
"$HOME/.ghcup/bin/ghcup" install cabal 3.6.2.0 || (cat "$HOME"/.ghcup/logs/*.* && false)
96+
fi
97+
env:
98+
HCKIND: ${{ matrix.compilerKind }}
99+
HCNAME: ${{ matrix.compiler }}
100+
HCVER: ${{ matrix.compilerVersion }}
101+
- name: Set PATH and environment variables
102+
run: |
103+
echo "$HOME/.cabal/bin" >> $GITHUB_PATH
104+
echo "LANG=C.UTF-8" >> "$GITHUB_ENV"
105+
echo "CABAL_DIR=$HOME/.cabal" >> "$GITHUB_ENV"
106+
echo "CABAL_CONFIG=$HOME/.cabal/config" >> "$GITHUB_ENV"
107+
HCDIR=/opt/$HCKIND/$HCVER
108+
if [ "${{ matrix.setup-method }}" = ghcup ]; then
109+
HC=$HOME/.ghcup/bin/$HCKIND-$HCVER
110+
echo "HC=$HC" >> "$GITHUB_ENV"
111+
echo "HCPKG=$HOME/.ghcup/bin/$HCKIND-pkg-$HCVER" >> "$GITHUB_ENV"
112+
echo "HADDOCK=$HOME/.ghcup/bin/haddock-$HCVER" >> "$GITHUB_ENV"
113+
echo "CABAL=$HOME/.ghcup/bin/cabal-3.6.2.0 -vnormal+nowrap" >> "$GITHUB_ENV"
114+
else
115+
HC=$HCDIR/bin/$HCKIND
116+
echo "HC=$HC" >> "$GITHUB_ENV"
117+
echo "HCPKG=$HCDIR/bin/$HCKIND-pkg" >> "$GITHUB_ENV"
118+
echo "HADDOCK=$HCDIR/bin/haddock" >> "$GITHUB_ENV"
119+
echo "CABAL=$HOME/.ghcup/bin/cabal-3.6.2.0 -vnormal+nowrap" >> "$GITHUB_ENV"
120+
fi
121+
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.6.2.0/cabal-plan-0.6.2.0-x86_64-linux.xz > cabal-plan.xz
172+
echo 'de73600b1836d3f55e32d80385acc055fd97f60eaa0ab68a755302685f5d81bc 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@v2
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_binary="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/binary-[0-9.]*')"
197+
echo "PKGDIR_binary=${PKGDIR_binary}" >> "$GITHUB_ENV"
198+
rm -f cabal.project cabal.project.local
199+
touch cabal.project
200+
touch cabal.project.local
201+
echo "packages: ${PKGDIR_binary}" >> cabal.project
202+
if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo "package binary" >> cabal.project ; fi
203+
if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi
204+
cat >> cabal.project <<EOF
205+
EOF
206+
$HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: $_ installed\n" unless /^(binary)$/; }' >> cabal.project.local
207+
cat cabal.project
208+
cat cabal.project.local
209+
- name: dump install plan
210+
run: |
211+
$CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dry-run all
212+
cabal-plan
213+
- name: cache
214+
uses: actions/cache@v2
215+
with:
216+
key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }}
217+
path: ~/.cabal/store
218+
restore-keys: ${{ runner.os }}-${{ matrix.compiler }}-
219+
- name: install dependencies
220+
run: |
221+
$CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --dependencies-only -j2 all
222+
$CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dependencies-only -j2 all
223+
- name: build w/o tests
224+
run: |
225+
$CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all
226+
- name: build
227+
run: |
228+
$CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --write-ghc-environment-files=always
229+
- name: tests
230+
run: |
231+
$CABAL v2-test $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --test-show-details=direct
232+
- name: cabal check
233+
run: |
234+
cd ${PKGDIR_binary} || false
235+
${CABAL} -vnormal check
236+
- name: haddock
237+
run: |
238+
$CABAL v2-haddock --haddock-all $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH all
239+
- name: unconstrained build
240+
run: |
241+
rm -f cabal.project.local
242+
$CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
GNUmakefile
1313
dist-boot
1414
dist-install
15+
dist-newstyle
1516
ghc.mk
1617
.cabal-sandbox
1718
cabal.sandbox.config

binary.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ synopsis: Binary serialisation for Haskell values using lazy ByteStrings
2727
category: Data, Parsing
2828
stability: provisional
2929
build-type: Simple
30-
tested-with: GHC == 7.8.4, GHC == 7.10.3, GHC == 8.0.2, GHC ==8.2.2, GHC == 8.4.4, GHC == 8.6.5
30+
tested-with: GHC == 8.0.2, GHC ==8.2.2, GHC == 8.4.4, GHC == 8.6.5, GHC == 8.8.3, GHC == 8.10.7, GHC == 9.0.2, GHC == 9.2.3, GHC == 9.4.1
3131
extra-source-files:
3232
README.md changelog.md docs/hcar/binary-Lb.tex tools/derive/*.hs
3333

0 commit comments

Comments
 (0)