2121 strategy :
2222 matrix :
2323 ghc-version : [latest, 9.12, "9.10", 9.8, 9.6]
24- os : [ubuntu-24.04]
2524 fail-fast : false
2625
27- runs-on : ${{ matrix.os }}
26+ runs-on : ubuntu-latest
2827
2928 steps :
3029 - uses : actions/checkout@v4
@@ -33,13 +32,67 @@ jobs:
3332 ghc-version : ${{matrix.ghc-version}}
3433 - uses : actions/cache/restore@v4
3534 with :
36- key : ${{ matrix.os }}-${{ matrix. ghc-version }}-${{ github.sha }}
35+ key : ${{ matrix.ghc-version }}-${{ github.sha }}
3736 path : ~/.cabal/store
38- restore-keys : ${{ matrix.os }}-${{ matrix. ghc-version }}-
37+ restore-keys : ${{ matrix.ghc-version }}-
3938 - run : cabal build all
40- - run : cabal test all
39+ - run : cabal test all --ghc-options=-fhpc
40+ - run : mv constrained.tix constrained-${{matrix.ghc-version}}.tix
4141 - run : cabal haddock all
4242 - uses : actions/cache/save@v4
4343 with :
44- key : ${{ matrix.os }}-${{ matrix. ghc-version }}-${{ github.sha }}
44+ key : ${{ matrix.ghc-version }}-${{ github.sha }}
4545 path : ~/.cabal/store
46+
47+ - name : Upload coverage report
48+ uses : actions/upload-artifact@v4
49+ with :
50+ name : constrained-${{matrix.ghc-version}}-coverage
51+ path : constrained-${{ matrix.ghc-version }}.tix
52+ if-no-files-found : error
53+ compression-level : 0
54+ retention-days : 1
55+
56+ coverage :
57+ name : Generate coverage badge
58+
59+ runs-on : ubuntu-latest
60+
61+ needs : linux
62+
63+ steps :
64+ - uses : actions/checkout@v4
65+ - uses : haskell-actions/setup@v2
66+ with :
67+ ghc-version : latest
68+
69+ - name : Download all artifacts
70+ uses : actions/download-artifact@v4
71+ with :
72+ pattern : ' *-coverage'
73+ merge-multiple : true
74+
75+ - run : cabal install hpc
76+
77+ - run : hpc sum constrained.tix constrained-*.tix
78+
79+ - run : hpc report constrained.tix > report.md
80+
81+ - name : Find Comment
82+ if : github.event.pull_request
83+ uses : peter-evans/find-comment@v3
84+ id : fc
85+ with :
86+ issue-number : ${{ github.event.pull_request.number }}
87+ comment-author : ' github-actions[bot]'
88+ body-includes : " expressions used"
89+
90+ - name : Create or update comment
91+ if : github.event.pull_request
92+ uses : peter-evans/create-or-update-comment@v4
93+ if : steps.difference.outputs.changed == 1
94+ with :
95+ comment-id : ${{ steps.fc.outputs.comment-id }}
96+ issue-number : ${{ github.event.pull_request.number }}
97+ body : report.md
98+ edit-mode : replace
0 commit comments