From 7d63af632ef483b55a01fddb4293aff7938d8434 Mon Sep 17 00:00:00 2001 From: Amaury Date: Mon, 12 Aug 2024 15:47:09 -0300 Subject: [PATCH 1/5] add sonarqube workflow --- .github/workflows/rs-gpt-review.yml | 35 ++++++++++++++++++++++++++ .github/workflows/sonar-qube-scann.yml | 29 +++++++++++++++++++++ .idea/flutter-base.iml | 6 +++++ 3 files changed, 70 insertions(+) create mode 100644 .github/workflows/rs-gpt-review.yml create mode 100644 .github/workflows/sonar-qube-scann.yml diff --git a/.github/workflows/rs-gpt-review.yml b/.github/workflows/rs-gpt-review.yml new file mode 100644 index 0000000..14f4281 --- /dev/null +++ b/.github/workflows/rs-gpt-review.yml @@ -0,0 +1,35 @@ +# File: .github/workflows/rs-gpt-review.yml +name: 'rs-gpt-review' + +# Run the workflow on new issues, pull requests and comments +on: + issues: + types: [opened] + pull_request: + types: [opened] + issue_comment: + types: [created] + pull_request_review_comment: + types: [created] + +# Allows the workflow to create comments on issues and pull requests +permissions: + issues: write + pull-requests: write + contents: write + +jobs: + # Runs for issues, pull requests and comments + rs-gpt-review: + name: rs-gpt-review comment + # Only run the job if the comment contains @rs-gpt-review + 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') }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + # The action will only run if the description or comments mentions @rs-gpt-review + - uses: rootstrap/rs-gpt-review@v2 + name: rs-gpt-review + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + openai_key: ${{ secrets.OPENAI_KEY }} \ No newline at end of file diff --git a/.github/workflows/sonar-qube-scann.yml b/.github/workflows/sonar-qube-scann.yml new file mode 100644 index 0000000..ab8ef47 --- /dev/null +++ b/.github/workflows/sonar-qube-scann.yml @@ -0,0 +1,29 @@ +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 }} diff --git a/.idea/flutter-base.iml b/.idea/flutter-base.iml index 5a36ec1..6adc79c 100644 --- a/.idea/flutter-base.iml +++ b/.idea/flutter-base.iml @@ -56,6 +56,12 @@ + + + + + + From 08f6e77b8f506d8303892acfb6d8e72d096aeba0 Mon Sep 17 00:00:00 2001 From: Amaury Date: Mon, 12 Aug 2024 15:51:59 -0300 Subject: [PATCH 2/5] add readme description --- .idea/flutter-base.iml | 2 -- .idea/libraries/Dart_SDK.xml | 42 ++++++++++++++++++------------------ README.md | 14 ++++++++++-- 3 files changed, 33 insertions(+), 25 deletions(-) diff --git a/.idea/flutter-base.iml b/.idea/flutter-base.iml index 6adc79c..73198cb 100644 --- a/.idea/flutter-base.iml +++ b/.idea/flutter-base.iml @@ -66,7 +66,5 @@ - - \ No newline at end of file diff --git a/.idea/libraries/Dart_SDK.xml b/.idea/libraries/Dart_SDK.xml index f235aca..8b6af92 100644 --- a/.idea/libraries/Dart_SDK.xml +++ b/.idea/libraries/Dart_SDK.xml @@ -1,27 +1,27 @@ - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + diff --git a/README.md b/README.md index bf5d5d2..a8313bc 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,9 @@ This template comes with: - Intl. - State Management (Blocs/Cubit). - Env config and flavors. -- Chat with Gemini and Vertex AI (Documantation and setup WIP) +- Chat with Gemini and Vertex AI (Documentation and setup WIP) +- GitWorkflow config: RS-GPT-Review +- GitWorkflow config: Sonarqube ## Initial Setup @@ -188,7 +190,15 @@ TBD We are using Bitrise to configure and run the [CI/CD pipelines](https://www.notion.so/rootstrap/Flutter-CI-CD-9a0a5957ee8442908fc00c3ea8f49bf1) -. + +### Github Actions: RS-GPT-Review +- Configure GPT secrets vars on your repo settings: + - OPENAI_KEY + +### Github Actions: Sonarqube +- Configure Sonarqube secrets vars on your repo settings: + - SONAR_TOKEN (your sonarqube project token) + - SONAR_URL (your sonarqube server url) ## License From abf484c57a9d8ad764c74147079b16b54a014811 Mon Sep 17 00:00:00 2001 From: Amaury Date: Wed, 11 Dec 2024 10:11:02 -0300 Subject: [PATCH 3/5] add sonarqube and rsgpt by default --- .github/pull_request_template.md | 6 ++---- .github/workflows/rs-gpt-review.yml | 4 +++- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 8551266..6a99dda 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -4,12 +4,10 @@ ### Issue [LINK TO JIRA/GITHUB ISSUE] -#### Tasks [ISSUE TASKS covered in this PR when apply] -- [ ] Task 1 -- [ ] Task 2 - ### Preview [UI Preview] #### Notes: [extra note or considerations] + +@rs-gpt-review Describe the changes in this PR. Recommend improvements (including code improvements), possible memory leaks, and best practices. diff --git a/.github/workflows/rs-gpt-review.yml b/.github/workflows/rs-gpt-review.yml index 14f4281..501ffba 100644 --- a/.github/workflows/rs-gpt-review.yml +++ b/.github/workflows/rs-gpt-review.yml @@ -32,4 +32,6 @@ jobs: name: rs-gpt-review with: github_token: ${{ secrets.GITHUB_TOKEN }} - openai_key: ${{ secrets.OPENAI_KEY }} \ No newline at end of file + openai_key: ${{ secrets.OPENAI_KEY }} + model: gpt-4-turbo + files_excluded: README.md, LICENSE, rs-gpt-review.yml, sonar-qube-scann.yml, .flutter-plugins, .flutter-plugins-dependencies From 1b9e216ade27dd0fe40375628374f7d3c5a9d935 Mon Sep 17 00:00:00 2001 From: Amaury Date: Wed, 11 Dec 2024 10:20:10 -0300 Subject: [PATCH 4/5] fix sonarqube dummy configuration --- .github/workflows/sonar-qube-scann.yml | 63 ++++++++++++++------------ README.md | 14 ++++++ pubspec.yaml | 21 +++++++++ sonar-project.properties | 9 ++++ 4 files changed, 78 insertions(+), 29 deletions(-) create mode 100644 pubspec.yaml create mode 100644 sonar-project.properties diff --git a/.github/workflows/sonar-qube-scann.yml b/.github/workflows/sonar-qube-scann.yml index ab8ef47..a6b60f6 100644 --- a/.github/workflows/sonar-qube-scann.yml +++ b/.github/workflows/sonar-qube-scann.yml @@ -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 }} diff --git a/README.md b/README.md index a8313bc..d208cdb 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/pubspec.yaml b/pubspec.yaml new file mode 100644 index 0000000..20ca790 --- /dev/null +++ b/pubspec.yaml @@ -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 \ No newline at end of file diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 0000000..1932d01 --- /dev/null +++ b/sonar-project.properties @@ -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 From 9d78e1c179312e0db9b4f3dca831d01b0b331cd8 Mon Sep 17 00:00:00 2001 From: Amaury Date: Thu, 12 Dec 2024 09:18:22 -0300 Subject: [PATCH 5/5] impruve readme --- .idea/flutter-base.iml | 1 + README.md | 1 + 2 files changed, 2 insertions(+) diff --git a/.idea/flutter-base.iml b/.idea/flutter-base.iml index 73198cb..63f30ae 100644 --- a/.idea/flutter-base.iml +++ b/.idea/flutter-base.iml @@ -62,6 +62,7 @@ + diff --git a/README.md b/README.md index d208cdb..c40c4be 100644 --- a/README.md +++ b/README.md @@ -194,6 +194,7 @@ the [CI/CD pipelines](https://www.notion.so/rootstrap/Flutter-CI-CD-9a0a5957ee84 ### Github Actions: RS-GPT-Review - Configure GPT secrets vars on your repo settings: - OPENAI_KEY +#### Note: The action will only run if the description or comments mentions @rs-gpt-review ### Github Actions: Sonarqube - Go to you sonarqube server and configure a new project.