Skip to content

Commit 84bfed8

Browse files
BinderDavidBodigrim
authored andcommitted
Add GitHub Actions based CI using haskell-ci
1 parent da4abf8 commit 84bfed8

File tree

3 files changed

+197
-26
lines changed

3 files changed

+197
-26
lines changed

.github/workflows/haskell-ci.yml

+194
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,194 @@
1+
# This GitHub workflow config has been generated by a script via
2+
#
3+
# haskell-ci 'github' '--no-cabal-check' 'pvp-site.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","--no-cabal-check","pvp-site.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.8.2
32+
compilerKind: ghc
33+
compilerVersion: 9.8.2
34+
setup-method: ghcup
35+
allow-failure: false
36+
- compiler: ghc-9.6.6
37+
compilerKind: ghc
38+
compilerVersion: 9.6.6
39+
setup-method: ghcup
40+
allow-failure: false
41+
- compiler: ghc-9.4.8
42+
compilerKind: ghc
43+
compilerVersion: 9.4.8
44+
setup-method: ghcup
45+
allow-failure: false
46+
fail-fast: false
47+
steps:
48+
- name: apt
49+
run: |
50+
apt-get update
51+
apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common libtinfo5
52+
mkdir -p "$HOME/.ghcup/bin"
53+
curl -sL https://downloads.haskell.org/ghcup/0.1.30.0/x86_64-linux-ghcup-0.1.30.0 > "$HOME/.ghcup/bin/ghcup"
54+
chmod a+x "$HOME/.ghcup/bin/ghcup"
55+
"$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false)
56+
"$HOME/.ghcup/bin/ghcup" install cabal 3.12.1.0 || (cat "$HOME"/.ghcup/logs/*.* && false)
57+
env:
58+
HCKIND: ${{ matrix.compilerKind }}
59+
HCNAME: ${{ matrix.compiler }}
60+
HCVER: ${{ matrix.compilerVersion }}
61+
- name: Set PATH and environment variables
62+
run: |
63+
echo "$HOME/.cabal/bin" >> $GITHUB_PATH
64+
echo "LANG=C.UTF-8" >> "$GITHUB_ENV"
65+
echo "CABAL_DIR=$HOME/.cabal" >> "$GITHUB_ENV"
66+
echo "CABAL_CONFIG=$HOME/.cabal/config" >> "$GITHUB_ENV"
67+
HCDIR=/opt/$HCKIND/$HCVER
68+
HC=$("$HOME/.ghcup/bin/ghcup" whereis ghc "$HCVER")
69+
HCPKG=$(echo "$HC" | sed 's#ghc$#ghc-pkg#')
70+
HADDOCK=$(echo "$HC" | sed 's#ghc$#haddock#')
71+
echo "HC=$HC" >> "$GITHUB_ENV"
72+
echo "HCPKG=$HCPKG" >> "$GITHUB_ENV"
73+
echo "HADDOCK=$HADDOCK" >> "$GITHUB_ENV"
74+
echo "CABAL=$HOME/.ghcup/bin/cabal-3.12.1.0 -vnormal+nowrap" >> "$GITHUB_ENV"
75+
HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\d+)\.(\d+)\.(\d+)(\.(\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))')
76+
echo "HCNUMVER=$HCNUMVER" >> "$GITHUB_ENV"
77+
echo "ARG_TESTS=--enable-tests" >> "$GITHUB_ENV"
78+
echo "ARG_BENCH=--enable-benchmarks" >> "$GITHUB_ENV"
79+
echo "HEADHACKAGE=false" >> "$GITHUB_ENV"
80+
echo "ARG_COMPILER=--$HCKIND --with-compiler=$HC" >> "$GITHUB_ENV"
81+
echo "GHCJSARITH=0" >> "$GITHUB_ENV"
82+
env:
83+
HCKIND: ${{ matrix.compilerKind }}
84+
HCNAME: ${{ matrix.compiler }}
85+
HCVER: ${{ matrix.compilerVersion }}
86+
- name: env
87+
run: |
88+
env
89+
- name: write cabal config
90+
run: |
91+
mkdir -p $CABAL_DIR
92+
cat >> $CABAL_CONFIG <<EOF
93+
remote-build-reporting: anonymous
94+
write-ghc-environment-files: never
95+
remote-repo-cache: $CABAL_DIR/packages
96+
logs-dir: $CABAL_DIR/logs
97+
world-file: $CABAL_DIR/world
98+
extra-prog-path: $CABAL_DIR/bin
99+
symlink-bindir: $CABAL_DIR/bin
100+
installdir: $CABAL_DIR/bin
101+
build-summary: $CABAL_DIR/logs/build.log
102+
store-dir: $CABAL_DIR/store
103+
install-dirs user
104+
prefix: $CABAL_DIR
105+
repository hackage.haskell.org
106+
url: http://hackage.haskell.org/
107+
EOF
108+
cat >> $CABAL_CONFIG <<EOF
109+
program-default-options
110+
ghc-options: $GHCJOBS +RTS -M3G -RTS
111+
EOF
112+
cat $CABAL_CONFIG
113+
- name: versions
114+
run: |
115+
$HC --version || true
116+
$HC --print-project-git-commit-id || true
117+
$CABAL --version || true
118+
- name: update cabal index
119+
run: |
120+
$CABAL v2-update -v
121+
- name: install cabal-plan
122+
run: |
123+
mkdir -p $HOME/.cabal/bin
124+
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
125+
echo 'f62ccb2971567a5f638f2005ad3173dba14693a45154c1508645c52289714cb2 cabal-plan.xz' | sha256sum -c -
126+
xz -d < cabal-plan.xz > $HOME/.cabal/bin/cabal-plan
127+
rm -f cabal-plan.xz
128+
chmod a+x $HOME/.cabal/bin/cabal-plan
129+
cabal-plan --version
130+
- name: checkout
131+
uses: actions/checkout@v4
132+
with:
133+
path: source
134+
- name: initial cabal.project for sdist
135+
run: |
136+
touch cabal.project
137+
echo "packages: $GITHUB_WORKSPACE/source/." >> cabal.project
138+
cat cabal.project
139+
- name: sdist
140+
run: |
141+
mkdir -p sdist
142+
$CABAL sdist all --output-dir $GITHUB_WORKSPACE/sdist
143+
- name: unpack
144+
run: |
145+
mkdir -p unpacked
146+
find sdist -maxdepth 1 -type f -name '*.tar.gz' -exec tar -C $GITHUB_WORKSPACE/unpacked -xzvf {} \;
147+
- name: generate cabal.project
148+
run: |
149+
PKGDIR_pvp_site="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/pvp-site-[0-9.]*')"
150+
echo "PKGDIR_pvp_site=${PKGDIR_pvp_site}" >> "$GITHUB_ENV"
151+
rm -f cabal.project cabal.project.local
152+
touch cabal.project
153+
touch cabal.project.local
154+
echo "packages: ${PKGDIR_pvp_site}" >> cabal.project
155+
echo "package pvp-site" >> cabal.project
156+
echo " ghc-options: -Werror=missing-methods" >> cabal.project
157+
cat >> cabal.project <<EOF
158+
EOF
159+
$HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: any.$_ installed\n" unless /^(pvp-site)$/; }' >> cabal.project.local
160+
cat cabal.project
161+
cat cabal.project.local
162+
- name: dump install plan
163+
run: |
164+
$CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dry-run all
165+
cabal-plan
166+
- name: restore cache
167+
uses: actions/cache/restore@v4
168+
with:
169+
key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }}
170+
path: ~/.cabal/store
171+
restore-keys: ${{ runner.os }}-${{ matrix.compiler }}-
172+
- name: install dependencies
173+
run: |
174+
$CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --dependencies-only -j2 all
175+
$CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dependencies-only -j2 all
176+
- name: build w/o tests
177+
run: |
178+
$CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all
179+
- name: build
180+
run: |
181+
$CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --write-ghc-environment-files=always
182+
- name: haddock
183+
run: |
184+
$CABAL v2-haddock --disable-documentation --haddock-all $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH all
185+
- name: unconstrained build
186+
run: |
187+
rm -f cabal.project.local
188+
$CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all
189+
- name: save cache
190+
uses: actions/cache/save@v4
191+
if: always()
192+
with:
193+
key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }}
194+
path: ~/.cabal/store

.travis.yml

-24
This file was deleted.

pvp-site.cabal

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
cabal-version: 3.0
22
name: pvp-site
33
version: 1.0
4-
tested-with: GHC == 9.4.8 || == 9.6.6 || == 9.8.2 || == 9.10.1
4+
synopsis: The Hakyll site for pvp.haskell.org
5+
tested-with: GHC == 9.4.8 || == 9.6.6 || == 9.8.2
56

67
executable pvp-site
78
main-is: site.hs
89
hs-source-dirs: src/
910
build-depends: base >= 4.17 && < 5
1011
, hakyll >= 4.16 && < 4.17
11-
, pandoc >= 3.2 && < 3.4
12+
, pandoc >= 3.2 && < 3.3
1213
, pandoc-types >= 1.23 && < 1.24
1314
, text >= 2.0 && < 2.2
1415
ghc-options: -threaded

0 commit comments

Comments
 (0)