Repository navigation
82 lines (66 loc) · 2.63 KB
/
Copy pathci-develop.yml
File metadata and controls
82 lines (66 loc) · 2.63 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
76
77
78
79
80
81
82
name: CI - Develop Branch PR
on:
pull_request:
branches:
- "develop"
jobs:
unit-tests:
runs-on: ubuntu-latest
steps:
# Step 1 : Checkout du code source
- name: Checkout code
uses: actions/checkout@v4
# Step 2 : Configuration de JDK 17
- name: Setup JDK
uses: actions/setup-java@v4
with:
java-version: 17
distribution: temurin
cache: gradle
# Step 3 : Donner la permission d'exécution au wrapper Gradle
- name: Make gradlew executable
run: chmod +x ./gradlew
# Step 4 : Reconstruire le fichier keystore à partir du secret
- name: Decode keystore file
run: |
echo "${{ secrets.KEYSTORE_FILE_BASE64 }}" | base64 -d > app/rebonnte-release-key.jks
ls -la app/
#start emulator and run instrumented tests
- name: Enable KVM
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
# Step : Récupérer l'historique Git complet pour SonarCloud
- name: Fetch full Git history
run: git fetch --unshallow
# Step 4 : Installation des dépendances du projet
- name: Download dependencies
run: ./gradlew dependencies
# Step : Lancer les tests unitaire et instrumented + jacocoreport + sonar analyse
- name: Run Tests/generate Jacoco cover report and Sonar Quality Gate analyse
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
uses: reactivecircus/android-emulator-runner@v2
with:
target: google_apis
arch: x86_64
api-level: 35
script: |
echo "--- [Waiting for emulator to stabilize...]"
#sleep 30
adb wait-for-device
echo "--- [Unlocking emulator screen...]"
adb shell input keyevent 82
adb shell wm dismiss-keyguard
echo "--- [Lint debug]"
./gradlew lintDebug
echo "--- [Generating Jacoco report...]"
./gradlew jacocoReport
echo "--- [Checking if Jacoco report exists...]"
ls app/build/reports/jacoco/jacocoTestReport
cat app/build/reports/jacoco/jacocoTestReport/jacocoTestReport.xml || echo " [X] - Jacoco report not found"
# Step : No Validation PR en cas d'échec
- name: Clearance PR
if: ${{ failure() }}
run: echo "Build ou analyse de qualité échouée, PR bloquée."