@@ -20,20 +20,28 @@ concurrency:
20
20
21
21
jobs :
22
22
linux :
23
- name : Haskell-CI - Linux - ${{ matrix.ghc-version }}
23
+ name : Haskell-CI - ${{ matrix.ghc-version }} - ${{ matrix.ref }}
24
24
25
25
strategy :
26
26
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
28
32
fail-fast : false
29
33
30
34
runs-on : ubuntu-latest
31
35
32
36
steps :
33
37
- uses : actions/checkout@v4
38
+ with :
39
+ ref : ${{ matrix.ref }}
40
+
34
41
- uses : haskell-actions/setup@v2
35
42
with :
36
43
ghc-version : ${{matrix.ghc-version}}
44
+
37
45
- uses : actions/cache@v4
38
46
with :
39
47
key : ${{ matrix.ghc-version }}-${{ github.sha }}
@@ -42,22 +50,41 @@ jobs:
42
50
dist-newstyle
43
51
.hpc
44
52
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
+
50
76
- name : Upload coverage report
77
+ if : ${{ github.event.pull_request }}
51
78
uses : actions/upload-artifact@v4
52
79
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
55
82
if-no-files-found : error
56
83
compression-level : 0
57
84
retention-days : 1
58
85
59
86
report :
60
- name : Generate coverage report
87
+ name : Generate coverage comment
61
88
62
89
if : github.event.pull_request
63
90
@@ -69,10 +96,21 @@ jobs:
69
96
- name : Download coverage report
70
97
uses : actions/download-artifact@v4
71
98
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'
73
106
merge-multiple : true
74
107
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
+
76
114
77
115
- name : Find Comment
78
116
uses : peter-evans/find-comment@v3
0 commit comments