chore: setup sonar cloud #36
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Code Quality Check | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: ["*"] | |
jobs: | |
code-check: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: subosito/flutter-action@v2 | |
with: | |
channel: "stable" | |
cache: true | |
- run: flutter pub get | |
- run: flutter analyze | |
- run: flutter pub run dart_code_metrics:metrics analyze lib | |
- run: flutter test | |
sonarqube: | |
name: SonarQube | |
runs-on: ubuntu-latest | |
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/[email protected] | |
with: | |
distribution: "oracle" | |
java-version: "17" | |
#3 Setup Flutter | |
- name: Set Up Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
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: Build | |
run: flutter build apk | |
- name: SonarQube Scan | |
uses: SonarSource/sonarqube-scan-action@v4 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |