sh33dafi/jest-sonar

View on GitHub
.github/workflows/pr-ci.yml

Summary

Maintainability
Test Coverage
# save as ./github/workflows/git-ci-build.yml
# make sure that 'test-coverage' generates the coverage reports (lcov)

name: PR-CI

on:
  [pull_request]

jobs:
  build:

    runs-on: ubuntu-latest

    strategy:
      matrix:
        node-version: [18.x, 17.x, 16.x, 15.x]

    steps:
    - uses: actions/checkout@v2
      with:
        fetch-depth: 0
    - uses: actions/setup-node@v3
      with:
        node-version: ${{ matrix.node-version }}
    - run: npm ci
    - run: npx commitlint --from HEAD~${{ github.event.pull_request.commits }} --to HEAD
    - run: npm run lint
    - run: npm run test
    - name: Test & publish code coverage
      uses: paambaati/codeclimate-action@v3.0.0
      env:
        CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
      with:
        coverageLocations: |
          ${{github.workspace}}/coverage/*.info:lcov  
          ${{github.workspace}}/coverage/clover.xml:clover