Skip to content

chore: Use LCOV for code coverage reports used by SonarCloud #93

chore: Use LCOV for code coverage reports used by SonarCloud

chore: Use LCOV for code coverage reports used by SonarCloud #93

Workflow file for this run

name: 📊 Code Coverage
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
jobs:
coverage:
runs-on: ubuntu-latest
env:
CODE_TYPE: stable
CODE_VERSION: max
TEST_RESOURCES: test-resources
steps:
- name: 👷🏻 Checkout Repository
uses: actions/checkout@v4
- name: ⚙️ Setup NodeJS
uses: actions/setup-node@v4
with:
node-version: 18.x
cache: npm
- name: 🔧 Install
run: npm ci
- name: 🔧 Build
run: npm run build
- name: 🔧 Install - Test Project
run: npm install --workspace=extester-test
- name: 📊 Run Tests with Coverage enabled
# 'set +e' and 'exit 0' - that means the workflow will not fail even the test failures are present. The failing tests are not directive for the code coverage reports itself
run: |
set +e
xvfb-run --auto-servernum --server-args='-screen 0 1920x1080x24' npm run test:coverage
exit 0
- name: ☁️ SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- name: 📊 Report Coverage on PR
uses: Nef10/lcov-reporter-action@v0.3.0
if: always()
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
lcov-file: ./tests/test-project/coverage/lcov.info
pr-number: ${{ github.event.pull_request.number }}
- name: 💾 Upload Coverage
uses: actions/upload-artifact@v4
if: always()
with:
name: coverage
path: ${{ github.workspace }}/tests/**/coverage