Skip to content

Commit 2aa941a

Browse files
Implement coveralls support
1 parent 2b68967 commit 2aa941a

File tree

2 files changed

+128
-3
lines changed

2 files changed

+128
-3
lines changed

.github/workflows/haskell-ci.yml

Lines changed: 61 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
name: Haskell-CI
2+
permissions:
3+
contents: read
24

35
on:
46
push:
@@ -15,13 +17,13 @@ concurrency:
1517
cancel-in-progress: true
1618

1719
jobs:
18-
linux:
19-
name: Haskell-CI - Linux - ${{ matrix.ghc-version }}
20+
test-with-cabal:
21+
name: Haskell-CI - Linux - cabal - ${{ matrix.ghc-version }}
2022

2123
strategy:
2224
matrix:
2325
ghc-version: [latest, 9.12, "9.10", 9.8, 9.6]
24-
os: [ubuntu-24.04]
26+
os: [ubuntu-latest]
2527
fail-fast: false
2628

2729
runs-on: ${{ matrix.os }}
@@ -43,3 +45,59 @@ jobs:
4345
with:
4446
key: ${{ matrix.os }}-${{ matrix.ghc-version }}-${{ github.sha }}
4547
path: ~/.cabal/store
48+
49+
50+
test-with-stack:
51+
name: Stack
52+
runs-on: ${{ matrix.os }}
53+
strategy:
54+
fail-fast: false
55+
matrix:
56+
os: [ubuntu-latest]
57+
resolver: [lts-24, nightly]
58+
ghc-version: [latest, 9.12, "9.10", 9.8, 9.6]
59+
env:
60+
STACK_ARGS: '--resolver ${{ matrix.resolver }} --system-ghc'
61+
steps:
62+
- uses: actions/checkout@v4
63+
64+
- uses: haskell-actions/setup@v2
65+
id: setup-haskell-cabal
66+
name: Setup Haskell
67+
with:
68+
ghc-version: ${{ matrix.ghc }}
69+
enable-stack: true
70+
stack-version: ${{ matrix.stack || 'latest' }}
71+
72+
- name: Cache
73+
id: cache
74+
uses: actions/cache@v4
75+
with:
76+
path: |
77+
${{ steps.setup-haskell-cabal.outputs.stack-root }}
78+
.stack-work
79+
key: ${{ runner.os }}-${{ matrix.resolver }}-${{ github.sha }}
80+
restore-keys: |
81+
${{ runner.os }}-${{ matrix.resolver }}
82+
- name: Reset modtime
83+
run: |
84+
set -ex
85+
curl -sSL https://raw.githubusercontent.com/lehins/utils/master/haskell/git-modtime/git-modtime.hs -o git-modtime.hs
86+
runhaskell -- git-modtime.hs -f .stack-work-root/tree-contents.txt
87+
- name: Build
88+
run: |
89+
set -ex
90+
stack $STACK_ARGS test --no-run-tests --bench --no-run-benchmarks --haddock --no-haddock-deps
91+
- name: Test
92+
env:
93+
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
94+
run: |
95+
set -ex
96+
if [ "${{ matrix.os }}.${{ matrix.resolver }}" == "ubuntu-latest.lts-24" ] && [ -n "${COVERALLS_REPO_TOKEN}" ]; then
97+
stack $STACK_ARGS test --coverage
98+
stack $STACK_ARGS hpc report --all
99+
curl -L https://github.com/rubik/stack-hpc-coveralls/releases/download/v0.0.7.0/shc-Linux-X64.tar.bz2 | tar xj shc
100+
./shc --repo-token="$COVERALLS_REPO_TOKEN" --partial-coverage --fetch-coverage combined custom
101+
else
102+
stack $STACK_ARGS test
103+
fi

stack.yaml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# This file was automatically generated by 'stack init'
2+
#
3+
# Some commonly used options have been documented as comments in this file.
4+
# For advanced use and comprehensive documentation of the format, please see:
5+
# https://docs.haskellstack.org/en/stable/configure/yaml/
6+
7+
# A 'specific' Stackage snapshot or a compiler version.
8+
# A snapshot resolver dictates the compiler version and the set of packages
9+
# to be used for project dependencies. For example:
10+
#
11+
# snapshot: lts-23.24
12+
# snapshot: nightly-2025-06-15
13+
# snapshot: ghc-9.8.4
14+
#
15+
# The location of a snapshot can be provided as a file or url. Stack assumes
16+
# a snapshot provided as a file might change, whereas a url resource does not.
17+
#
18+
# snapshot: ./custom-snapshot.yaml
19+
# snapshot: https://example.com/snapshots/2024-01-01.yaml
20+
snapshot:
21+
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/24/14.yaml
22+
23+
# User packages to be built.
24+
# Various formats can be used as shown in the example below.
25+
#
26+
# packages:
27+
# - some-directory
28+
# - https://example.com/foo/bar/baz-0.0.2.tar.gz
29+
# subdirs:
30+
# - auto-update
31+
# - wai
32+
packages:
33+
- .
34+
# Dependency packages to be pulled from upstream that are not in the snapshot.
35+
# These entries can reference officially published versions as well as
36+
# forks / in-progress versions pinned to a git hash. For example:
37+
#
38+
# extra-deps:
39+
# - acme-missiles-0.3
40+
# - git: https://github.com/commercialhaskell/stack.git
41+
# commit: e7b331f14bcffb8367cd58fbfc8b40ec7642100a
42+
#
43+
# extra-deps: []
44+
45+
# Override default flag values for project packages and extra-deps
46+
# flags: {}
47+
48+
# Extra package databases containing global packages
49+
# extra-package-dbs: []
50+
51+
# Control whether we use the GHC we find on the path
52+
# system-ghc: true
53+
#
54+
# Require a specific version of Stack, using version ranges
55+
# require-stack-version: -any # Default
56+
# require-stack-version: ">=3.7"
57+
#
58+
# Override the architecture used by Stack, especially useful on Windows
59+
# arch: i386
60+
# arch: x86_64
61+
#
62+
# Extra directories used by Stack for building
63+
# extra-include-dirs: [/path/to/dir]
64+
# extra-lib-dirs: [/path/to/dir]
65+
#
66+
# Allow a newer minor version of GHC than the snapshot specifies
67+
# compiler-check: newer-minor

0 commit comments

Comments
 (0)