Skip to content

Commit

Permalink
fix sonarqube dummy configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
amaury901130 committed Dec 11, 2024
1 parent abf484c commit 1b9e216
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 29 deletions.
63 changes: 34 additions & 29 deletions .github/workflows/sonar-qube-scann.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,34 @@
name: 'sonarqube'

on: push

jobs:
sonarQubeTrigger:
name: Sonarqube-Trigger
runs-on: ubuntu-latest
steps:
- uses: dart-lang/setup-dart@v1
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
flutter-version: 3.22.3
- run: flutter --version
- name: Get Dependencies
run: flutter pub get app && flutter pub get modules/domain && flutter pub get modules/data && flutter pub get modules/common
- name: Analyze App
#run analyze first
run: flutter analyze
- name: Setup Sonarqube Scanner
uses: warchant/setup-sonar-scanner@v8
- name: Run Sonarqube Scanner
run: sonar-scanner
-Dsonar.token=${{ secrets.SONAR_TOKEN }}
-Dsonar.host.url=${{ secrets.SONAR_URL }}
#SonarQube Configuration
# This is the sonarqube configuration, check readme for instructions
#name: 'sonarqube'
#
#on: push
#
#jobs:
# sonarQubeTrigger:
# name: Sonarqube-Trigger
# runs-on: ubuntu-latest
# steps:
# - uses: dart-lang/setup-dart@v1
# - name: Checkout code
# uses: actions/checkout@v2
# - uses: webfactory/ssh-agent@v0.9.0
# with:
# ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
# - name: Set up Flutter
# uses: subosito/flutter-action@v2
# with:
# channel: stable
# flutter-version: 3.24.3
# - run: flutter --version
# - name: Get Dependencies
# run: flutter pub get app && flutter pub get modules/domain && flutter pub get modules/data && flutter pub get modules/common
# - name: Analyze App
# #run analyze first
# run: flutter analyze
# - name: Setup Sonarqube Scanner
# uses: warchant/setup-sonar-scanner@v8
# - name: Run Sonarqube Scanner
# run: sonar-scanner
# -Dsonar.token=${{ secrets.SONAR_TOKEN }}
# -Dsonar.host.url=${{ secrets.SONAR_URL }}
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,20 @@ the [CI/CD pipelines](https://www.notion.so/rootstrap/Flutter-CI-CD-9a0a5957ee84
- OPENAI_KEY
### Github Actions: Sonarqube
- Go to you sonarqube server and configure a new project.
- Configure the sonar-project.properties:
example:
'''
sonar.projectKey=your-app-key
sonar.projectName=your-project-name
sonar.host.url=https://your-sonarqube-server.net
sonar.projectVersion=1.0
sonar.sourceEncoding=UTF-8
'''
# Main source directories
sonar.sources=app/lib,modules/domain,modules/data,modules/common
sonar.dart.exclusions=pubspec.yaml
sonar.dart.analyzer.report.mode=LEGACY
- Configure Sonarqube secrets vars on your repo settings:
- SONAR_TOKEN (your sonarqube project token)
- SONAR_URL (your sonarqube server url)
Expand Down
21 changes: 21 additions & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# This config file is for Sonarqube only
name: Sonar
description: Sonar

publish_to: "none"
version: 0.0.1+1

environment:
sdk: '>=3.0.0 <4.0.0'

dependencies:
flutter:
sdk: flutter

dev_dependencies:
flutter_test:
sdk: flutter

flutter:
generate: true
uses-material-design: true
9 changes: 9 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
sonar.projectKey=your-project-key
sonar.projectName=your-project-name
sonar.host.url=https://your-sonarqube-server.net
sonar.projectVersion=1.0
sonar.sourceEncoding=UTF-8
# Main source directories
sonar.sources=app/lib,modules/domain,modules/data,modules/common
sonar.dart.exclusions=pubspec.yaml
sonar.dart.analyzer.report.mode=LEGACY

0 comments on commit 1b9e216

Please sign in to comment.