Skip to content

feat: sonarqube setup #1805

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 33 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,36 @@ jobs:
- run: pnpm install
- run: pnpm tsc --noEmit
- run: pnpm test -- --coverage --runInBand --verbose
- name: Coveralls
uses: coverallsapp/github-action@v2

- name: Archive code coverage results
uses: actions/upload-artifact@v4
with:
name: code-coverage-report
path: coverage/lcov.info

sonarqube:
name: SonarQube Cloud Analysis
runs-on: ubuntu-latest
needs: run-unit-tests
# Only analyze PRs from the same repository. Limitation of SonarQube Cloud
if: github.event.pull_request.head.repo.fork == false

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- uses: pnpm/action-setup@v3
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'pnpm'
- run: pnpm install
- name: Download a single artifact
uses: actions/download-artifact@v4
with:
name: code-coverage-report
path: coverage/
- name: SonarQube Cloud Scan
uses: SonarSource/sonarqube-scan-action@v4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Gitify

[![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]
[![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]

> GitHub Notifications on your menu bar. Available on macOS, Windows and Linux.

Expand Down Expand Up @@ -43,8 +43,11 @@ For more information, see [LICENSE](LICENSE).
[brew]: https://brew.sh/
[homebrew-cask]: https://formulae.brew.sh/cask/gitify

[coveralls]: https://coveralls.io/github/gitify-app/gitify
[coveralls-badge]: https://img.shields.io/coverallsCoverage/github/gitify-app/gitify?logo=coveralls
[coverage-badge]: https://img.shields.io/sonar/coverage/gitify-app_gitify?server=https%3A%2F%2Fsonarcloud.io&logo=sonarcloud
[coverage]: https://sonarcloud.io/summary/new_code?id=gitify-app_gitify
[quality-badge]: https://img.shields.io/sonar/quality_gate/gitify-app_gitify?server=https%3A%2F%2Fsonarcloud.io&logo=sonarcloud
[quality]: https://sonarcloud.io/summary/new_code?id=gitify-app_gitify

[ci-workflow-badge]: https://github.com/gitify-app/gitify/actions/workflows/ci.yml/badge.svg
[release-workflow-badge]: https://github.com/gitify-app/gitify/actions/workflows/release.yml/badge.svg
[downloads-total-badge]: https://img.shields.io/github/downloads/gitify-app/gitify/total?label=downloads@all&logo=github
Expand Down
11 changes: 11 additions & 0 deletions renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,16 @@
"matchDatasources": ["npm"],
"commitMessageTopic": "{{depName}}"
}
],
"customManagers": [
{
"description": "Keep sonar.projectVersion variables in sonar-project.properties in-sync",
"customType": "regex",
"datasourceTemplate": "github-tags",
"depNameTemplate": "gitify-app/gitify",
"versioningTemplate": "loose",
"fileMatch": ["sonar-project.properties"],
"matchStrings": ["\\s?sonar.projectVersion=(?<currentValue>.+?)\\s"]
}
]
}
36 changes: 36 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# =====================================================
# SonarCloud
# https://docs.sonarsource.com/sonarcloud/advanced-setup/ci-based-analysis/github-actions-for-sonarcloud/
# =====================================================
sonar.projectKey=gitify-app_gitify
sonar.organization=gitify-app
sonar.projectVersion=v6.0.0
sonar.projectDescription=GitHub notifications on your menu bar.


# =====================================================
# Source Configuration
# https://docs.sonarsource.com/sonarcloud/advanced-setup/analysis-scope/
# =====================================================
sonar.sources=./src
sonar.exclusions=**/generated/**
sonar.typescript.tsconfigPaths=./tsconfig.json


# =====================================================
# Test and Coverage Configuration
# https://docs.sonarsource.com/sonarcloud/advanced-setup/analysis-scope/
# =====================================================
sonar.tests=./src
sonar.test.inclusions=**/*.test.*, **/__mocks__/**, **/__helpers__/**
sonar.javascript.lcov.reportPaths=./coverage/lcov.info


# =====================================================
# Project Metadata
# https://docs.sonarsource.com/sonarcloud/advanced-setup/ci-based-analysis/sonarscanner-for-npm/configuring/
# =====================================================
sonar.links.homepage=https://gitify.io
sonar.links.ci=https://github.com/gitify-app/gitify/actions
sonar.links.scm=https://github.com/gitify-app/gitify
sonar.links.issue=https://github.com/gitify-app/gitify/issues
Loading