Skip to content

Commit 0f5e79a

Browse files
committed
Try GHA
1 parent 421502b commit 0f5e79a

File tree

6 files changed

+222
-209
lines changed

6 files changed

+222
-209
lines changed

.github/workflows/haskell-ci.yml

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

.travis.yml

-189
This file was deleted.

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ Haskell libpq binding
44
This is a Haskell binding to libpq: the C application programmer's
55
interface to PostgreSQL. libpq is a set of library functions that
66
allow client programs to pass queries to the PostgreSQL backend server
7-
and to receive the results of these queries.
7+
and to receive the results of these queries.

0 commit comments

Comments
 (0)