Skip to content

Commit 5d0c71e

Browse files
committed
Bump Cabal and filepath for GHC 9.10; add Haskell CI
1 parent f33d650 commit 5d0c71e

File tree

4 files changed

+270
-14
lines changed

4 files changed

+270
-14
lines changed

.github/workflows/haskell-ci.yml

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

.travis.yml

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

cabal.haskell-ci

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
branches: main
2+
cabal-check: False
3+
haddock: >=8.2

entropy.cabal

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
cabal-version: >=1.10
12
name: entropy
2-
33
version: 0.4.1.10
4+
x-revision: 2
45
description: A mostly platform independent method to obtain cryptographically strong entropy
56
(RDRAND, urandom, CryptAPI, and patches welcome)
67
Users looking for cryptographically strong (number-theoretically
@@ -18,11 +19,26 @@ stability: stable
1819

1920
build-type: Custom
2021

21-
-- ^^ Test for RDRAND support using 'ghc'
22-
cabal-version: >=1.10
23-
tested-with: GHC == 8.2.2
24-
-- data-files:
25-
extra-source-files: ./cbits/getrandom.c ./cbits/random_initialized.c ./cbits/rdrand.c, ./cbits/rdrand.h, README.md
22+
tested-with:
23+
GHC == 9.10.1
24+
GHC == 9.8.2
25+
GHC == 9.6.5
26+
GHC == 9.4.8
27+
GHC == 9.2.8
28+
GHC == 9.0.2
29+
GHC == 8.10.7
30+
GHC == 8.8.4
31+
GHC == 8.6.5
32+
GHC == 8.4.4
33+
GHC == 8.2.2
34+
GHC == 8.0.2
35+
36+
extra-source-files:
37+
./cbits/getrandom.c
38+
./cbits/random_initialized.c
39+
./cbits/rdrand.c
40+
./cbits/rdrand.h
41+
README.md
2642

2743
Flag DoNotGetEntropy
2844
Description: Avoid use of the getentropy() *nix function. By default getentropy will be used
@@ -31,9 +47,9 @@ Flag DoNotGetEntropy
3147
Manual: True
3248

3349
custom-setup
34-
setup-depends: Cabal >= 1.10 && < 3.11
50+
setup-depends: Cabal >= 1.10 && < 3.13
3551
, base < 5
36-
, filepath < 1.5
52+
, filepath < 1.6
3753
, directory < 1.4
3854
, process < 1.7
3955

0 commit comments

Comments
 (0)