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 | ||
|
Check failure on line 1 in .github/workflows/haskell-ci.yml
|
||
| permissions: | ||
| contents: read | ||
| pull-requests: write | ||
| 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 - ${{ matrix.ghc-version }} - ${{ matrix.ref }} | ||
| strategy: | ||
| matrix: | ||
| ghc-version: ["9.12", "9.10", "9.8", "9.6"] | ||
| ref: ["${{ github.head_ref }}"] | ||
| # This gives us one run for `master` with ghc version 9.12. | ||
| # We use this run to give us "up to date" coverage data that | ||
| # we can compare to. | ||
| include: | ||
| - ghc-version: "9.12" | ||
| ref: master | ||
| fail-fast: false | ||
| runs-on: ubuntu-latest | ||
| env: | ||
| coverage: ${{ github.event.pull_request && (matrix.ghc_version == "9.12") }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| ref: ${{ matrix.ref }} | ||
| - uses: haskell-actions/setup@v2 | ||
| with: | ||
| ghc-version: ${{matrix.ghc-version}} | ||
| - uses: actions/cache@v4 | ||
| with: | ||
| key: ${{ matrix.ghc-version }}-${{ matrix.ref }} | ||
| path: | | ||
| ~/.cabal/store | ||
| dist-newstyle | ||
| .hpc | ||
| restore-keys: ${{ matrix.ghc-version }}- | ||
| - if: ${{ env.coverage }} | ||
| run: | | ||
| cat <<EOF >>cabal.project.local | ||
| program-options | ||
| ghc-options: -fhpc | ||
| EOF | ||
| - run: cabal build all | ||
| - run: cabal test all | ||
| - run: cabal haddock all | ||
| # To get the right version of `generate-coverage-comment.sh`. I.e. the | ||
| # one in this PR. This is important in order to get the same | ||
| # coverage-counting logic on the PR as on master. | ||
| - uses: actions/checkout@v4 | ||
| if: ${{ env.coverage }} | ||
| with: | ||
| ref: ${{ github.head_ref }} | ||
| sparse-checkout: | ||
| scripts | ||
| clean: false | ||
| - if: ${{ env.coverage }} | ||
| run: ./scripts/generate-coverage-comment.sh constrained.tix | tee coverage-report-${{matrix.ref}}.md | ||
| - name: Upload coverage report | ||
| if: ${{ env.coverage }} | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: constrained-${{matrix.ref}}-coverage | ||
| path: coverage-report-${{matrix.ref}}.md | ||
| if-no-files-found: error | ||
| compression-level: 0 | ||
| retention-days: 1 | ||
| report: | ||
| name: Generate coverage comment | ||
| if: github.event.pull_request | ||
| needs: linux | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Download coverage report | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| pattern: 'constrained-${{github.head_ref}}-coverage' | ||
| merge-multiple: true | ||
| - name: Download coverage report from `master` | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| pattern: 'constrained-master-coverage' | ||
| merge-multiple: true | ||
| - run: | | ||
| cat coverage-report-${{github.head_ref}}.md > coverage-report.md | ||
| echo "# On master" >> coverage-report.md | ||
| cat coverage-report-master.md >> coverage-report.md | ||
| cat coverage-report.md | ||
| - name: Find Comment | ||
| 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 | ||
| uses: peter-evans/create-or-update-comment@v4 | ||
| with: | ||
| comment-id: ${{ steps.fc.outputs.comment-id }} | ||
| issue-number: ${{ github.event.pull_request.number }} | ||
| body-path: coverage-report.md | ||
| edit-mode: replace | ||