Skip to content

Commit

Permalink
Sonarcloud integration (#27)
Browse files Browse the repository at this point in the history
* test: add account repository test
* fix: register json data
* chore: add synchronized package
* build: disable sonar
* chore: storage package erase
* fix: GetStorage test
* test: add account test
* fix: flutter analyze issues
* feat: IMPORTANT feat... add AppLocalStorage management. removed get_storage, path_provider, synchronized and fake_async
* build: sonarcloud integration
  • Loading branch information
cevheri authored Nov 18, 2024
1 parent 15fa283 commit 79d29ef
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Flutter
uses: subosito/[email protected]
with:
Expand All @@ -29,6 +30,7 @@ jobs:
uses: dart-lang/[email protected]
with:
dart-version: 3.5.4

- name: Setup Java JDK 17
uses: actions/setup-java@v4
with:
Expand All @@ -38,6 +40,7 @@ jobs:
run: echo "JAVA_HOME=/usr/lib/jvm/temurin-17-jdk-amd64" >> $GITHUB_ENV
- name: flutter jdk configuration
run: flutter config --jdk-dir /usr/lib/jvm/temurin-17-jdk-amd64

- name: Install dependencies
run: flutter pub get
- name: Analyze
Expand Down
43 changes: 39 additions & 4 deletions .github/workflows/sonar_scanner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,57 @@ on:
push:
branches:
- sonar
- main
pull_request:
types: [opened, synchronize, reopened]
branches:
- sonar
- main
types: [ opened, synchronize, reopened ]
jobs:
build:
name: Build and analyze
runs-on: ubuntu-latest
container:
image: ghcr.io/cirruslabs/flutter:stable
image: ghcr.io/cirruslabs/flutter:3.24.4
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis

# - name: Setup Flutter
# uses: subosito/[email protected]
# with:
# flutter-version: 3.24.4
# channel: stable
# - name: Setup Dart
# uses: dart-lang/[email protected]
# with:
# dart-version: 3.5.4

# - name: Setup Java JDK 17
# uses: actions/setup-java@v4
# with:
# distribution: 'temurin'
# java-version: '17'
# - name: set JAVA_HOME
# run: echo "JAVA_HOME=/usr/lib/jvm/temurin-17-jdk-amd64" >> $GITHUB_ENV
# - name: flutter jdk configuration
# run: flutter config --jdk-dir /usr/lib/jvm/temurin-17-jdk-amd64

- name: Install dependencies
run: flutter pub get
- name: Analyze
run: flutter analyze
- name: Run tests
run: flutter test --coverage

- name: Cache SonarQube Cloud packages
uses: actions/cache@v4
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar

- name: Build
run: flutter build apk --release --target lib/main/main_prod.dart
- name: Download sonar-scanner
Expand All @@ -29,9 +62,11 @@ jobs:
unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/
- name: Build and analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
$HOME/.sonar/sonar-scanner-6.2.1.4610-linux-x64/bin/sonar-scanner \
-Dsonar.projectKey=cevheri_flutter-bloc-advanced \
-Dsonar.organization=cevheri-open-source
-Dsonar.organization=cevheri-open-source \
-Dsonar.sources=. \
-Dsonar.host.url=https://sonarcloud.io
27 changes: 27 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# This is the name and version displayed in the SonarCloud UI.
sonar.projectKey=cevheri_flutter-bloc-advanced
sonar.organization=cevheri-open-source
sonar.host.url=https://sonarcloud.io


sonar.projectName=flutter-template
sonar.projectVersion=1.0


# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
#sonar.sources=lib/
sonar.exclusions=**/test/**
#sonar.test.exclusions=test/**
sonar.tests=test/
#sonar.verbose=true

# Encoding of the source code. Default is default system encoding
#sonar.sourceEncoding=UTF-8

sonar.c.file.suffixes=-
sonar.cpp.file.suffixes=-
sonar.objc.file.suffixes=-



sonar.dart.lcov.reportPaths=coverage/lcov.info

0 comments on commit 79d29ef

Please sign in to comment.