Skip to content

Commit 8977a0c

Browse files
authoredFeb 1, 2025··
feat: sonarqube setup (#1805)
* feat: sonarqube setup Signed-off-by: Adam Setch <adam.setch@outlook.com> * feat: sonarqube setup Signed-off-by: Adam Setch <adam.setch@outlook.com> * feat: sonarqube setup Signed-off-by: Adam Setch <adam.setch@outlook.com> --------- Signed-off-by: Adam Setch <adam.setch@outlook.com>
1 parent 0e0cdef commit 8977a0c

File tree

4 files changed

+86
-6
lines changed

4 files changed

+86
-6
lines changed
 

‎.github/workflows/test.yml

+33-3
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,36 @@ jobs:
1818
- run: pnpm install
1919
- run: pnpm tsc --noEmit
2020
- run: pnpm test -- --coverage --runInBand --verbose
21-
- name: Coveralls
22-
uses: coverallsapp/github-action@v2
23-
21+
- name: Archive code coverage results
22+
uses: actions/upload-artifact@v4
23+
with:
24+
name: code-coverage-report
25+
path: coverage/lcov.info
26+
27+
sonarqube:
28+
name: SonarQube Cloud Analysis
29+
runs-on: ubuntu-latest
30+
needs: run-unit-tests
31+
# Only analyze PRs from the same repository. Limitation of SonarQube Cloud
32+
if: github.event.pull_request.head.repo.fork == false
33+
34+
steps:
35+
- uses: actions/checkout@v4
36+
with:
37+
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
38+
- uses: pnpm/action-setup@v3
39+
- uses: actions/setup-node@v4
40+
with:
41+
node-version-file: '.nvmrc'
42+
cache: 'pnpm'
43+
- run: pnpm install
44+
- name: Download a single artifact
45+
uses: actions/download-artifact@v4
46+
with:
47+
name: code-coverage-report
48+
path: coverage/
49+
- name: SonarQube Cloud Scan
50+
uses: SonarSource/sonarqube-scan-action@v4
51+
env:
52+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
53+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

‎README.md

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Gitify
22

3-
[![CI Workflow][ci-workflow-badge]][github-actions] [![Release Workflow][release-workflow-badge]][github-actions] [![Coveralls][coveralls-badge]][coveralls] [![Renovate enabled][renovate-badge]][renovate] [![Contributors][contributors-badge]][github] [![Downloads - Total][downloads-total-badge]][website] [![Downloads - Latest Release][downloads-latest-badge]][website] [![OSS License][license-badge]][license] [![Latest Release][github-release-badge]][github-releases] [![Homebrew Cask][homebrew-cask-badge]][homebrew-cask]
3+
[![CI Workflow][ci-workflow-badge]][github-actions] [![Release Workflow][release-workflow-badge]][github-actions] [![Coverage][coverage-badge]][coverage] [![Quality Gate Status][quality-badge]][quality] [![Renovate enabled][renovate-badge]][renovate] [![Contributors][contributors-badge]][github] [![Downloads - Total][downloads-total-badge]][website] [![Downloads - Latest Release][downloads-latest-badge]][website] [![OSS License][license-badge]][license] [![Latest Release][github-release-badge]][github-releases] [![Homebrew Cask][homebrew-cask-badge]][homebrew-cask]
44

55
> GitHub Notifications on your menu bar. Available on macOS, Windows and Linux.
66
@@ -43,8 +43,11 @@ For more information, see [LICENSE](LICENSE).
4343
[brew]: https://brew.sh/
4444
[homebrew-cask]: https://formulae.brew.sh/cask/gitify
4545

46-
[coveralls]: https://coveralls.io/github/gitify-app/gitify
47-
[coveralls-badge]: https://img.shields.io/coverallsCoverage/github/gitify-app/gitify?logo=coveralls
46+
[coverage-badge]: https://img.shields.io/sonar/coverage/gitify-app_gitify?server=https%3A%2F%2Fsonarcloud.io&logo=sonarcloud
47+
[coverage]: https://sonarcloud.io/summary/new_code?id=gitify-app_gitify
48+
[quality-badge]: https://img.shields.io/sonar/quality_gate/gitify-app_gitify?server=https%3A%2F%2Fsonarcloud.io&logo=sonarcloud
49+
[quality]: https://sonarcloud.io/summary/new_code?id=gitify-app_gitify
50+
4851
[ci-workflow-badge]: https://github.com/gitify-app/gitify/actions/workflows/ci.yml/badge.svg
4952
[release-workflow-badge]: https://github.com/gitify-app/gitify/actions/workflows/release.yml/badge.svg
5053
[downloads-total-badge]: https://img.shields.io/github/downloads/gitify-app/gitify/total?label=downloads@all&logo=github

‎renovate.json

+11
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,16 @@
2626
"matchDatasources": ["npm"],
2727
"commitMessageTopic": "{{depName}}"
2828
}
29+
],
30+
"customManagers": [
31+
{
32+
"description": "Keep sonar.projectVersion variables in sonar-project.properties in-sync",
33+
"customType": "regex",
34+
"datasourceTemplate": "github-tags",
35+
"depNameTemplate": "gitify-app/gitify",
36+
"versioningTemplate": "loose",
37+
"fileMatch": ["sonar-project.properties"],
38+
"matchStrings": ["\\s?sonar.projectVersion=(?<currentValue>.+?)\\s"]
39+
}
2940
]
3041
}

‎sonar-project.properties

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# =====================================================
2+
# SonarCloud
3+
# https://docs.sonarsource.com/sonarcloud/advanced-setup/ci-based-analysis/github-actions-for-sonarcloud/
4+
# =====================================================
5+
sonar.projectKey=gitify-app_gitify
6+
sonar.organization=gitify-app
7+
sonar.projectVersion=v6.0.0
8+
sonar.projectDescription=GitHub notifications on your menu bar.
9+
10+
11+
# =====================================================
12+
# Source Configuration
13+
# https://docs.sonarsource.com/sonarcloud/advanced-setup/analysis-scope/
14+
# =====================================================
15+
sonar.sources=./src
16+
sonar.exclusions=**/generated/**
17+
sonar.typescript.tsconfigPaths=./tsconfig.json
18+
19+
20+
# =====================================================
21+
# Test and Coverage Configuration
22+
# https://docs.sonarsource.com/sonarcloud/advanced-setup/analysis-scope/
23+
# =====================================================
24+
sonar.tests=./src
25+
sonar.test.inclusions=**/*.test.*, **/__mocks__/**, **/__helpers__/**
26+
sonar.javascript.lcov.reportPaths=./coverage/lcov.info
27+
28+
29+
# =====================================================
30+
# Project Metadata
31+
# https://docs.sonarsource.com/sonarcloud/advanced-setup/ci-based-analysis/sonarscanner-for-npm/configuring/
32+
# =====================================================
33+
sonar.links.homepage=https://gitify.io
34+
sonar.links.ci=https://github.com/gitify-app/gitify/actions
35+
sonar.links.scm=https://github.com/gitify-app/gitify
36+
sonar.links.issue=https://github.com/gitify-app/gitify/issues

0 commit comments

Comments
 (0)
Please sign in to comment.