Skip to content

Commit f7a574f

Browse files
Update .cabal file, enable GitHub CI (#1)
2 parents 96b3c23 + a2565a2 commit f7a574f

File tree

2 files changed

+128
-16
lines changed

2 files changed

+128
-16
lines changed

.github/workflows/haskell.yml

+85
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: Haskell CI
2+
on:
3+
push:
4+
branches: [ master ]
5+
pull_request:
6+
branches: [ master ]
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
build:
13+
name: GHC ${{ matrix.ghc-version }} on ${{ matrix.os }}
14+
runs-on: ${{ matrix.os }}
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
os: [ubuntu-latest]
19+
ghc-version:
20+
[ "9.0"
21+
, "9.2"
22+
, "9.4"
23+
, "9.6"
24+
, "9.8"
25+
, "9.10"
26+
, "9.12"
27+
]
28+
29+
steps:
30+
- uses: actions/checkout@v4
31+
32+
- name: Set up GHC ${{ matrix.ghc-version }}
33+
uses: haskell-actions/setup@v2
34+
id: setup
35+
with:
36+
ghc-version: ${{ matrix.ghc-version }}
37+
# Defaults, added for clarity:
38+
cabal-version: 'latest'
39+
cabal-update: true
40+
41+
- name: Check cabal file
42+
run: cabal check
43+
44+
- name: Configure the build
45+
run: |
46+
cabal configure --enable-tests --enable-benchmarks --disable-documentation --flag=pedantic
47+
cabal build --dry-run
48+
# The last step generates dist-newstyle/cache/plan.json for the cache key.
49+
50+
- name: Restore cached dependencies
51+
uses: actions/cache/restore@v4
52+
id: cache
53+
env:
54+
key: ${{ runner.os }}-ghc-${{ steps.setup.outputs.ghc-version }}-cabal-${{ steps.setup.outputs.cabal-version }}
55+
with:
56+
path: ${{ steps.setup.outputs.cabal-store }}
57+
key: ${{ env.key }}-plan-${{ hashFiles('**/plan.json') }}
58+
restore-keys: ${{ env.key }}-
59+
60+
- name: Install dependencies
61+
# If we had an exact cache hit, the dependencies will be up to date.
62+
if: steps.cache.outputs.cache-hit != 'true'
63+
run: cabal build all --only-dependencies
64+
65+
# Cache dependencies already here, so that we do not have to rebuild them should the subsequent steps fail.
66+
- name: Save cached dependencies
67+
uses: actions/cache/save@v4
68+
# If we had an exact cache hit, trying to save the cache would error because of key clash.
69+
if: steps.cache.outputs.cache-hit != 'true'
70+
with:
71+
path: ${{ steps.setup.outputs.cabal-store }}
72+
key: ${{ steps.cache.outputs.cache-primary-key }}
73+
74+
- name: Build
75+
run: cabal build all
76+
77+
- name: Run tests
78+
run: cabal test all --test-show-details=streaming
79+
80+
- name: Build documentation
81+
run:
82+
cabal haddock all --disable-documentation
83+
# --disable-documentation disables building documentation for dependencies.
84+
# The package's own documentation is still built,
85+
# yet contains no links to the documentation of the dependencies.

random-build.cabal

+43-16
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@ cabal-version: 3.4
22
name: random-build
33
version: 0.1.0.0
44
synopsis:
5-
A tool to build random Haskell packages in a gentoo repository and evaluate the success rate.
5+
Build random packages in a Gentoo repository and evaluate the success rate
66

77
description:
8-
A tool to build random Haskell packages in a gentoo repository and
9-
evaluate the success rate.
8+
A tool to build random packages in a Gentoo repository and
9+
evaluate the success rate. Currently, it only supports the ::haskell repo,
10+
but support for other repos may be added in the future.
1011

1112
homepage:
1213
https://github.com/gentoo-haskell/random-build
@@ -16,14 +17,40 @@ license-file: LICENSE
1617
author: Xavier Dectot
1718
maintainer: [email protected]
1819

19-
-- copyright:
20+
copyright:
21+
Copyright 2025 Xavier Dectot
22+
Copyright 2025 Gentoo Authors
23+
2024
category: Development
2125
build-type: Simple
22-
extra-doc-files: CHANGELOG.md
26+
extra-doc-files:
27+
CHANGELOG.md
28+
README.md
29+
30+
tested-with:
31+
, GHC ==9.0.2
32+
, GHC ==9.2.8
33+
, GHC ==9.4.8
34+
, GHC ==9.6.6
35+
, GHC ==9.8.4
36+
, GHC ==9.10.1
37+
, GHC ==9.12.1
38+
39+
source-repository head
40+
type: git
41+
location: https://github.com/gentoo-haskell/random-build.git
42+
43+
flag pedantic
44+
description: Enable -Werror
45+
default: False
46+
manual: True
2347

2448
common warnings
2549
ghc-options: -Wall
2650

51+
if flag(pedantic)
52+
ghc-options: -Werror
53+
2754
library
2855
import:  warnings
2956
exposed-modules:
@@ -35,25 +62,25 @@ library
3562
GHRB.IO.Utils
3663

3764
build-depends:
38-
, base >=4.17.0.0
39-
, bytestring ^>=0.12.1.0
65+
, base >=4.15.1.0 && <4.22
66+
, bytestring >=0.10.12.1 && <0.13
4067
, conduit ^>=1.3.6
4168
, conduit-extra ^>=1.3.7
4269
, effectful ^>=2.5.1.0
4370
, effectful-core ^>=2.5.0
4471
, flatparse ^>=0.5.2.1
4572
, monad-time-effectful ^>=1.0.0.0
46-
, mtl ^>=2.3.1
73+
, mtl >=2.2.2 && <2.4
4774
, optparse-applicative ^>=0.18.1.0
4875
, portage-hs ^>=0.1.0.0
4976
, prettyprinter ^>=1.7.0
5077
, prettyprinter-ansi-terminal ^>=1.1.3
51-
, process ^>=1.6.25.0
52-
, text ^>=2.1.1
53-
, time ^>=1.12
78+
, process >=1.6.13.2 && <1.7
79+
, text >=1.2.5.0 && <2.2
80+
, time >=1.9.3 && <1.15
5481
, time-compat ^>=1.9.8
5582
, transformers ^>=0.6.1.0
56-
, unix ^>=2.8.6.0
83+
, unix >=2.7.2.2 && <2.9
5784
, unordered-containers ^>=0.2.20
5885

5986
hs-source-dirs: src
@@ -63,16 +90,16 @@ executable random-build
6390
import: warnings
6491
main-is:  Main.hs
6592
build-depends:
66-
, base >=4.17.0.0
67-
, bytestring ^>=0.12.1.0
93+
, base >=4.15.1.0 && <4.22
94+
, bytestring >=0.10.12.1 && <0.13
6895
, effectful ^>=2.5.1.0
6996
, effectful-core ^>=2.5.0
7097
, random-build
7198
, list-shuffle ^>=1.0.0.0
7299
, monad-time-effectful ^>=1.0.0.0
73-
, mtl ^>=2.3.1
100+
, mtl >=2.2.2 && <2.4
74101
, optparse-applicative ^>=0.18.1.0
75-
, unix ^>=2.8.6.0
102+
, unix >=2.7.2.2 && <2.9
76103
, unordered-containers ^>=0.2.20
77104

78105
hs-source-dirs: app

0 commit comments

Comments
 (0)