Skip to content

Commit

Permalink
Invoke SonarQube via GitHub action (#623)
Browse files Browse the repository at this point in the history
  • Loading branch information
kaufmo authored Dec 20, 2024
1 parent 7b9985b commit 4311bbb
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 1 deletion.
38 changes: 38 additions & 0 deletions .github/workflows/sonar-qube.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: SonarCloud Code Analysis

on:
pull_request:
types:
- opened
- synchronize
- reopened
push:
branches:
- main
- next

jobs:
sonarqube:
name: SonarQube
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Use Node.js 22.x
uses: actions/setup-node@v4
with:
node-version: 22
cache: "npm"
cache-dependency-path: "**/package-lock.json"
registry-url: "https://registry.npmjs.org"

- name: Install dependencies
run: npm ci && npm --prefix api ci && npm --prefix create-app ci && npm --prefix admin ci && npm --prefix site ci

- name: SonarQube Scan
uses: SonarSource/sonarqube-scan-action@v4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { deleteFilesAndFolders } from "../../util/deleteFilesAndFolders";
import { removeReferenceInFile } from "../../util/removeReferenceInFile";

export function cleanupWorkingDirectory(verbose: boolean) {
deleteFilesAndFolders(["create-app", ".git", ".github", "LICENSE", ".digitalocean", "renovate.json"], verbose);
deleteFilesAndFolders(["create-app", ".git", ".github", "LICENSE", ".digitalocean", "renovate.json", "sonar-project.properties"], verbose);
removeReferenceInFile("lint-staged.config.js", /.*create-app.*\n/gim, verbose);
removeReferenceInFile(".vscode/settings.json", /, "create-app"/g, verbose);
removeReferenceInFile("install.sh", /^.*create-app.*$/gm, verbose);
Expand Down
8 changes: 8 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
sonar.projectKey=vivid-planet_comet-starter
sonar.organization=vivid-planet
sonar.sources=admin/,api/,create-app/,site/
sonar.tests=api/
sonar.test.inclusions=api/**/__tests__/**,api/**/*.spec.ts
sonar.exclusions=api/**/__tests__/**,api/**/*.spec.ts
sonar.cpd.exclusions=packages/**/__tests__/**,packages/**/*.spec.ts
sonar.typescript.tsconfigPaths=admin/tsconfig.json,api/tsconfig.json,create-app/tsconfig.json,site/tsconfig.json

0 comments on commit 4311bbb

Please sign in to comment.