yavsc/.forgejo/workflows/buildAndTest.yml
Paul Schneider 99c500d177
Some checks failed
Dotnet build and test / build (pull_request) Has been cancelled
start qemu
2026-08-26 17:13:20 +01:00

100 lines
3.4 KiB
YAML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 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:
branches: [ "main", "release/*" ]
jobs:
build:
runs-on: docker
container:
image: pazof/yavsc-build-env:debian13-dotnet10-android36-v7
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
echo "✅ Checked out at $(git rev-parse HEAD) on $(git branch --show-current 2>/dev/null || echo detached HEAD)"
- name: setup avd qemu
run: |
export QT_QPA_PLATFORM=offscreen
export ANDROID_EMULATOR_USE_SYSTEM_LIBS=1
export ANDROID_SDK_ROOT=/opt/android-sdk
echo "hw.ramSize = 3072" >> ${ANDROID_SDK_ROOT}/.android/avd/postit_test_avd.ini
echo "hw.ramSize = 2048" >> ${ANDROID_SDK_ROOT}/.android/avd/postit_test_avd.ini
echo "hw.heapSize = 256" >> ${ANDROID_SDK_ROOT}/.android/avd/postit_test_avd.ini
echo "hw.gpu.enabled = yes" >> ${ANDROID_SDK_ROOT}/.android/avd/postit_test_avd.ini
echo "hw.gpu.mode = host" >> ${ANDROID_SDK_ROOT}/.android/avd/postit_test_avd.ini
echo "Vulkan = off" >> ${ANDROID_SDK_ROOT}/.android/avd/advancedFeatures.ini
echo "enableHostVulkan = no" >> ${ANDROID_SDK_ROOT}/.android/avd/advancedFeatures.ini
echo "GLDirectMem = off" >> ${ANDROID_SDK_ROOT}/.android/avd/advancedFeatures.ini
- name: Start qemu avd
run: |
# 2. Démarrer l'émulateur QEMU Headless
emulator -avd postit_test_avd \
-no-window \
-no-audio \
-no-boot-anim \
-no-metrics \
-cores 2 \
-memory 2048 &
echo "⌛ Attente de la détection par ADB..."
adb wait-for-device
echo "⌛ Attente de la fin du boot d'Android..."
OUT=""
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
OUT=$(adb shell getprop sys.boot_completed | tr -d '\r')
echo "Statut actuel : ${OUT:-0}"
let COUNTER=COUNTER+1
done
if [ "$OUT" != "1" ]; then
echo "❌ Échec du boot d'Android après délai imparti."
exit 1
fi
echo "✅ L'émulateur Android est prêt !"
- name: Test
run: |
echo "🚀 Installation de l'APK de Debug..."
# 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}
echo "🚀 Lancement des tests..."
cd /src/_src && dotnet test --verbosity normal && echo "✅ Success !"