Skip to content

Commit efb13c8

Browse files
authored
Feature/add git workflow analyzer (#99)
* add sonarqube workflow * add readme description * add sonarqube and rsgpt by default * fix sonarqube dummy configuration * impruve readme
1 parent 31e0c7e commit efb13c8

8 files changed

+158
-29
lines changed

.github/pull_request_template.md

+2-4
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,10 @@
44
### Issue
55
[LINK TO JIRA/GITHUB ISSUE]
66

7-
#### Tasks [ISSUE TASKS covered in this PR when apply]
8-
- [ ] Task 1
9-
- [ ] Task 2
10-
117
### Preview
128
[UI Preview]
139

1410
#### Notes:
1511
[extra note or considerations]
12+
13+
@rs-gpt-review Describe the changes in this PR. Recommend improvements (including code improvements), possible memory leaks, and best practices.

.github/workflows/rs-gpt-review.yml

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# File: .github/workflows/rs-gpt-review.yml
2+
name: 'rs-gpt-review'
3+
4+
# Run the workflow on new issues, pull requests and comments
5+
on:
6+
issues:
7+
types: [opened]
8+
pull_request:
9+
types: [opened]
10+
issue_comment:
11+
types: [created]
12+
pull_request_review_comment:
13+
types: [created]
14+
15+
# Allows the workflow to create comments on issues and pull requests
16+
permissions:
17+
issues: write
18+
pull-requests: write
19+
contents: write
20+
21+
jobs:
22+
# Runs for issues, pull requests and comments
23+
rs-gpt-review:
24+
name: rs-gpt-review comment
25+
# Only run the job if the comment contains @rs-gpt-review
26+
if: ${{ github.event_name == 'issues' && contains(github.event.issue.body, '@rs-gpt-review') || github.event_name == 'pull_request' && contains(github.event.pull_request.body, '@rs-gpt-review') || github.event_name == 'issue_comment' && contains(github.event.comment.body, '@rs-gpt-review') || github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@rs-gpt-review') }}
27+
runs-on: ubuntu-latest
28+
steps:
29+
- uses: actions/checkout@v3
30+
# The action will only run if the description or comments mentions @rs-gpt-review
31+
- uses: rootstrap/rs-gpt-review@v2
32+
name: rs-gpt-review
33+
with:
34+
github_token: ${{ secrets.GITHUB_TOKEN }}
35+
openai_key: ${{ secrets.OPENAI_KEY }}
36+
model: gpt-4-turbo
37+
files_excluded: README.md, LICENSE, rs-gpt-review.yml, sonar-qube-scann.yml, .flutter-plugins, .flutter-plugins-dependencies
+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#SonarQube Configuration
2+
# This is the sonarqube configuration, check readme for instructions
3+
#name: 'sonarqube'
4+
#
5+
#on: push
6+
#
7+
#jobs:
8+
# sonarQubeTrigger:
9+
# name: Sonarqube-Trigger
10+
# runs-on: ubuntu-latest
11+
# steps:
12+
# - uses: dart-lang/setup-dart@v1
13+
# - name: Checkout code
14+
# uses: actions/checkout@v2
15+
# - uses: webfactory/[email protected]
16+
# with:
17+
# ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
18+
# - name: Set up Flutter
19+
# uses: subosito/flutter-action@v2
20+
# with:
21+
# channel: stable
22+
# flutter-version: 3.24.3
23+
# - run: flutter --version
24+
# - name: Get Dependencies
25+
# run: flutter pub get app && flutter pub get modules/domain && flutter pub get modules/data && flutter pub get modules/common
26+
# - name: Analyze App
27+
# #run analyze first
28+
# run: flutter analyze
29+
# - name: Setup Sonarqube Scanner
30+
# uses: warchant/setup-sonar-scanner@v8
31+
# - name: Run Sonarqube Scanner
32+
# run: sonar-scanner
33+
# -Dsonar.token=${{ secrets.SONAR_TOKEN }}
34+
# -Dsonar.host.url=${{ secrets.SONAR_URL }}

.idea/flutter-base.iml

+7-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/libraries/Dart_SDK.xml

+21-21
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

+27-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ This template comes with:
1818
- Intl.
1919
- State Management (Blocs/Cubit).
2020
- Env config and flavors.
21-
- Chat with Gemini and Vertex AI (Documantation and setup WIP)
21+
- Chat with Gemini and Vertex AI (Documentation and setup WIP)
22+
- GitWorkflow config: RS-GPT-Review
23+
- GitWorkflow config: Sonarqube
2224

2325
## Initial Setup
2426

@@ -188,7 +190,30 @@ TBD
188190
189191
We are using Bitrise to configure and run
190192
the [CI/CD pipelines](https://www.notion.so/rootstrap/Flutter-CI-CD-9a0a5957ee8442908fc00c3ea8f49bf1)
191-
.
193+
194+
### Github Actions: RS-GPT-Review
195+
- Configure GPT secrets vars on your repo settings:
196+
- OPENAI_KEY
197+
#### Note: The action will only run if the description or comments mentions @rs-gpt-review
198+
199+
### Github Actions: Sonarqube
200+
- Go to you sonarqube server and configure a new project.
201+
- Configure the sonar-project.properties:
202+
example:
203+
'''
204+
sonar.projectKey=your-app-key
205+
sonar.projectName=your-project-name
206+
sonar.host.url=https://your-sonarqube-server.net
207+
sonar.projectVersion=1.0
208+
sonar.sourceEncoding=UTF-8
209+
'''
210+
# Main source directories
211+
sonar.sources=app/lib,modules/domain,modules/data,modules/common
212+
sonar.dart.exclusions=pubspec.yaml
213+
sonar.dart.analyzer.report.mode=LEGACY
214+
- Configure Sonarqube secrets vars on your repo settings:
215+
- SONAR_TOKEN (your sonarqube project token)
216+
- SONAR_URL (your sonarqube server url)
192217
193218
## License
194219

pubspec.yaml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# This config file is for Sonarqube only
2+
name: Sonar
3+
description: Sonar
4+
5+
publish_to: "none"
6+
version: 0.0.1+1
7+
8+
environment:
9+
sdk: '>=3.0.0 <4.0.0'
10+
11+
dependencies:
12+
flutter:
13+
sdk: flutter
14+
15+
dev_dependencies:
16+
flutter_test:
17+
sdk: flutter
18+
19+
flutter:
20+
generate: true
21+
uses-material-design: true

sonar-project.properties

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
sonar.projectKey=your-project-key
2+
sonar.projectName=your-project-name
3+
sonar.host.url=https://your-sonarqube-server.net
4+
sonar.projectVersion=1.0
5+
sonar.sourceEncoding=UTF-8
6+
# Main source directories
7+
sonar.sources=app/lib,modules/domain,modules/data,modules/common
8+
sonar.dart.exclusions=pubspec.yaml
9+
sonar.dart.analyzer.report.mode=LEGACY

0 commit comments

Comments
 (0)