Skip to content

Commit f05c264

Browse files
committed
fix #58: Let's try haskell-ci
1 parent 94cb9cd commit f05c264

File tree

5 files changed

+257
-12
lines changed

5 files changed

+257
-12
lines changed

.github/workflows/haskell-ci.yml

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

LICENSE

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
Copyright (c) 2024, Matvey Aksenov
2+
3+
All rights reserved.
4+
5+
Redistribution and use in source and binary forms, with or without
6+
modification, are permitted provided that the following conditions are met:
7+
8+
* Redistributions of source code must retain the above copyright
9+
notice, this list of conditions and the following disclaimer.
10+
11+
* Redistributions in binary form must reproduce the above
12+
copyright notice, this list of conditions and the following
13+
disclaimer in the documentation and/or other materials provided
14+
with the distribution.
15+
16+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

package.yaml

+12-5
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,26 @@ category: Text
66
maintainer: [email protected]
77
copyright: Matvey Aksenov 2022
88
license: BSD2
9-
extra-source-files:
9+
extra-doc-files:
1010
- README.markdown
1111
- CHANGELOG.markdown
1212
github: supki/t
13+
tested-with:
14+
- GHC==9.6.4 # it's actually 9.6.5, but that version is unknown to my haskell-ci
15+
- GHC==9.8.2
1316

1417
custom-setup:
1518
dependencies:
16-
- base
17-
- Cabal
19+
# 4.18 comes with GHC 9.6
20+
- base >= 4.18 && < 5
21+
# 3.10 comes with GHC 9.6
22+
- Cabal >= 3.10 && < 3.11
1823
- directory
1924
- filepath
2025
- process
2126

2227
dependencies:
23-
- base >= 4.14 && < 5
28+
- base >= 4.18 && < 5
2429

2530
default-extensions:
2631
- ImportQualifiedPost
@@ -55,7 +60,7 @@ library:
5560
- vector
5661
source-dirs:
5762
src
58-
other-modules:
63+
generated-exposed-modules:
5964
Meta_t
6065
ghc-options:
6166
- -funbox-strict-fields
@@ -84,6 +89,8 @@ executables:
8489

8590
tests:
8691
spec:
92+
build-tools:
93+
- hspec-discover
8794
dependencies:
8895
- t
8996
- aeson

src/T/Stdlib.hs

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{-# LANGUAGE DuplicateRecordFields #-}
12
{-# LANGUAGE OverloadedRecordDot #-}
23
{-# LANGUAGE RecordWildCards #-}
34
{-# LANGUAGE StrictData #-}

t.cabal

+21-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cabal-version: 1.24
1+
cabal-version: 2.0
22

33
-- This file has been generated from package.yaml by hpack version 0.36.0.
44
--
@@ -14,8 +14,12 @@ bug-reports: https://github.com/supki/t/issues
1414
maintainer: [email protected]
1515
copyright: Matvey Aksenov 2022
1616
license: BSD2
17+
license-file: LICENSE
1718
build-type: Custom
18-
extra-source-files:
19+
tested-with:
20+
GHC==9.6.4
21+
, GHC==9.8.2
22+
extra-doc-files:
1923
README.markdown
2024
CHANGELOG.markdown
2125

@@ -25,8 +29,8 @@ source-repository head
2529

2630
custom-setup
2731
setup-depends:
28-
Cabal
29-
, base
32+
Cabal ==3.10.*
33+
, base >=4.18 && <5
3034
, directory
3135
, filepath
3236
, process
@@ -60,7 +64,11 @@ library
6064
T.Tmpl
6165
T.Type
6266
T.Value
67+
Meta_t
6368
other-modules:
69+
Paths_t
70+
autogen-modules:
71+
Paths_t
6472
Meta_t
6573
hs-source-dirs:
6674
src
@@ -75,7 +83,7 @@ library
7583
build-depends:
7684
aeson
7785
, aeson-pretty
78-
, base >=4.14 && <5
86+
, base >=4.18 && <5
7987
, bytestring
8088
, containers
8189
, directory
@@ -102,6 +110,8 @@ executable t
102110
other-modules:
103111
Opts
104112
Paths_t
113+
autogen-modules:
114+
Paths_t
105115
hs-source-dirs:
106116
driver
107117
default-extensions:
@@ -114,7 +124,7 @@ executable t
114124
ghc-options: -Wall -Wno-incomplete-uni-patterns -threaded -with-rtsopts=-N
115125
build-depends:
116126
aeson
117-
, base >=4.14 && <5
127+
, base >=4.18 && <5
118128
, directory
119129
, filepath
120130
, optparse-applicative
@@ -130,6 +140,8 @@ test-suite spec
130140
T.RenderSpec
131141
T.SExpSpec
132142
Paths_t
143+
autogen-modules:
144+
Paths_t
133145
hs-source-dirs:
134146
test
135147
default-extensions:
@@ -140,10 +152,12 @@ test-suite spec
140152
OverloadedStrings
141153
TypeOperators
142154
ghc-options: -Wall -Wno-incomplete-uni-patterns -threaded -with-rtsopts=-N
155+
build-tool-depends:
156+
hspec-discover:hspec-discover
143157
build-depends:
144158
aeson
145159
, aeson-qq
146-
, base >=4.14 && <5
160+
, base >=4.18 && <5
147161
, bytestring
148162
, hspec
149163
, pcre-light

0 commit comments

Comments
 (0)