Skip to content

Commit

Permalink
Update build and test workflows, add SonarQube integration
Browse files Browse the repository at this point in the history
  • Loading branch information
Codycody31 committed Jan 3, 2024
1 parent 3da8bd7 commit 5fa615f
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 29 deletions.
27 changes: 0 additions & 27 deletions .github/workflows/build.yml

This file was deleted.

21 changes: 20 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,23 @@ jobs:
run: |
export CI=TRUE
npm run lint:ci
npm test -- --coverage --json --outputFile=testResults.json
npm test --coverage
sonar:
name: Sonar
runs-on: ubuntu-latest
permissions: read-all
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- uses: sonarsource/sonarqube-scan-action@master
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
# If you wish to fail your job when the Quality Gate is red, uncomment the
# following lines. This would typically be used to fail a deployment.
# - uses: sonarsource/sonarqube-quality-gate-action@master
# timeout-minutes: 5
# env:
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
3 changes: 3 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
module.exports = {
preset: "ts-jest",
testEnvironment: "node",
// SonarQube
collectCoverage: true,
coverageDirectory: "coverage",
};
19 changes: 19 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"conventional-changelog-conventionalcommits": "^7.0.2",
"eslint": "^8.54.0",
"jest": "^29.7.0",
"jest-sonar-reporter": "^2.0.0",
"semantic-release": "^22.0.12",
"ts-jest": "^29.1.1",
"ts-node": "^10.9.1",
Expand Down
5 changes: 4 additions & 1 deletion sonar-project.properties
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
sonar.projectKey=VMGWARE_js-validator_AYzNAnwTPR--spDn0sJy
sonar.projectKey=VMGWARE_js-validator_AYzNAnwTPR--spDn0sJy
sonar.tests=.
sonar.test.inclusions=**/*.test.js
sonar.javascript.lcov.reportPaths=./coverage/lcov.info

0 comments on commit 5fa615f

Please sign in to comment.