Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 35 additions & 26 deletions .github/workflows/ci-develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ on:
branches:
- "develop"


jobs:
unit-tests:
runs-on: ubuntu-latest
Expand All @@ -32,42 +31,52 @@ jobs:
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 + jacocoreport
- name: Run Tests/generate Jacoco cover report

# 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 }}
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"

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 6 : Vérification du statut du job
- name: Fail PR on error
# Step : No Validation PR en cas d'échec
- name: Clearance PR
if: ${{ failure() }}
run: exit 1
run: echo "Build ou analyse de qualité échouée, PR bloquée."
40 changes: 9 additions & 31 deletions .github/workflows/ci-epic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
pull_request:
branches:
- "epic/**"
types: [opened, synchronize, reopened]
types: [opened, synchronize, reopened, ready_for_review, edited]

jobs:
unit-tests:
Expand All @@ -27,45 +27,23 @@ jobs:
- name: Make gradlew executable
run: chmod +x ./gradlew

# Step 4 : Reconstruire le fichier keystore à partir du secret
# Step 3.5 : 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/


# Step 4 : Installation des dépendances du projet
- name: Download dependencies
run: ./gradlew dependencies

# Step : Lancer les tests unitaire + jacocoreport
- name: Run Tests/generate Jacoco cover report
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 5 : Exécution des tests unitaires et analyse lint
- name: Run Unit Tests & Lint
run: |
echo "--- [Running Lint...]"
./gradlew lintDebug
echo "--- [Running Unit Tests...]"
./gradlew testDebugUnitTest

# Step 6 : Vérification du statut du job
- name: Fail PR on error
Expand Down
28 changes: 26 additions & 2 deletions .github/workflows/ci-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:


jobs:
unit-tests:
build:
runs-on: ubuntu-latest

steps:
Expand Down Expand Up @@ -99,4 +99,28 @@ jobs:
# 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."
run: echo "Build ou analyse de qualité échouée, PR bloquée."

# Step : firebase deploy
deploy:
needs: build
if: github.event_name == 'pull_request' && github.ref == 'refs/heads/main
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Download APK Artifact
uses: actions/download-artifact@v4
with:
name: release-apk
path: app/build/outputs/apk/release/

- name: Upload artifact to Firebase App Distribution
uses: wzieba/Firebase-Distribution-Github-Action@v1.5.1
with:
appId: ${{secrets.FIREBASE_APP_ID}}
token: ${{secrets.FIREBASE_TOKEN}}
#serviceCredentialsFileContent: ${{ secrets.CREDENTIAL_FILE_CONTENT }}
groups: testers
file: app/build/outputs/apk/release/app-release.apk
Loading