Skip to content

Commit f99ee36

Browse files
Implement coveralls support
1 parent 4ccd6b0 commit f99ee36

File tree

1 file changed

+62
-3
lines changed

1 file changed

+62
-3
lines changed

.github/workflows/haskell-ci.yml

Lines changed: 62 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ concurrency:
1515
cancel-in-progress: true
1616

1717
jobs:
18-
linux:
19-
name: Haskell-CI - Linux - ${{ matrix.ghc-version }}
18+
test-with-cabal:
19+
name: Haskell-CI - Linux - cabal - ${{ matrix.ghc-version }}
2020

2121
strategy:
2222
matrix:
2323
ghc-version: [latest, 9.12, "9.10", 9.8, 9.6]
24-
os: [ubuntu-24.04]
24+
os: [ubuntu-latest]
2525
fail-fast: false
2626

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

0 commit comments

Comments
 (0)