guidesmiths/systemic

View on GitHub
.github/workflows/code-climate-test-coverage.yml

Summary

Maintainability
Test Coverage
name: Code Climate Test Reporter

on:
  push:
    branches: [master]
  pull_request:
    branches: [master]

permissions: # added using https://github.com/step-security/secure-workflows
  contents: read

jobs:
  code-climate:
    runs-on: ubuntu-latest
    steps:
      - name: Harden Runner
        uses: step-security/harden-runner@8ca2b8b2ece13480cda6dacd3511b49857a23c09 # v2.5.1
        with:
          egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs

      - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
      - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
        with:
          node-version: '18.x'
      - run: npm ci
      - run: curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
      - run: chmod +x ./cc-test-reporter
      - run: ./cc-test-reporter before-build
      - run: npm run coverage
      - run: ./cc-test-reporter format-coverage -t lcov coverage/lcov.info
      - run: ./cc-test-reporter upload-coverage
        env:
          CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}