Skip to content

Commit af3b6c6

Browse files
Compare result to master
1 parent 8909bb5 commit af3b6c6

File tree

2 files changed

+51
-13
lines changed

2 files changed

+51
-13
lines changed

.github/workflows/haskell-ci.yml

Lines changed: 50 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,28 @@ concurrency:
2020

2121
jobs:
2222
linux:
23-
name: Haskell-CI - Linux - ${{ matrix.ghc-version }}
23+
name: Haskell-CI - ${{ matrix.ghc-version }} - ${{ matrix.ref }}
2424

2525
strategy:
2626
matrix:
27-
ghc-version: [latest, 9.12, "9.10", 9.8, 9.6]
27+
ghc-version: ["9.12", "9.10", "9.8", "9.6"]
28+
ref: ["${{ github.head_ref }}"]
29+
include:
30+
- ghc-version: "9.12"
31+
ref: master
2832
fail-fast: false
2933

3034
runs-on: ubuntu-latest
3135

3236
steps:
3337
- uses: actions/checkout@v4
38+
with:
39+
ref: ${{ matrix.ref }}
40+
3441
- uses: haskell-actions/setup@v2
3542
with:
3643
ghc-version: ${{matrix.ghc-version}}
44+
3745
- uses: actions/cache@v4
3846
with:
3947
key: ${{ matrix.ghc-version }}-${{ github.sha }}
@@ -42,22 +50,41 @@ jobs:
4250
dist-newstyle
4351
.hpc
4452
restore-keys: ${{ matrix.ghc-version }}-
45-
- run: cabal build all --ghc-options=-fhpc
46-
- run: cabal test all --ghc-options=-fhpc
47-
- run: ./scripts/generate-coverage-comment.sh constrained.tix > coverage-report.md
48-
- run: cat coverage-report.md
49-
- run: cabal haddock all --ghc-options=-fhpc
53+
54+
- if: ${{ github.event.pull_request }}
55+
run: |
56+
cat <<EOF >>cabal.project.local
57+
program-options
58+
ghc-options: -fhpc
59+
EOF
60+
61+
- run: cabal build all
62+
- run: cabal test all
63+
- run: cabal haddock all
64+
65+
# To get the right version of `generate-coverage-comment.sh`
66+
- uses: actions/checkout@v4
67+
with:
68+
ref: ${{ github.head_ref }}
69+
sparse-checkout:
70+
scripts
71+
clean: false
72+
73+
- if: ${{ github.event.pull_request }}
74+
run: ./scripts/generate-coverage-comment.sh constrained.tix | tee coverage-report-${{matrix.ref}}.md
75+
5076
- name: Upload coverage report
77+
if: ${{ github.event.pull_request }}
5178
uses: actions/upload-artifact@v4
5279
with:
53-
name: constrained-${{matrix.ghc-version}}-coverage
54-
path: coverage-report.md
80+
name: constrained-${{matrix.ref}}-${{matrix.ghc-version}}-coverage
81+
path: coverage-report-${{matrix.ref}}.md
5582
if-no-files-found: error
5683
compression-level: 0
5784
retention-days: 1
5885

5986
report:
60-
name: Generate coverage report
87+
name: Generate coverage comment
6188

6289
if: github.event.pull_request
6390

@@ -69,10 +96,21 @@ jobs:
6996
- name: Download coverage report
7097
uses: actions/download-artifact@v4
7198
with:
72-
pattern: 'constrained-latest-coverage'
99+
pattern: 'constrained-${{github.head_ref}}-9.12-coverage'
100+
merge-multiple: true
101+
102+
- name: Download coverage report
103+
uses: actions/download-artifact@v4
104+
with:
105+
pattern: 'constrained-master-9.12-coverage'
73106
merge-multiple: true
74107

75-
- run: cat coverage-report.md
108+
- run: |
109+
cat coverage-report-${{github.head_ref}}.md > coverage-report.md
110+
echo "# On master" >> coverage-report.md
111+
cat coverage-report-master.md >> coverage-report.md
112+
cat coverage-report.md
113+
76114
77115
- name: Find Comment
78116
uses: peter-evans/find-comment@v3
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/bin/sh
22

33
echo "# Coverage report"
4-
hpc report $1 | awk '{sub(/^[ \t]*/, "& - ")1; sub(/^ /, "", $0); print}'
4+
hpc report "$1" | awk '{sub(/^[ \t]*/, "&- "); sub(/^ /, ""); print}'

0 commit comments

Comments
 (0)