interlay / interbtc-squid

Subquid GraphQL schema and indexer for the Interlay and Kintsugi networks
Apache License 2.0
4 stars 7 forks source link

Add test coverage github action #133

Closed bvotteler closed 1 year ago

bvotteler commented 1 year ago

As follow on to #130 , add a workflow action to capture coverage results with comparison to previous runs.

This looks like a good fit: https://github.com/ArtiomTr/jest-coverage-report-action

I have started some tests with a workflow file as shown below. It might work as-is or need a few tweaks around commenting and permissions (particularly when creating a PR from a fork this seems to be somewhat tricky at times).

name: 'coverage'
permissions:
  pull-requests: write
on:
  pull_request:
    branches:
      - master
      - main
jobs:
  coverage:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: ArtiomTr/jest-coverage-report-action@v2
        id: coverage
        with:
          test-script: yarn jest --passWithNoTests
          package-manager: yarn
          output: report-markdown
      - uses: marocchino/sticky-pull-request-comment@v2
        with:
          # comment output from coverage
          message: ${{ steps.coverage.outputs.report }}