From a5368183e3aa7dd4befa740d1a1aa7a51f5245e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Corr=C3=AAa=20da=20Silva?= <78980992+dartmol203@users.noreply.github.com> Date: Sun, 1 Dec 2024 23:33:21 -0300 Subject: [PATCH 1/8] Update code-analysis.yml --- .github/workflows/code-analysis.yml | 56 ++++++++++------------------- 1 file changed, 19 insertions(+), 37 deletions(-) diff --git a/.github/workflows/code-analysis.yml b/.github/workflows/code-analysis.yml index f0cbc73..ac6b5f5 100644 --- a/.github/workflows/code-analysis.yml +++ b/.github/workflows/code-analysis.yml @@ -1,52 +1,34 @@ -name: Build for Sonar +name: SonarQube Cloud on: push: branches: - dev pull_request: - branches: - - dev types: [opened, synchronize, reopened] jobs: - sonarcloud: - name: SonarCloud + build: + name: Build and analyze runs-on: ubuntu-latest + container: + image: ghcr.io/cirruslabs/flutter:stable steps: - uses: actions/checkout@v4 with: fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis - #2 Setup Java - - name: Set Up Java - uses: actions/setup-java@v3.12.0 + - name: Cache SonarQube Cloud packages + uses: actions/cache@v4 with: - distribution: 'oracle' - java-version: '17' - #3 Setup Flutter - - name: Set Up Flutter - uses: subosito/flutter-action@v2 - with: - flutter-version: '3.24.3' - channel: 'stable' - #4 Install Dependencies - - name: Install Dependencies - run: flutter pub get - #5 Run flutter tests - - name: Run Flutter Tests - run: flutter test --coverage - #6 Run Sonar cloud scan - - name: SonarCloud Scan - env: - GITHUB_TOKEN: ${{ secrets.API_TOKEN_GITHUB }} # Needed to get PR information, if any - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + path: ~/.sonar/cache + key: ${{ runner.os }}-sonar + restore-keys: ${{ runner.os }}-sonar + - name: Build + run: flutter build apk + - name: Download sonar-scanner run: | - export SONAR_SCANNER_VERSION=6.2.1.4610 - export SONAR_SCANNER_HOME=$HOME/.sonar/sonar-scanner-$SONAR_SCANNER_VERSION-linux-x64 - curl --create-dirs -sSLo $HOME/.sonar/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$SONAR_SCANNER_VERSION-linux-x64.zip + curl --create-dirs -sSLo $HOME/.sonar/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-6.2.1.4610-linux-x64.zip unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/ - export PATH=$SONAR_SCANNER_HOME/bin:$PATH - export SONAR_SCANNER_OPTS="-server" - sonar-scanner \ - -Dsonar.organization=fga-eps-mds-1 \ - -Dsonar.projectKey=fga-eps-mds_2024.2-ARANDU-APP\ - -Dsonar.sources=./lib \ - -Dsonar.host.url=https://sonarcloud.io + - name: Build and analyze + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + run: $HOME/.sonar/sonar-scanner-6.2.1.4610-linux-x64/bin/sonar-scanner From ed1ae91bdad43af20fe1d4971f0a52a5edc4a3b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Corr=C3=AAa=20da=20Silva?= <78980992+dartmol203@users.noreply.github.com> Date: Sun, 1 Dec 2024 23:42:46 -0300 Subject: [PATCH 2/8] Update code-analysis.yml --- .github/workflows/code-analysis.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/code-analysis.yml b/.github/workflows/code-analysis.yml index ac6b5f5..2d4c247 100644 --- a/.github/workflows/code-analysis.yml +++ b/.github/workflows/code-analysis.yml @@ -22,7 +22,9 @@ jobs: key: ${{ runner.os }}-sonar restore-keys: ${{ runner.os }}-sonar - name: Build - run: flutter build apk + run: flutter run lib/main.dart + - name: Execute tests + run: flutter test --coverage - name: Download sonar-scanner run: | curl --create-dirs -sSLo $HOME/.sonar/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-6.2.1.4610-linux-x64.zip From cebb48409d7b5eb898ffae8dd20c6479e48074c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Corr=C3=AAa=20da=20Silva?= <78980992+dartmol203@users.noreply.github.com> Date: Sun, 1 Dec 2024 23:45:18 -0300 Subject: [PATCH 3/8] Update code-analysis.yml --- .github/workflows/code-analysis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/code-analysis.yml b/.github/workflows/code-analysis.yml index 2d4c247..fe54598 100644 --- a/.github/workflows/code-analysis.yml +++ b/.github/workflows/code-analysis.yml @@ -22,7 +22,7 @@ jobs: key: ${{ runner.os }}-sonar restore-keys: ${{ runner.os }}-sonar - name: Build - run: flutter run lib/main.dart + run: flutter build - name: Execute tests run: flutter test --coverage - name: Download sonar-scanner From 2dc40cc0dbfef1292ac8422ac699898e4955d7c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Corr=C3=AAa=20da=20Silva?= <78980992+dartmol203@users.noreply.github.com> Date: Sun, 1 Dec 2024 23:48:50 -0300 Subject: [PATCH 4/8] add sonar-scanner --- sonar-scanner.properties | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 sonar-scanner.properties diff --git a/sonar-scanner.properties b/sonar-scanner.properties new file mode 100644 index 0000000..3a8553a --- /dev/null +++ b/sonar-scanner.properties @@ -0,0 +1,13 @@ +# SonarCloud project and organization +sonar.projectKey=fga-eps-mds_2024.2-ARANDU-APP +sonar.organization=fga-eps-mds-1 + +# Path to source code and test directories +sonar.sources=./lib +sonar.tests=./test + +# Path to the coverage report generated by flutter test +sonar.dart.lcov.reportPaths=./coverage/lcov.info + +# Exclude specific directories and files from analysis +sonar.exclusions=**/assets/**, .github/**, scripts/**, **/*.g.dart From dfdb7d663d401d234dc8671cbbca4c4db5770e13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Corr=C3=AAa=20da=20Silva?= <78980992+dartmol203@users.noreply.github.com> Date: Sun, 1 Dec 2024 23:57:47 -0300 Subject: [PATCH 5/8] update code-analysis.yml --- .github/workflows/code-analysis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/code-analysis.yml b/.github/workflows/code-analysis.yml index fe54598..566c810 100644 --- a/.github/workflows/code-analysis.yml +++ b/.github/workflows/code-analysis.yml @@ -33,4 +33,4 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - run: $HOME/.sonar/sonar-scanner-6.2.1.4610-linux-x64/bin/sonar-scanner + run: $HOME/.sonar/sonar-scanner-6.2.1.4610-linux-x64/bin/sonar-scanner -Dsonar.projectKey=fga-eps-mds_2024.2-ARANDU-APP -Dsonar.organization=fga-eps-mds-1 -Dsonar.sources=./lib -Dsonar.tests=./test -Dsonar.dart.lcov.reportPaths=./coverage/lcov.info -Dsonar.exclusions=**/assets/**, .github/**, scripts/**, **/*.g.dart From a1e1fa3d0c2acf2cd153ef8aceccc52b21f2d06d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Corr=C3=AAa=20da=20Silva?= <78980992+dartmol203@users.noreply.github.com> Date: Mon, 2 Dec 2024 00:00:08 -0300 Subject: [PATCH 6/8] update code-analysis Co-authored-by: gabrielm2q --- .github/workflows/code-analysis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/code-analysis.yml b/.github/workflows/code-analysis.yml index 566c810..b8b8f1a 100644 --- a/.github/workflows/code-analysis.yml +++ b/.github/workflows/code-analysis.yml @@ -33,4 +33,4 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - run: $HOME/.sonar/sonar-scanner-6.2.1.4610-linux-x64/bin/sonar-scanner -Dsonar.projectKey=fga-eps-mds_2024.2-ARANDU-APP -Dsonar.organization=fga-eps-mds-1 -Dsonar.sources=./lib -Dsonar.tests=./test -Dsonar.dart.lcov.reportPaths=./coverage/lcov.info -Dsonar.exclusions=**/assets/**, .github/**, scripts/**, **/*.g.dart + run: $HOME/.sonar/sonar-scanner-6.2.1.4610-linux-x64/bin/sonar-scanner -Dsonar.projectKey=fga-eps-mds_2024.2-ARANDU-APP -Dsonar.organization=fga-eps-mds-1 -Dsonar.sources=./lib -Dsonar.tests=./test -Dsonar.dart.lcov.reportPaths=./coverage/lcov.info -Dsonar.exclusions={**/assets/**, .github/**, scripts/**, **/*.g.dart} From 35144d5458ca06a802c11bc4761a047f25828194 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Corr=C3=AAa=20da=20Silva?= <78980992+dartmol203@users.noreply.github.com> Date: Mon, 2 Dec 2024 00:03:21 -0300 Subject: [PATCH 7/8] update code-analysis Co-authored-by: gabrielm2q --- .github/workflows/code-analysis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/code-analysis.yml b/.github/workflows/code-analysis.yml index b8b8f1a..c3fbc5e 100644 --- a/.github/workflows/code-analysis.yml +++ b/.github/workflows/code-analysis.yml @@ -33,4 +33,4 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - run: $HOME/.sonar/sonar-scanner-6.2.1.4610-linux-x64/bin/sonar-scanner -Dsonar.projectKey=fga-eps-mds_2024.2-ARANDU-APP -Dsonar.organization=fga-eps-mds-1 -Dsonar.sources=./lib -Dsonar.tests=./test -Dsonar.dart.lcov.reportPaths=./coverage/lcov.info -Dsonar.exclusions={**/assets/**, .github/**, scripts/**, **/*.g.dart} + run: $HOME/.sonar/sonar-scanner-6.2.1.4610-linux-x64/bin/sonar-scanner -Dproject.settings=./sonar-project.properties From 08770757e1cc6e1a4c8ff94bc44b93c7baece1cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Corr=C3=AAa=20da=20Silva?= <78980992+dartmol203@users.noreply.github.com> Date: Mon, 2 Dec 2024 00:09:38 -0300 Subject: [PATCH 8/8] update code -analysis Co-authored-by: gabrielm2q --- .github/workflows/code-analysis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/code-analysis.yml b/.github/workflows/code-analysis.yml index c3fbc5e..d6bebdf 100644 --- a/.github/workflows/code-analysis.yml +++ b/.github/workflows/code-analysis.yml @@ -33,4 +33,4 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - run: $HOME/.sonar/sonar-scanner-6.2.1.4610-linux-x64/bin/sonar-scanner -Dproject.settings=./sonar-project.properties + run: $HOME/.sonar/sonar-scanner-6.2.1.4610-linux-x64/bin/sonar-scanner -Dsonar.projectKey=fga-eps-mds_2024.2-ARANDU-APP -Dsonar.organization=fga-eps-mds-1 -Dsonar.sources=./lib -Dsonar.tests=./test -Dsonar.dart.lcov.reportPaths=./coverage/lcov.info