Skip to content

Commit

Permalink
Set up SonarCloud static analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
lstrojny committed Nov 23, 2022
1 parent ddc85f5 commit 97de2f0
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 11 deletions.
31 changes: 20 additions & 11 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,23 @@ jobs:
fail-fast: false
matrix:
include:
- { node-version: 10.x, lint: false, tests: false }
- { node-version: 11.x, lint: false, tests: false }
- { node-version: 12.x, lint: false, tests: false }
- { node-version: 13.x, lint: false, tests: false }
- { node-version: 14.x, lint: true, tests: true }
- { node-version: 15.x, lint: false, tests: true }
- { node-version: 16.x, lint: true, tests: true }
- { node-version: 17.x, lint: true, tests: true }
- { node-version: 18.x, lint: true, tests: true }
- { node-version: 19.x, lint: true, tests: true }
- { node-version: 10.x, lint: false, static-analysis: false, tests: false }
- { node-version: 11.x, lint: false, static-analysis: false, tests: false }
- { node-version: 12.x, lint: false, static-analysis: false, tests: false }
- { node-version: 13.x, lint: false, static-analysis: false, tests: false }
- { node-version: 14.x, lint: true, static-analysis: false, tests: true }
- { node-version: 15.x, lint: false, static-analysis: false, tests: true }
- { node-version: 16.x, lint: true, static-analysis: false, tests: true }
- { node-version: 17.x, lint: true, static-analysis: false, tests: true }
- { node-version: 18.x, lint: true, static-analysis: 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:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
Expand Down Expand Up @@ -75,6 +77,13 @@ jobs:
run: npm run 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
run: npm test
if: ${{ matrix.tests }}
Expand Down
6 changes: 6 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 97de2f0

Please sign in to comment.