Skip to content

Commit 1f8c8ed

Browse files
authored
Update maintainer and add CI (#11)
2 parents 4f6a00f + cc1f521 commit 1f8c8ed

5 files changed

Lines changed: 228 additions & 15 deletions

File tree

.github/workflows/haskell-ci.yml

Lines changed: 214 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,214 @@
1+
# This GitHub workflow config has been generated by a script via
2+
#
3+
# haskell-ci 'github' 'StrictCheck.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.19.20250821
12+
#
13+
# REGENDATA ("0.19.20250821",["github","StrictCheck.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 - ${{ matrix.compiler }}
26+
runs-on: ubuntu-24.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.12.2
36+
compilerKind: ghc
37+
compilerVersion: 9.12.2
38+
setup-method: ghcup
39+
allow-failure: false
40+
- compiler: ghc-9.6.7
41+
compilerKind: ghc
42+
compilerVersion: 9.6.7
43+
setup-method: ghcup
44+
allow-failure: false
45+
- compiler: ghc-9.2.8
46+
compilerKind: ghc
47+
compilerVersion: 9.2.8
48+
setup-method: ghcup
49+
allow-failure: false
50+
fail-fast: false
51+
steps:
52+
- name: apt-get install
53+
run: |
54+
apt-get update
55+
apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common libtinfo5
56+
- name: Install GHCup
57+
run: |
58+
mkdir -p "$HOME/.ghcup/bin"
59+
curl -sL https://downloads.haskell.org/ghcup/0.1.50.1/x86_64-linux-ghcup-0.1.50.1 > "$HOME/.ghcup/bin/ghcup"
60+
chmod a+x "$HOME/.ghcup/bin/ghcup"
61+
- name: Install cabal-install
62+
run: |
63+
"$HOME/.ghcup/bin/ghcup" install cabal 3.16.0.0 || (cat "$HOME"/.ghcup/logs/*.* && false)
64+
echo "CABAL=$HOME/.ghcup/bin/cabal-3.16.0.0 -vnormal+nowrap" >> "$GITHUB_ENV"
65+
- name: Install GHC (GHCup)
66+
if: matrix.setup-method == 'ghcup'
67+
run: |
68+
"$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false)
69+
HC=$("$HOME/.ghcup/bin/ghcup" whereis ghc "$HCVER")
70+
HCPKG=$(echo "$HC" | sed 's#ghc$#ghc-pkg#')
71+
HADDOCK=$(echo "$HC" | sed 's#ghc$#haddock#')
72+
echo "HC=$HC" >> "$GITHUB_ENV"
73+
echo "HCPKG=$HCPKG" >> "$GITHUB_ENV"
74+
echo "HADDOCK=$HADDOCK" >> "$GITHUB_ENV"
75+
env:
76+
HCKIND: ${{ matrix.compilerKind }}
77+
HCNAME: ${{ matrix.compiler }}
78+
HCVER: ${{ matrix.compilerVersion }}
79+
- name: Set PATH and environment variables
80+
run: |
81+
echo "$HOME/.cabal/bin" >> $GITHUB_PATH
82+
echo "LANG=C.UTF-8" >> "$GITHUB_ENV"
83+
echo "CABAL_DIR=$HOME/.cabal" >> "$GITHUB_ENV"
84+
echo "CABAL_CONFIG=$HOME/.cabal/config" >> "$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 "HEADHACKAGE=false" >> "$GITHUB_ENV"
90+
echo "ARG_COMPILER=--$HCKIND --with-compiler=$HC" >> "$GITHUB_ENV"
91+
env:
92+
HCKIND: ${{ matrix.compilerKind }}
93+
HCNAME: ${{ matrix.compiler }}
94+
HCVER: ${{ matrix.compilerVersion }}
95+
- name: env
96+
run: |
97+
env
98+
- name: write cabal config
99+
run: |
100+
mkdir -p $CABAL_DIR
101+
cat >> $CABAL_CONFIG <<EOF
102+
remote-build-reporting: anonymous
103+
write-ghc-environment-files: never
104+
remote-repo-cache: $CABAL_DIR/packages
105+
logs-dir: $CABAL_DIR/logs
106+
world-file: $CABAL_DIR/world
107+
extra-prog-path: $CABAL_DIR/bin
108+
symlink-bindir: $CABAL_DIR/bin
109+
installdir: $CABAL_DIR/bin
110+
build-summary: $CABAL_DIR/logs/build.log
111+
store-dir: $CABAL_DIR/store
112+
install-dirs user
113+
prefix: $CABAL_DIR
114+
repository hackage.haskell.org
115+
url: http://hackage.haskell.org/
116+
EOF
117+
cat >> $CABAL_CONFIG <<EOF
118+
program-default-options
119+
ghc-options: $GHCJOBS +RTS -M3G -RTS
120+
EOF
121+
cat $CABAL_CONFIG
122+
- name: versions
123+
run: |
124+
$HC --version || true
125+
$HC --print-project-git-commit-id || true
126+
$CABAL --version || true
127+
- name: update cabal index
128+
run: |
129+
$CABAL v2-update -v
130+
- name: install cabal-plan
131+
run: |
132+
mkdir -p $HOME/.cabal/bin
133+
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
134+
echo 'f62ccb2971567a5f638f2005ad3173dba14693a45154c1508645c52289714cb2 cabal-plan.xz' | sha256sum -c -
135+
xz -d < cabal-plan.xz > $HOME/.cabal/bin/cabal-plan
136+
rm -f cabal-plan.xz
137+
chmod a+x $HOME/.cabal/bin/cabal-plan
138+
cabal-plan --version
139+
- name: checkout
140+
uses: actions/checkout@v4
141+
with:
142+
path: source
143+
- name: initial cabal.project for sdist
144+
run: |
145+
touch cabal.project
146+
echo "packages: $GITHUB_WORKSPACE/source/." >> cabal.project
147+
cat cabal.project
148+
- name: sdist
149+
run: |
150+
mkdir -p sdist
151+
$CABAL sdist all --output-dir $GITHUB_WORKSPACE/sdist
152+
- name: unpack
153+
run: |
154+
mkdir -p unpacked
155+
find sdist -maxdepth 1 -type f -name '*.tar.gz' -exec tar -C $GITHUB_WORKSPACE/unpacked -xzvf {} \;
156+
- name: generate cabal.project
157+
run: |
158+
PKGDIR_StrictCheck="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/StrictCheck-[0-9.]*')"
159+
echo "PKGDIR_StrictCheck=${PKGDIR_StrictCheck}" >> "$GITHUB_ENV"
160+
rm -f cabal.project cabal.project.local
161+
touch cabal.project
162+
touch cabal.project.local
163+
echo "packages: ${PKGDIR_StrictCheck}" >> cabal.project
164+
echo "package StrictCheck" >> cabal.project
165+
echo " ghc-options: -Werror=missing-methods -Werror=missing-fields" >> cabal.project
166+
if [ $((HCNUMVER >= 90600)) -ne 0 ] ; then echo "package StrictCheck" >> cabal.project ; fi
167+
if [ $((HCNUMVER >= 90600)) -ne 0 ] ; then echo " ghc-options: -Werror=unused-packages" >> cabal.project ; fi
168+
echo "package StrictCheck" >> cabal.project
169+
echo " ghc-options: -Werror=incomplete-patterns -Werror=incomplete-uni-patterns" >> cabal.project
170+
cat >> cabal.project <<EOF
171+
EOF
172+
$HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: any.$_ installed\n" unless /^(StrictCheck)$/; }' >> cabal.project.local
173+
cat cabal.project
174+
cat cabal.project.local
175+
- name: dump install plan
176+
run: |
177+
$CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dry-run all
178+
cabal-plan
179+
- name: restore cache
180+
uses: actions/cache/restore@v4
181+
with:
182+
key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }}
183+
path: ~/.cabal/store
184+
restore-keys: ${{ runner.os }}-${{ matrix.compiler }}-
185+
- name: install dependencies
186+
run: |
187+
$CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --dependencies-only -j2 all
188+
$CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dependencies-only -j2 all
189+
- name: build w/o tests
190+
run: |
191+
$CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all
192+
- name: build
193+
run: |
194+
$CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --write-ghc-environment-files=always
195+
- name: tests
196+
run: |
197+
$CABAL v2-test $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --test-show-details=direct
198+
- name: cabal check
199+
run: |
200+
cd ${PKGDIR_StrictCheck} || false
201+
${CABAL} -vnormal check
202+
- name: haddock
203+
run: |
204+
$CABAL v2-haddock --disable-documentation --haddock-all $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH all
205+
- name: unconstrained build
206+
run: |
207+
rm -f cabal.project.local
208+
$CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all
209+
- name: save cache
210+
if: always()
211+
uses: actions/cache/save@v4
212+
with:
213+
key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }}
214+
path: ~/.cabal/store

StrictCheck.cabal

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,13 @@ homepage: https://github.com/kwf/StrictCheck#readme
1111
license: MIT
1212
license-file: LICENSE
1313
author: Kenneth Foner, Hengchu Zhang, and Leo Lampropoulos
14-
maintainer: kwf@very.science
14+
maintainer: lysxia@gmail.com
1515
copyright: (c) 2018 Kenneth Foner, Hengchu Zhang, and Leo Lampropoulos
1616
category: Testing
1717
build-type: Simple
1818
cabal-version: >=1.10
1919
extra-source-files: README.md
20+
tested-with: GHC == 9.12.2, GHC == 9.6.7, GHC == 9.2.8
2021

2122
source-repository this
2223
type: git
@@ -32,7 +33,7 @@ library
3233
containers >= 0.5 && < 0.9,
3334
generics-sop >= 0.3.2 && < 0.6,
3435
bifunctors >= 5.5 && < 5.7,
35-
template-haskell >= 2.12 && < 2.24
36+
template-haskell >= 2.18 && < 2.24
3637
exposed-modules: Test.StrictCheck
3738
Test.StrictCheck.Curry,
3839
Test.StrictCheck.Consume,
@@ -79,8 +80,5 @@ test-suite test-strictcheck
7980
PatternSynonyms
8081
ghc-options: -Wall -fno-warn-unused-imports -O2
8182
build-depends: base,
82-
HUnit,
83-
generics-sop,
84-
deepseq,
8583
StrictCheck,
8684
QuickCheck

cabal.haskell-ci

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
branches: master

src/Test/StrictCheck/Produce.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,9 @@ draws inputs = go [inputs]
167167
pick :: [a] -> Gen (a, [a])
168168
pick as = do
169169
index <- choose (0, length as - 1)
170-
let (before, picked : after) = splitAt index as
171-
return (picked, before ++ after)
172-
170+
case splitAt index as of
171+
(before, picked : after) -> return (picked, before ++ after)
172+
_ -> error "pick: empty list"
173173

174174

175175
---------------------------------------------

src/Test/StrictCheck/TH.hs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,13 @@ constructor2PatternDec ty idx (NormalC conName argTypes) = do
7575
constructor2PatternDec ty idx (InfixC argType1 conName argType2) = do
7676
let argTypes = [argType1, argType2]
7777
(npPat, names) <- productPattern (map snd argTypes)
78-
when (length names /= 2) $
79-
reportError "The impossible happened: Infix Pattern have more than 2 binders"
80-
let nm1 : nm2 : _ = names
81-
return
82-
( PatSynSigD patDecName (patternTypeDec (map snd argTypes) ty),
83-
infixPatternDec idx patDecName nm1 nm2 npPat
84-
)
78+
case names of
79+
nm1 : nm2 : [] ->
80+
return
81+
( PatSynSigD patDecName (patternTypeDec (map snd argTypes) ty),
82+
infixPatternDec idx patDecName nm1 nm2 npPat
83+
)
84+
_ -> fail "The impossible happened: Infix Pattern have more than 2 binders"
8585
where
8686
patDecName = mkName (nameBase conName ++ "%")
8787
constructor2PatternDec _ _ _ =

0 commit comments

Comments
 (0)