11name : Haskell-CI
22
3+ permissions :
4+ contents : read
5+ pull-requests : write
6+
37on :
48 push :
59 branches :
2125 strategy :
2226 matrix :
2327 ghc-version : [latest, 9.12, "9.10", 9.8, 9.6]
24- os : [ubuntu-24.04]
2528 fail-fast : false
2629
27- runs-on : ${{ matrix.os }}
30+ runs-on : ubuntu-latest
2831
2932 steps :
3033 - uses : actions/checkout@v4
@@ -33,13 +36,57 @@ jobs:
3336 ghc-version : ${{matrix.ghc-version}}
3437 - uses : actions/cache/restore@v4
3538 with :
36- key : ${{ matrix.os }}-${{ matrix. ghc-version }}-${{ github.sha }}
39+ key : ${{ matrix.ghc-version }}-${{ github.sha }}
3740 path : ~/.cabal/store
38- restore-keys : ${{ matrix.os }}-${{ matrix.ghc-version }}-
39- - run : cabal build all
40- - run : cabal test all
41+ restore-keys : ${{ matrix.ghc-version }}-
42+ - run : cabal build all --ghc-options=-fhpc
43+ - run : cabal test all --ghc-options=-fhpc
44+ - run : ./scripts/generate-coverage-comment.sh constrained.tix > coverage-report.md
45+ - run : cat coverage-report.md
4146 - run : cabal haddock all
4247 - uses : actions/cache/save@v4
4348 with :
44- key : ${{ matrix.os }}-${{ matrix. ghc-version }}-${{ github.sha }}
49+ key : ${{ matrix.ghc-version }}-${{ github.sha }}
4550 path : ~/.cabal/store
51+ - name : Upload coverage report
52+ uses : actions/upload-artifact@v4
53+ with :
54+ name : constrained-${{matrix.ghc-version}}-coverage
55+ path : coverage-report.md
56+ if-no-files-found : error
57+ compression-level : 0
58+ retention-days : 1
59+
60+ report :
61+ name : Generate coverage report
62+
63+ if : github.event.pull_request
64+
65+ needs : linux
66+
67+ runs-on : ubuntu-latest
68+
69+ steps :
70+ - name : Download coverage report
71+ uses : actions/download-artifact@v4
72+ with :
73+ pattern : ' constrained-latest-coverage'
74+ merge-multiple : true
75+
76+ - run : cat coverage-report.md
77+
78+ - name : Find Comment
79+ uses : peter-evans/find-comment@v3
80+ id : fc
81+ with :
82+ issue-number : ${{ github.event.pull_request.number }}
83+ comment-author : ' github-actions[bot]'
84+ body-includes : " expressions used"
85+
86+ - name : Create or update comment
87+ uses : peter-evans/create-or-update-comment@v4
88+ with :
89+ comment-id : ${{ steps.fc.outputs.comment-id }}
90+ issue-number : ${{ github.event.pull_request.number }}
91+ body-path : coverage-report.md
92+ edit-mode : replace
0 commit comments