ngarbezza/testy

View on GitHub
.github/workflows/node_ci.yml

Summary

Maintainability
Test Coverage
name: Node CI

on: push

jobs:
  build:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        node-version: [18.x, 20.x, 21.x]
    steps:
    - name: Checkout repo
      uses: actions/checkout@v4
      with:
        fetch-depth: 0
    - name: Use Node.js ${{ matrix.node-version }}
      uses: actions/setup-node@v4
      with:
        node-version: ${{ matrix.node-version }}
    - name: Build NPM package, run analysis and tests
      run: |
        npm install
        npm run lint
        npm run test
      env:
        CI: true
    - if: matrix.node-version == '20.x'
      name: Code Climate Coverage Action
      uses: paambaati/codeclimate-action@v6.0.0
      with:
        coverageCommand: npm run test:coverage
        coverageLocations: ${{github.workspace}}/reports/coverage/lcov.info:lcov
      env:
        CC_TEST_REPORTER_ID: 6ace5bc20f45a4d3b1d1bd56b37e2ed97c92776e402f4f687bb5ee50853cb51c
    - if: matrix.node-version == '20.x'
      name: SonarCloud Scan
      uses: SonarSource/sonarcloud-github-action@master
      with:
        args: >
          -Dsonar.projectKey=ngarbezza_testy
          -Dsonar.organization=ngarbezza
          -Dsonar.projectName=Testy
          -Dsonar.projectVersion=7.0.0
          -Dsonar.javascript.lcov.reportPaths=reports/coverage/lcov.info
          -Dsonar.coverage.exclusions=tests/**
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}