diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 0000000..4e38285 --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,79 @@ +# MotorSignal Azure Pipelines pilot +# Manual, non-publishing validation only. No signing keys or deployments. +trigger: none +pr: none + +pool: + vmImage: ubuntu-24.04 + +variables: + flutterVersion: '3.44.6' + +steps: + - checkout: self + clean: true + fetchDepth: 1 + + - bash: | + set -euo pipefail + echo 'Before cleanup:' + df -h / + free -h + # Microsoft-hosted Ubuntu includes toolchains this Android pipeline does not need. + sudo rm -rf /usr/share/dotnet /usr/local/share/powershell /opt/ghc /usr/local/.ghcup + sudo rm -rf /usr/local/lib/android/sdk/emulator /usr/local/lib/android/sdk/system-images + sudo apt-get clean + echo 'After cleanup:' + df -h / + free -h + available_kb="$(df --output=avail / | tail -1 | tr -d ' ')" + if [ "$available_kb" -lt 6291456 ]; then + echo 'At least 6 GiB free disk is required before Android SDK provisioning.' + exit 1 + fi + displayName: 'Free unused toolchains and verify disk capacity' + + - bash: | + set -euo pipefail + git clone --depth 1 --branch "$(flutterVersion)" https://github.com/flutter/flutter.git "$(Agent.TempDirectory)/flutter" + echo "##vso[task.prependpath]$(Agent.TempDirectory)/flutter/bin" + "$(Agent.TempDirectory)/flutter/bin/flutter" --version + displayName: 'Install pinned Flutter SDK' + + - bash: | + set -euo pipefail + flutter pub get + dart run build_runner build --delete-conflicting-outputs + flutter analyze --no-fatal-infos + flutter test + displayName: 'Generate, analyze and test Flutter' + + - bash: | + set -euo pipefail + echo 'Before Android compilation:' + df -h / + free -h + SDKROOT="${ANDROID_SDK_ROOT:-${ANDROID_HOME:-}}" + test -n "$SDKROOT" + echo "flutter.sdk=$(Agent.TempDirectory)/flutter" > android/local.properties + SDKMANAGER="$(find "$SDKROOT/cmdline-tools" -type f -name sdkmanager -print -quit 2>/dev/null || true)" + test -x "$SDKMANAGER" + "$SDKMANAGER" 'platforms;android-36' 'build-tools;36.0.0' 'platform-tools' + if [ ! -f android/gradlew ]; then + (cd android && gradle wrapper --gradle-version 9.1.0 --distribution-type all) + fi + chmod +x android/gradlew + # Agent-specific limits, applied only in CI's disposable checkout. + cat >> android/gradle.properties <<'GRADLE_LIMITS' + org.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=768m -XX:ReservedCodeCacheSize=256m -Dfile.encoding=UTF-8 + org.gradle.workers.max=2 + org.gradle.parallel=false + org.gradle.daemon=false + GRADLE_LIMITS + export JAVA_TOOL_OPTIONS="-XX:MaxRAMPercentage=60" + flutter build apk --debug + test -s build/app/outputs/flutter-apk/app-debug.apk || test -s build/app/outputs/flutter-apk/app-production-debug.apk + echo 'Android debug APK built and verified locally; artifact intentionally not published.' + df -h / + free -h + displayName: 'Build and verify debug APK without artifact upload'