Skip to content

Commit f969e98

Browse files
committed
CI: regenerate and bump compiler test matrix
1 parent 85e2c1d commit f969e98

File tree

1 file changed

+214
-91
lines changed

1 file changed

+214
-91
lines changed

.github/workflows/ci.yml

Lines changed: 214 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -1,96 +1,219 @@
1-
name: CI
2-
3-
# Trigger the workflow on push or pull request, but only for the master branch
1+
# This GitHub workflow config has been generated by a script via
2+
#
3+
# haskell-ci 'github' 'ffmpeg-light.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.14
12+
#
13+
# REGENDATA ("0.14",["github","ffmpeg-light.cabal"])
14+
#
15+
name: Haskell-CI
416
on:
5-
pull_request:
6-
push:
7-
branches: [master]
8-
17+
- push
18+
- pull_request
919
jobs:
10-
cabal:
11-
name: ${{ matrix.os }} / ghc ${{ matrix.ghc }}
12-
runs-on: ${{ matrix.os }}
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:bionic
27+
continue-on-error: ${{ matrix.allow-failure }}
1328
strategy:
1429
matrix:
15-
os: [ubuntu-latest]
16-
cabal: ["3.2"]
17-
ghc:
18-
- "8.0.2"
19-
- "8.2.2"
20-
- "8.4.2"
21-
- "8.10.4"
22-
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.2
37+
compilerKind: ghc
38+
compilerVersion: 9.0.2
39+
setup-method: ghcup
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+
fail-fast: false
2357
steps:
24-
- uses: actions/checkout@v2
25-
if: github.event.action == 'opened' || github.event.action == 'synchronize' || github.event.ref == 'refs/heads/master'
26-
27-
- name: Setup ffmpeg
28-
run: |
29-
sudo apt-get update
30-
sudo apt-get install ffmpeg libavutil-dev libavformat-dev libavcodec-dev libswscale-dev libavdevice-dev
31-
32-
- uses: actions/setup-haskell@v1
33-
id: setup-haskell-cabal
34-
name: Setup Haskell
35-
with:
36-
ghc-version: ${{ matrix.ghc }}
37-
cabal-version: ${{ matrix.cabal }}
38-
39-
- name: Freeze
40-
run: |
41-
cabal update
42-
cabal configure --enable-tests --enable-benchmarks --test-show-details=direct
43-
cabal freeze
44-
45-
- uses: actions/cache@v1
46-
name: Cache ~/.cabal/store
47-
with:
48-
path: ${{ steps.setup-haskell-cabal.outputs.cabal-store }}
49-
key: ${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('cabal.project.freeze') }}
50-
51-
- name: Build
52-
run: |
53-
cabal build all
54-
55-
- name: Test
56-
run: |
57-
cabal test all
58-
59-
stack:
60-
name: stack / ghc ${{ matrix.ghc }}
61-
runs-on: ubuntu-latest
62-
strategy:
63-
# only test stack with one OS and one GHC version; if it works with
64-
# cabal, it probably also works with stack.
65-
matrix:
66-
stack: ["2.3.1"]
67-
ghc: ["8.0.2"]
68-
69-
steps:
70-
- uses: actions/checkout@v2
71-
if: github.event.action == 'opened' || github.event.action == 'synchronize' || github.event.ref == 'refs/heads/master'
72-
73-
- name: Setup ffmpeg
74-
run: |
75-
sudo apt-get update
76-
sudo apt-get install ffmpeg libsdl2-dev libavutil-dev libavformat-dev libavcodec-dev libswscale-dev libavdevice-dev
77-
78-
- uses: actions/setup-haskell@v1
79-
name: Setup Haskell Stack
80-
with:
81-
ghc-version: ${{ matrix.ghc }}
82-
stack-version: ${{ matrix.stack }}
83-
84-
- uses: actions/cache@v1
85-
name: Cache ~/.stack
86-
with:
87-
path: ~/.stack
88-
key: ${{ runner.os }}-${{ matrix.ghc }}-stack
89-
90-
- name: Build
91-
run: |
92-
stack build --system-ghc --test --bench --no-run-tests --no-run-benchmarks
93-
94-
- name: Test
95-
run: |
96-
stack test --system-ghc
58+
- name: apt
59+
run: |
60+
apt-get update
61+
apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common libtinfo5 ffmpeg libavutil-dev libavformat-dev libavcodec-dev libswscale-dev libavdevice-dev
62+
if [ "${{ matrix.setup-method }}" = ghcup ]; then
63+
mkdir -p "$HOME/.ghcup/bin"
64+
curl -sL https://downloads.haskell.org/ghcup/0.1.17.3/x86_64-linux-ghcup-0.1.17.3 > "$HOME/.ghcup/bin/ghcup"
65+
chmod a+x "$HOME/.ghcup/bin/ghcup"
66+
"$HOME/.ghcup/bin/ghcup" install ghc "$HCVER"
67+
"$HOME/.ghcup/bin/ghcup" install cabal 3.6.2.0
68+
else
69+
apt-add-repository -y 'ppa:hvr/ghc'
70+
apt-get update
71+
apt-get install -y "$HCNAME"
72+
mkdir -p "$HOME/.ghcup/bin"
73+
curl -sL https://downloads.haskell.org/ghcup/0.1.17.3/x86_64-linux-ghcup-0.1.17.3 > "$HOME/.ghcup/bin/ghcup"
74+
chmod a+x "$HOME/.ghcup/bin/ghcup"
75+
"$HOME/.ghcup/bin/ghcup" install cabal 3.6.2.0
76+
fi
77+
env:
78+
HCKIND: ${{ matrix.compilerKind }}
79+
HCNAME: ${{ matrix.compiler }}
80+
HCVER: ${{ matrix.compilerVersion }}
81+
- name: Set PATH and environment variables
82+
run: |
83+
echo "$HOME/.cabal/bin" >> $GITHUB_PATH
84+
echo "LANG=C.UTF-8" >> "$GITHUB_ENV"
85+
echo "CABAL_DIR=$HOME/.cabal" >> "$GITHUB_ENV"
86+
echo "CABAL_CONFIG=$HOME/.cabal/config" >> "$GITHUB_ENV"
87+
HCDIR=/opt/$HCKIND/$HCVER
88+
if [ "${{ matrix.setup-method }}" = ghcup ]; then
89+
HC=$HOME/.ghcup/bin/$HCKIND-$HCVER
90+
echo "HC=$HC" >> "$GITHUB_ENV"
91+
echo "HCPKG=$HOME/.ghcup/bin/$HCKIND-pkg-$HCVER" >> "$GITHUB_ENV"
92+
echo "HADDOCK=$HOME/.ghcup/bin/haddock-$HCVER" >> "$GITHUB_ENV"
93+
echo "CABAL=$HOME/.ghcup/bin/cabal-3.6.2.0 -vnormal+nowrap" >> "$GITHUB_ENV"
94+
else
95+
HC=$HCDIR/bin/$HCKIND
96+
echo "HC=$HC" >> "$GITHUB_ENV"
97+
echo "HCPKG=$HCDIR/bin/$HCKIND-pkg" >> "$GITHUB_ENV"
98+
echo "HADDOCK=$HCDIR/bin/haddock" >> "$GITHUB_ENV"
99+
echo "CABAL=$HOME/.ghcup/bin/cabal-3.6.2.0 -vnormal+nowrap" >> "$GITHUB_ENV"
100+
fi
101+
102+
HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\d+)\.(\d+)\.(\d+)(\.(\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))')
103+
echo "HCNUMVER=$HCNUMVER" >> "$GITHUB_ENV"
104+
echo "ARG_TESTS=--enable-tests" >> "$GITHUB_ENV"
105+
echo "ARG_BENCH=--enable-benchmarks" >> "$GITHUB_ENV"
106+
echo "HEADHACKAGE=false" >> "$GITHUB_ENV"
107+
echo "ARG_COMPILER=--$HCKIND --with-compiler=$HC" >> "$GITHUB_ENV"
108+
echo "GHCJSARITH=0" >> "$GITHUB_ENV"
109+
env:
110+
HCKIND: ${{ matrix.compilerKind }}
111+
HCNAME: ${{ matrix.compiler }}
112+
HCVER: ${{ matrix.compilerVersion }}
113+
- name: env
114+
run: |
115+
env
116+
- name: write cabal config
117+
run: |
118+
mkdir -p $CABAL_DIR
119+
cat >> $CABAL_CONFIG <<EOF
120+
remote-build-reporting: anonymous
121+
write-ghc-environment-files: never
122+
remote-repo-cache: $CABAL_DIR/packages
123+
logs-dir: $CABAL_DIR/logs
124+
world-file: $CABAL_DIR/world
125+
extra-prog-path: $CABAL_DIR/bin
126+
symlink-bindir: $CABAL_DIR/bin
127+
installdir: $CABAL_DIR/bin
128+
build-summary: $CABAL_DIR/logs/build.log
129+
store-dir: $CABAL_DIR/store
130+
install-dirs user
131+
prefix: $CABAL_DIR
132+
repository hackage.haskell.org
133+
url: http://hackage.haskell.org/
134+
EOF
135+
cat >> $CABAL_CONFIG <<EOF
136+
program-default-options
137+
ghc-options: $GHCJOBS +RTS -M3G -RTS
138+
EOF
139+
cat $CABAL_CONFIG
140+
- name: versions
141+
run: |
142+
$HC --version || true
143+
$HC --print-project-git-commit-id || true
144+
$CABAL --version || true
145+
- name: update cabal index
146+
run: |
147+
$CABAL v2-update -v
148+
- name: install cabal-plan
149+
run: |
150+
mkdir -p $HOME/.cabal/bin
151+
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
152+
echo 'de73600b1836d3f55e32d80385acc055fd97f60eaa0ab68a755302685f5d81bc cabal-plan.xz' | sha256sum -c -
153+
xz -d < cabal-plan.xz > $HOME/.cabal/bin/cabal-plan
154+
rm -f cabal-plan.xz
155+
chmod a+x $HOME/.cabal/bin/cabal-plan
156+
cabal-plan --version
157+
- name: checkout
158+
uses: actions/checkout@v2
159+
with:
160+
path: source
161+
- name: initial cabal.project for sdist
162+
run: |
163+
touch cabal.project
164+
echo "packages: $GITHUB_WORKSPACE/source/." >> cabal.project
165+
cat cabal.project
166+
- name: sdist
167+
run: |
168+
mkdir -p sdist
169+
$CABAL sdist all --output-dir $GITHUB_WORKSPACE/sdist
170+
- name: unpack
171+
run: |
172+
mkdir -p unpacked
173+
find sdist -maxdepth 1 -type f -name '*.tar.gz' -exec tar -C $GITHUB_WORKSPACE/unpacked -xzvf {} \;
174+
- name: generate cabal.project
175+
run: |
176+
PKGDIR_ffmpeg_light="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/ffmpeg-light-[0-9.]*')"
177+
echo "PKGDIR_ffmpeg_light=${PKGDIR_ffmpeg_light}" >> "$GITHUB_ENV"
178+
rm -f cabal.project cabal.project.local
179+
touch cabal.project
180+
touch cabal.project.local
181+
echo "packages: ${PKGDIR_ffmpeg_light}" >> cabal.project
182+
echo "package ffmpeg-light" >> cabal.project
183+
echo " ghc-options: -Werror=missing-methods" >> cabal.project
184+
cat >> cabal.project <<EOF
185+
EOF
186+
$HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: $_ installed\n" unless /^(ffmpeg-light)$/; }' >> cabal.project.local
187+
cat cabal.project
188+
cat cabal.project.local
189+
- name: dump install plan
190+
run: |
191+
$CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dry-run all
192+
cabal-plan
193+
- name: cache
194+
uses: actions/cache@v2
195+
with:
196+
key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }}
197+
path: ~/.cabal/store
198+
restore-keys: ${{ runner.os }}-${{ matrix.compiler }}-
199+
- name: install dependencies
200+
run: |
201+
$CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --dependencies-only -j2 all
202+
$CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dependencies-only -j2 all
203+
- name: build w/o tests
204+
run: |
205+
$CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all
206+
- name: build
207+
run: |
208+
$CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --write-ghc-environment-files=always
209+
- name: cabal check
210+
run: |
211+
cd ${PKGDIR_ffmpeg_light} || false
212+
${CABAL} -vnormal check
213+
- name: haddock
214+
run: |
215+
$CABAL v2-haddock $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH all
216+
- name: unconstrained build
217+
run: |
218+
rm -f cabal.project.local
219+
$CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all

0 commit comments

Comments
 (0)