Skip to content

Commit 53afc5a

Browse files
authored
Configure SonarQube scanning (#71)
* Configure SonarQube scanning * Upgrade checkout action Make it non-shallow for better scan results. * Pin SonarQube action * Pin Netlify CLI * Don't run scripts on install * Add maintainability badge
1 parent 0593361 commit 53afc5a

5 files changed

Lines changed: 23 additions & 3 deletions

File tree

‎.github/workflows/push.yml‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,19 @@ jobs:
1313
check:
1414
runs-on: "ubuntu-latest"
1515
steps:
16-
- uses: "actions/checkout@v6"
16+
- uses: "actions/checkout@v7"
17+
with:
18+
fetch-depth: 0
1719
- uses: "actions/setup-node@v6"
1820
with:
1921
cache: "npm"
2022
node-version: "24"
2123
- run: "npm ci"
2224
- run: "npm run lint"
2325
- run: "npm run test:cover"
26+
- uses: "SonarSource/sonarqube-scan-action@713881670b6b3676cda39549040e2d88c70d582e" # v8.2.0
27+
env:
28+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
2429
- run: "npm run build"
2530
- uses: "actions/upload-artifact@v7"
2631
with:
@@ -35,7 +40,7 @@ jobs:
3540
if: "github.ref == 'refs/heads/main' && github.actor != 'dependabot[bot]'"
3641
runs-on: "ubuntu-latest"
3742
steps:
38-
- uses: "actions/checkout@v6"
43+
- uses: "actions/checkout@v7"
3944
- uses: "actions/setup-node@v6"
4045
with:
4146
cache: "npm"
@@ -45,7 +50,7 @@ jobs:
4550
with:
4651
name: "build-output"
4752
path: "lib/"
48-
- run: "npm install --global netlify-cli@latest"
53+
- run: "npm install --global netlify-cli@26.1.0"
4954
- run: "netlify --version"
5055
- run: "netlify deploy --no-build --prod true"
5156
env:

‎.npmrc‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
engine-strict=true
2+
ignore-scripts=true

‎README.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# CYF GitBot
22

33
[![Node.js CI][ci-badge]][ci-link]
4+
[![Maintainability Rating][sonar-badge]][sonar-link]
45

56
Integrating GitHub and Slack via Netlify.
67

@@ -85,3 +86,5 @@ The Netlify functions require the following environment variables:
8586
[github-webhooks]: https://docs.github.com/en/developers/webhooks-and-events/webhooks/about-webhooks
8687
[netlify-functions]: https://functions.netlify.com/
8788
[slack-channel]: https://codeyourfuture.slack.com/archives/C03LSS9TNRW
89+
[sonar-link]: https://sonarcloud.io/summary/new_code?id=CodeYourFuture_gitbot
90+
[sonar-badge]: https://sonarcloud.io/api/project_badges/measure?project=CodeYourFuture_gitbot&metric=sqale_rating

‎sonar-project.properties‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
sonar.organization=codeyourfuture
2+
sonar.projectKey=CodeYourFuture_gitbot
3+
sonar.projectName=gitbot
4+
5+
sonar.sources=src
6+
sonar.tests=src
7+
sonar.test.inclusions=src/**/*.test.ts
8+
9+
sonar.javascript.lcov.reportPaths=./reports/coverage/lcov.info

‎vite.config.js‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ import { defineConfig } from "vitest/config";
33
export default defineConfig({
44
test: {
55
coverage: {
6+
exclude: ["**/*.d.ts"],
67
include: ["src/**"],
8+
reporter: ["html", "lcovonly", "text"],
79
reportsDirectory: "reports/coverage",
810
},
911
globals: true,

0 commit comments

Comments
 (0)