Basic code coverage feedback #18
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Haskell-CI | ||
| on: | ||
| push: | ||
| branches: | ||
| - 'master' | ||
| pull_request: | ||
| branches: | ||
| - 'master' | ||
| schedule: | ||
| - cron: 0 0 * * * | ||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
| cancel-in-progress: true | ||
| jobs: | ||
| linux: | ||
| name: Haskell-CI - Linux - ${{ matrix.ghc-version }} | ||
| strategy: | ||
| matrix: | ||
| ghc-version: [latest, 9.12, "9.10", 9.8, 9.6] | ||
| fail-fast: false | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: haskell-actions/setup@v2 | ||
| with: | ||
| ghc-version: ${{matrix.ghc-version}} | ||
| - uses: actions/cache/restore@v4 | ||
| with: | ||
| key: ${{ matrix.ghc-version }}-${{ github.sha }} | ||
| path: ~/.cabal/store | ||
| restore-keys: ${{ matrix.ghc-version }}- | ||
| - run: cabal build all | ||
| - run: cabal test all --ghc-options=-fhpc | ||
| - run: mv constrained.tix constrained-${{matrix.ghc-version}}.tix | ||
| - run: cabal haddock all | ||
| - uses: actions/cache/save@v4 | ||
| with: | ||
| key: ${{ matrix.ghc-version }}-${{ github.sha }} | ||
| path: ~/.cabal/store | ||
| - name: Upload coverage report | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: constrained-${{matrix.ghc-version}}-coverage | ||
| path: constrained-${{ matrix.ghc-version }}.tix | ||
| if-no-files-found: error | ||
| compression-level: 0 | ||
| retention-days: 1 | ||
| coverage: | ||
| name: Generate coverage badge | ||
| runs-on: ubuntu-latest | ||
| needs: linux | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: haskell-actions/setup@v2 | ||
| with: | ||
| ghc-version: latest | ||
| - name: Download all artifacts | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| pattern: '*-coverage' | ||
| merge-multiple: true | ||
| - run: cabal install hpc | ||
| - run: hpc sum constrained.tix constrained-*.tix | ||
| - run: hpc report constrained.tix > report.md | ||
| - name: Find Comment | ||
| if: github.event.pull_request | ||
| uses: peter-evans/find-comment@v3 | ||
| id: fc | ||
| with: | ||
| issue-number: ${{ github.event.pull_request.number }} | ||
| comment-author: 'github-actions[bot]' | ||
| body-includes: "expressions used" | ||
| - name: Create or update comment | ||
| if: github.event.pull_request | ||
| uses: peter-evans/create-or-update-comment@v4 | ||
| if: steps.difference.outputs.changed == 1 | ||
| with: | ||
| comment-id: ${{ steps.fc.outputs.comment-id }} | ||
| issue-number: ${{ github.event.pull_request.number }} | ||
| body: report.md | ||
| edit-mode: replace | ||