Skip to content

Feature/user profile #71

Feature/user profile

Feature/user profile #71

Workflow file for this run

name: Flutter Sonarcloud Analysis
on:
push:
branches:
- "main"
- "develop"
pull_request:
branches:
- "main"
- "develop"
jobs:
build-and-analyze:
name: Flutter Build and Analyze
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./src
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Java
uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'zulu'
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: 'stable'
flutter-version: 'any'
cache: true
# Cache cho dữ liệu phân tích của SonarCloud (Sensor Cache)
- name: Cache SonarCloud packages
uses: actions/cache@v4
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
# Cache cho bộ cài đặt Sonar Scanner CLI để không phải tải lại mỗi lần
- name: Cache Sonar Scanner CLI
id: cache-sonar-scanner
uses: actions/cache@v4
with:
path: src/sonar-scanner-5.0.1.3006-linux
key: ${{ runner.os }}-sonar-scanner-5.0.1.3006
- name: Install dependencies
run: flutter pub get
- name: Run Sonar Scanner Native OS
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
# Chỉ tải và giải nén nếu chưa có trong cache
if [ ! -d "sonar-scanner-5.0.1.3006-linux" ]; then
wget -q https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-5.0.1.3006-linux.zip
unzip -q sonar-scanner-cli-5.0.1.3006-linux.zip
fi
./sonar-scanner-5.0.1.3006-linux/bin/sonar-scanner \
-Dsonar.organization=tqha1011 \
-Dsonar.projectKey=tqha1011_taskmanagementapp \
-Dsonar.sources=lib \
-Dsonar.exclusions="**/*.g.dart,**/*.freezed.dart,**/*.part.dart" \
-Dsonar.host.url=https://sonarcloud.io