Skip to content

Commit c0ea239

Browse files
committed
Switch to GitHub Actions.
1 parent f8b2e03 commit c0ea239

File tree

4 files changed

+243
-169
lines changed

4 files changed

+243
-169
lines changed

Diff for: .github/workflows/haskell-ci.yml

+237
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,237 @@
1+
# This GitHub workflow config has been generated by a script via
2+
#
3+
# haskell-ci 'github' 'OpenGLRaw.cabal' '--distribution=focal' '--submodules' '--output=.github/workflows/haskell-ci.yml' '--apt=freeglut3-dev'
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.13.20211111
12+
#
13+
# REGENDATA ("0.13.20211111",["github","OpenGLRaw.cabal","--distribution=focal","--submodules","--output=.github/workflows/haskell-ci.yml","--apt=freeglut3-dev"])
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-18.04
23+
timeout-minutes:
24+
60
25+
container:
26+
image: buildpack-deps:focal
27+
continue-on-error: ${{ matrix.allow-failure }}
28+
strategy:
29+
matrix:
30+
include:
31+
- compiler: ghc-9.2.1
32+
compilerKind: ghc
33+
compilerVersion: 9.2.1
34+
setup-method: ghcup
35+
allow-failure: false
36+
- compiler: ghc-9.0.1
37+
compilerKind: ghc
38+
compilerVersion: 9.0.1
39+
setup-method: hvr-ppa
40+
allow-failure: false
41+
- compiler: ghc-8.10.7
42+
compilerKind: ghc
43+
compilerVersion: 8.10.7
44+
setup-method: ghcup
45+
allow-failure: false
46+
- compiler: ghc-8.8.4
47+
compilerKind: ghc
48+
compilerVersion: 8.8.4
49+
setup-method: hvr-ppa
50+
allow-failure: false
51+
- compiler: ghc-8.6.5
52+
compilerKind: ghc
53+
compilerVersion: 8.6.5
54+
setup-method: hvr-ppa
55+
allow-failure: false
56+
- compiler: ghc-8.4.4
57+
compilerKind: ghc
58+
compilerVersion: 8.4.4
59+
setup-method: hvr-ppa
60+
allow-failure: false
61+
- compiler: ghc-8.2.2
62+
compilerKind: ghc
63+
compilerVersion: 8.2.2
64+
setup-method: hvr-ppa
65+
allow-failure: false
66+
- compiler: ghc-8.0.2
67+
compilerKind: ghc
68+
compilerVersion: 8.0.2
69+
setup-method: hvr-ppa
70+
allow-failure: false
71+
fail-fast: false
72+
steps:
73+
- name: apt
74+
run: |
75+
apt-get update
76+
apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common libtinfo5
77+
if [ "${{ matrix.setup-method }}" = ghcup ]; then
78+
mkdir -p "$HOME/.ghcup/bin"
79+
curl -sL https://downloads.haskell.org/ghcup/0.1.17.3/x86_64-linux-ghcup-0.1.17.3 > "$HOME/.ghcup/bin/ghcup"
80+
chmod a+x "$HOME/.ghcup/bin/ghcup"
81+
"$HOME/.ghcup/bin/ghcup" install ghc "$HCVER"
82+
"$HOME/.ghcup/bin/ghcup" install cabal 3.6.2.0
83+
apt-get update
84+
apt-get install -y freeglut3-dev
85+
else
86+
apt-add-repository -y 'ppa:hvr/ghc'
87+
apt-get update
88+
apt-get install -y "$HCNAME" freeglut3-dev
89+
mkdir -p "$HOME/.ghcup/bin"
90+
curl -sL https://downloads.haskell.org/ghcup/0.1.17.3/x86_64-linux-ghcup-0.1.17.3 > "$HOME/.ghcup/bin/ghcup"
91+
chmod a+x "$HOME/.ghcup/bin/ghcup"
92+
"$HOME/.ghcup/bin/ghcup" install cabal 3.6.2.0
93+
fi
94+
env:
95+
HCKIND: ${{ matrix.compilerKind }}
96+
HCNAME: ${{ matrix.compiler }}
97+
HCVER: ${{ matrix.compilerVersion }}
98+
- name: Set PATH and environment variables
99+
run: |
100+
echo "$HOME/.cabal/bin" >> $GITHUB_PATH
101+
echo "LANG=C.UTF-8" >> "$GITHUB_ENV"
102+
echo "CABAL_DIR=$HOME/.cabal" >> "$GITHUB_ENV"
103+
echo "CABAL_CONFIG=$HOME/.cabal/config" >> "$GITHUB_ENV"
104+
HCDIR=/opt/$HCKIND/$HCVER
105+
if [ "${{ matrix.setup-method }}" = ghcup ]; then
106+
HC=$HOME/.ghcup/bin/$HCKIND-$HCVER
107+
echo "HC=$HC" >> "$GITHUB_ENV"
108+
echo "HCPKG=$HOME/.ghcup/bin/$HCKIND-pkg-$HCVER" >> "$GITHUB_ENV"
109+
echo "HADDOCK=$HOME/.ghcup/bin/haddock-$HCVER" >> "$GITHUB_ENV"
110+
echo "CABAL=$HOME/.ghcup/bin/cabal-3.6.2.0 -vnormal+nowrap" >> "$GITHUB_ENV"
111+
else
112+
HC=$HCDIR/bin/$HCKIND
113+
echo "HC=$HC" >> "$GITHUB_ENV"
114+
echo "HCPKG=$HCDIR/bin/$HCKIND-pkg" >> "$GITHUB_ENV"
115+
echo "HADDOCK=$HCDIR/bin/haddock" >> "$GITHUB_ENV"
116+
echo "CABAL=$HOME/.ghcup/bin/cabal-3.6.2.0 -vnormal+nowrap" >> "$GITHUB_ENV"
117+
fi
118+
119+
HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\d+)\.(\d+)\.(\d+)(\.(\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))')
120+
echo "HCNUMVER=$HCNUMVER" >> "$GITHUB_ENV"
121+
echo "ARG_TESTS=--enable-tests" >> "$GITHUB_ENV"
122+
echo "ARG_BENCH=--enable-benchmarks" >> "$GITHUB_ENV"
123+
echo "HEADHACKAGE=false" >> "$GITHUB_ENV"
124+
echo "ARG_COMPILER=--$HCKIND --with-compiler=$HC" >> "$GITHUB_ENV"
125+
echo "GHCJSARITH=0" >> "$GITHUB_ENV"
126+
env:
127+
HCKIND: ${{ matrix.compilerKind }}
128+
HCNAME: ${{ matrix.compiler }}
129+
HCVER: ${{ matrix.compilerVersion }}
130+
- name: env
131+
run: |
132+
env
133+
- name: write cabal config
134+
run: |
135+
mkdir -p $CABAL_DIR
136+
cat >> $CABAL_CONFIG <<EOF
137+
remote-build-reporting: anonymous
138+
write-ghc-environment-files: never
139+
remote-repo-cache: $CABAL_DIR/packages
140+
logs-dir: $CABAL_DIR/logs
141+
world-file: $CABAL_DIR/world
142+
extra-prog-path: $CABAL_DIR/bin
143+
symlink-bindir: $CABAL_DIR/bin
144+
installdir: $CABAL_DIR/bin
145+
build-summary: $CABAL_DIR/logs/build.log
146+
store-dir: $CABAL_DIR/store
147+
install-dirs user
148+
prefix: $CABAL_DIR
149+
repository hackage.haskell.org
150+
url: http://hackage.haskell.org/
151+
EOF
152+
cat >> $CABAL_CONFIG <<EOF
153+
program-default-options
154+
ghc-options: $GHCJOBS +RTS -M3G -RTS
155+
EOF
156+
cat $CABAL_CONFIG
157+
- name: versions
158+
run: |
159+
$HC --version || true
160+
$HC --print-project-git-commit-id || true
161+
$CABAL --version || true
162+
- name: update cabal index
163+
run: |
164+
$CABAL v2-update -v
165+
- name: install cabal-plan
166+
run: |
167+
mkdir -p $HOME/.cabal/bin
168+
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
169+
echo 'de73600b1836d3f55e32d80385acc055fd97f60eaa0ab68a755302685f5d81bc cabal-plan.xz' | sha256sum -c -
170+
xz -d < cabal-plan.xz > $HOME/.cabal/bin/cabal-plan
171+
rm -f cabal-plan.xz
172+
chmod a+x $HOME/.cabal/bin/cabal-plan
173+
cabal-plan --version
174+
- name: checkout
175+
uses: actions/checkout@v2
176+
with:
177+
path: source
178+
submodules: "true"
179+
- name: initial cabal.project for sdist
180+
run: |
181+
touch cabal.project
182+
echo "packages: $GITHUB_WORKSPACE/source/." >> cabal.project
183+
cat cabal.project
184+
- name: sdist
185+
run: |
186+
mkdir -p sdist
187+
$CABAL sdist all --output-dir $GITHUB_WORKSPACE/sdist
188+
- name: unpack
189+
run: |
190+
mkdir -p unpacked
191+
find sdist -maxdepth 1 -type f -name '*.tar.gz' -exec tar -C $GITHUB_WORKSPACE/unpacked -xzvf {} \;
192+
- name: generate cabal.project
193+
run: |
194+
PKGDIR_OpenGLRaw="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/OpenGLRaw-[0-9.]*')"
195+
echo "PKGDIR_OpenGLRaw=${PKGDIR_OpenGLRaw}" >> "$GITHUB_ENV"
196+
rm -f cabal.project cabal.project.local
197+
touch cabal.project
198+
touch cabal.project.local
199+
echo "packages: ${PKGDIR_OpenGLRaw}" >> cabal.project
200+
if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo "package OpenGLRaw" >> cabal.project ; fi
201+
if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi
202+
cat >> cabal.project <<EOF
203+
EOF
204+
$HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: $_ installed\n" unless /^(OpenGLRaw)$/; }' >> cabal.project.local
205+
cat cabal.project
206+
cat cabal.project.local
207+
- name: dump install plan
208+
run: |
209+
$CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dry-run all
210+
cabal-plan
211+
- name: cache
212+
uses: actions/cache@v2
213+
with:
214+
key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }}
215+
path: ~/.cabal/store
216+
restore-keys: ${{ runner.os }}-${{ matrix.compiler }}-
217+
- name: install dependencies
218+
run: |
219+
$CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --dependencies-only -j2 all
220+
$CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dependencies-only -j2 all
221+
- name: build w/o tests
222+
run: |
223+
$CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all
224+
- name: build
225+
run: |
226+
$CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --write-ghc-environment-files=always
227+
- name: cabal check
228+
run: |
229+
cd ${PKGDIR_OpenGLRaw} || false
230+
${CABAL} -vnormal check
231+
- name: haddock
232+
run: |
233+
$CABAL v2-haddock $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH all
234+
- name: unconstrained build
235+
run: |
236+
rm -f cabal.project.local
237+
$CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all

0 commit comments

Comments
 (0)