yavsc/.forgejo/workflows/buildAndTest.yml

88 lines
3.1 KiB
YAML
Raw Normal View History

2026-02-02 00:39:06 +00:00
# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
name: Dotnet build and test
on:
workflow_dispatch:
inputs:
logLevel:
description: 'Log level'
required: true
default: 'warning'
type: choice
options:
- info
- warning
- debug
tags:
description: 'Test scenario tags'
required: false
type: boolean
push:
branches: [ "main" ]
pull_request:
2026-08-18 21:25:06 +01:00
branches: [ "main", "release/*" ]
2026-02-02 00:39:06 +00:00
jobs:
build:
2026-08-16 13:03:17 +01:00
runs-on: docker
2026-08-26 04:52:57 +01:00
container:
image: pazof/yavsc-build-env:debian12-dotnet10-android36-v5
2026-02-02 00:39:06 +00:00
steps:
- name: Clone yavsc
run: |
cd /src
git clone https://forgejo.pschneider.fr/notazof/yavsc.git _src
cd _src
if [ -n "${GITHUB_REF:-}" ]; then
git fetch origin "$GITHUB_REF"
git checkout FETCH_HEAD
fi
git submodule update --init --recursive
2026-08-26 01:42:59 +01:00
echo "✅ Checked out at $(git rev-parse HEAD) on $(git branch --show-current 2>/dev/null || echo detached HEAD)"
2026-08-25 23:07:19 +01:00
- name: Démarrer l'émulateur QEMU Headless
2026-08-25 23:01:00 +01:00
run: |
2026-08-26 04:52:57 +01:00
# 1. Variables d'environnement pour stabiliser le noyau Android 36
export RE_EMULATOR_DISABLE_CPUID_CHECK=1
export ANDROID_EMULATOR_DISABLE_VULKAN=1
export ANDROID_EMULATOR_FORCE_GLES_2=1
2026-08-26 06:58:47 +01:00
# 1. Variables de stabilisation
export RE_EMULATOR_DISABLE_CPUID_CHECK=1
export ANDROID_EMULATOR_DISABLE_VULKAN=1
2026-08-26 07:05:00 +01:00
export LD_LIBRARY_PATH=/opt/android-sdk/emulator/lib64:/opt/android-sdk/emulator/lib64/qt/lib:$LD_LIBRARY_PATH
2026-08-26 04:52:57 +01:00
2026-08-26 06:58:47 +01:00
# 2. Appel direct du moteur sans passer par le script de vérification de Google
# Remplacez "postit_test_avd" par le nom exact de votre AVD
/opt/android-sdk/emulator/qemu/linux-x86_64/qemu-system-x86_64 -avd postit_test_avd -no-window -no-audio &
2026-08-26 04:52:57 +01:00
2026-08-26 05:44:46 +01:00
echo "⌛ Attente de la détection par ADB..."
2026-08-25 23:01:00 +01:00
adb wait-for-device
2026-08-26 04:52:57 +01:00
2026-08-26 05:44:46 +01:00
echo "⌛ Attente de la fin du boot d'Android..."
2026-08-25 23:01:00 +01:00
OUT=""
2026-08-26 04:52:57 +01:00
COUNTER=0
# Sécurité : ajout d'un timeout (max 30 essais) pour éviter que la CI ne tourne à l'infini si le boot gèle
while [[ "$OUT" != "1" && $COUNTER -lt 30 ]]; do
sleep 10
2026-08-25 23:01:00 +01:00
OUT=$(adb shell getprop sys.boot_completed | tr -d '\r')
echo "Statut actuel : ${OUT:-0}"
2026-08-26 04:52:57 +01:00
let COUNTER=COUNTER+1
2026-08-25 23:01:00 +01:00
done
2026-08-26 04:52:57 +01:00
if [ "$OUT" != "1" ]; then
echo "❌ Échec du boot d'Android après délai imparti."
exit 1
fi
2026-08-25 23:01:00 +01:00
echo "✅ L'émulateur Android est prêt !"
2026-08-26 04:52:57 +01:00
2026-02-02 00:39:06 +00:00
- name: Test
2026-08-25 23:06:25 +01:00
run: |
2026-08-26 05:44:46 +01:00
echo "🚀 Installation de l'APK de Debug..."
2026-08-26 05:09:02 +01:00
# Ajustez le chemin vers l'APK généré par votre build de debug
cd /src/_src
APK=src/PostIt/PostIt.Android/bin/Debug/net10.0-android/android-arm64/fr.pschneider.postit-Signed.apk
adb install ${APK}
2026-08-26 05:44:46 +01:00
echo "🚀 Lancement des tests..."
2026-08-26 01:49:57 +01:00
cd /src/_src && dotnet test --verbosity normal && echo "✅ Success !"