Skip to content

Commit cb1a4ea

Browse files
authored
Merge pull request #63 from haskellari/gha
Use GHA
2 parents 227fcb3 + 5caa962 commit cb1a4ea

File tree

5 files changed

+207
-192
lines changed

5 files changed

+207
-192
lines changed

.github/workflows/haskell-ci.yml

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

.travis.yml

Lines changed: 0 additions & 177 deletions
This file was deleted.

cabal.haskell-ci

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,3 @@ postgresql: True
33

44
-- services aren't supported on Travis on macOS
55
-- osx: 8.4.4
6-
7-
env: 7.6.3:DATABASE_CONNSTRING=travis
8-
env: 7.8.4:DATABASE_CONNSTRING=travis
9-
env: 7.10.3:DATABASE_CONNSTRING=travis
10-
env: 8.0.2:DATABASE_CONNSTRING=travis
11-
env: 8.2.2:DATABASE_CONNSTRING=travis
12-
env: 8.4.4:DATABASE_CONNSTRING=travis
13-
env: 8.6.5:DATABASE_CONNSTRING=travis
14-
env: 8.8.4:DATABASE_CONNSTRING=travis
15-
env: 8.10.2:DATABASE_CONNSTRING=travis

postgresql-simple.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ tested-with:
3131
|| ==8.4.4
3232
|| ==8.6.5
3333
|| ==8.8.4
34-
|| ==8.10.2
34+
|| ==8.10.3
3535

3636
library
3737
default-language: Haskell2010

0 commit comments

Comments
 (0)