-
Notifications
You must be signed in to change notification settings - Fork 0
75 lines (65 loc) · 2.2 KB
/
flutter_ci.yml
File metadata and controls
75 lines (65 loc) · 2.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
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