Set up SonarCloud static analysis
This commit is contained in:
parent
ddc85f5359
commit
97de2f0905
2 changed files with 26 additions and 11 deletions
31
.github/workflows/build.yml
vendored
31
.github/workflows/build.yml
vendored
|
@ -10,21 +10,23 @@ jobs:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- { node-version: 10.x, lint: false, tests: false }
|
- { node-version: 10.x, lint: false, static-analysis: false, tests: false }
|
||||||
- { node-version: 11.x, lint: false, tests: false }
|
- { node-version: 11.x, lint: false, static-analysis: false, tests: false }
|
||||||
- { node-version: 12.x, lint: false, tests: false }
|
- { node-version: 12.x, lint: false, static-analysis: false, tests: false }
|
||||||
- { node-version: 13.x, lint: false, tests: false }
|
- { node-version: 13.x, lint: false, static-analysis: false, tests: false }
|
||||||
- { node-version: 14.x, lint: true, tests: true }
|
- { node-version: 14.x, lint: true, static-analysis: false, tests: true }
|
||||||
- { node-version: 15.x, lint: false, tests: true }
|
- { node-version: 15.x, lint: false, static-analysis: false, tests: true }
|
||||||
- { node-version: 16.x, lint: true, tests: true }
|
- { node-version: 16.x, lint: true, static-analysis: false, tests: true }
|
||||||
- { node-version: 17.x, lint: true, tests: true }
|
- { node-version: 17.x, lint: true, static-analysis: false, tests: true }
|
||||||
- { node-version: 18.x, lint: true, tests: true }
|
- { node-version: 18.x, lint: true, static-analysis: true, tests: true }
|
||||||
- { node-version: 19.x, lint: true, tests: true }
|
- { node-version: 19.x, lint: true, static-analysis: false, tests: true }
|
||||||
|
|
||||||
name: Node.js ${{ matrix.node-version }}${{ matrix.lint && ', lint' || '' }}${{ matrix.tests && ', test' || '' }}, build
|
name: Node.js ${{ matrix.node-version }}${{ matrix.lint && ', lint' || '' }}${{ matrix.static-analysis && ', static analysis' || ''}}${{ matrix.tests && ', test' || '' }}, build
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Use Node.js ${{ matrix.node-version }}
|
- name: Use Node.js ${{ matrix.node-version }}
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v3
|
||||||
|
@ -75,6 +77,13 @@ jobs:
|
||||||
run: npm run lint
|
run: npm run lint
|
||||||
if: ${{ matrix.lint }}
|
if: ${{ matrix.lint }}
|
||||||
|
|
||||||
|
- name: SonarCloud scan
|
||||||
|
uses: SonarSource/sonarcloud-github-action@master
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
||||||
|
if: ${{ matrix.static-analysis }}
|
||||||
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: npm test
|
run: npm test
|
||||||
if: ${{ matrix.tests }}
|
if: ${{ matrix.tests }}
|
||||||
|
|
6
sonar-project.properties
Normal file
6
sonar-project.properties
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
sonar.projectKey=lstrojny_homebridge-prometheus-exporter
|
||||||
|
sonar.organization=lstrojny
|
||||||
|
sonar.sources=.
|
||||||
|
sonar.exclusions=tests/**
|
||||||
|
sonar.tests=tests
|
||||||
|
sonar.log.level=DEBUG
|
Loading…
Reference in a new issue