Files
kryz-go-flutter/.gitea/workflows/ci.yml
T
robot bdf20ef713
CI / Lint (pull_request) Waiting to run
CI / Test (pull_request) Blocked by required conditions
CI / Build Android (pull_request) Blocked by required conditions
CI / Build iOS (pull_request) Blocked by required conditions
fix(ci): use 'self-hosted' runner label for all jobs (act runner registers as self-hosted, not [self-hosted, macos])
2026-08-02 10:24:08 +00:00

209 lines
7.9 KiB
YAML

# kryz-go-flutter CI Pipeline
# Triggers on push and pull_request
# Stages: lint -> test -> build (Android + iOS) -> artifacts
#
# CRITICAL: Gitea's `act` runner on Magrathea (macOS ARM64) runs `ubuntu-latest`
# jobs inside x86_64 Docker containers where neither Linux x86_64 nor macOS SDKs
# can execute. ALL jobs MUST use [self-hosted, macos] to run natively on the
# Mac host with macOS ARM64 binaries.
name: CI
on:
push:
branches: [main, develop]
pull_request:
branches: [main]
# Cancel in-progress runs on new push to same branch
concurrency:
group: ${{ gitea.workflow }}-${{ gitea.ref }}
cancel-in-progress: true
jobs:
# ── Stage 1: Lint & static analysis ──────────────────────────────
lint:
name: Lint
runs-on: self-hosted
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Flutter
run: |
# Direct Flutter SDK download — macOS ARM64 (native self-hosted runner)
curl -fsSL "https://storage.googleapis.com/flutter_infra_release/releases/stable/macos/flutter_macos_3.44.8-stable.zip" \
-o flutter.zip
unzip -q flutter.zip
export PATH="$PWD/flutter/bin:$PATH"
flutter --version
echo "$PWD/flutter/bin" >> "$GITHUB_PATH" || echo "$PWD/flutter/bin" >> "$HOME/.env_path"
- name: Install dependencies
run: flutter pub get
- name: Generate stubs (lint gate support)
if: hashFiles('theme.json') == ''
run: python3 ci_stub_gen.py
- name: Analyze Dart code
run: flutter analyze --fatal-warnings
- name: Check formatting
run: dart format --set-exit-if-changed lib/ test/
# ── Stage 2: Unit & widget tests ─────────────────────────────────
test:
name: Test
runs-on: self-hosted
needs: [lint]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Flutter
run: |
curl -fsSL "https://storage.googleapis.com/flutter_infra_release/releases/stable/macos/flutter_macos_3.44.8-stable.zip" \
-o flutter.zip
unzip -q flutter.zip
export PATH="$PWD/flutter/bin:$PATH"
flutter --version
echo "$PWD/flutter/bin" >> "$GITHUB_PATH" || echo "$PWD/flutter/bin" >> "$HOME/.env_path"
- name: Install dependencies
run: flutter pub get
- name: Generate stubs (lint gate support)
run: python3 ci_stub_gen.py
- name: Run tests
run: flutter test --reporter=expanded
# ── Stage 3: Android build ──────────────────────────────────────
build-android:
name: Build Android
runs-on: self-hosted
needs: [test]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Java 17
run: |
# Direct Temurin JDK download — macOS ARM64
curl -fsSL "https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.12%2B7/OpenJDK17U-jdk_aarch64_mac_hotspot_17.0.12_7.tar.gz" \
-o jdk.tar.gz
mkdir -p "$HOME/jdk"
tar -xzf jdk.tar.gz -C "$HOME/jdk" --strip-components=1
export JAVA_HOME="$HOME/jdk"
export PATH="$JAVA_HOME/bin:$PATH"
java -version
echo "JAVA_HOME=$JAVA_HOME" >> "$GITHUB_ENV" || export JAVA_HOME="$JAVA_HOME"
echo "$JAVA_HOME/bin" >> "$GITHUB_PATH" || export PATH="$JAVA_HOME/bin:$PATH"
- name: Setup Flutter
run: |
curl -fsSL "https://storage.googleapis.com/flutter_infra_release/releases/stable/macos/flutter_macos_3.44.8-stable.zip" \
-o flutter.zip
unzip -q flutter.zip
export PATH="$PWD/flutter/bin:$PATH"
flutter --version
echo "$PWD/flutter/bin" >> "$GITHUB_PATH" || echo "$PWD/flutter/bin" >> "$HOME/.env_path"
- name: Install Android SDK command-line tools
run: |
export ANDROID_HOME="${HOME}/android-sdk"
mkdir -p "${ANDROID_HOME}/cmdline-tools"
curl -fsSL "https://dl.google.com/android/repository/commandlinetools-mac-11076708_latest.zip" -o cmdline-tools.zip
unzip -q cmdline-tools.zip -d "${ANDROID_HOME}/cmdline-tools"
mv "${ANDROID_HOME}/cmdline-tools/cmdline-tools" "${ANDROID_HOME}/cmdline-tools/latest"
export PATH="${ANDROID_HOME}/cmdline-tools/latest/bin:${PATH}"
yes | sdkmanager --licenses >/dev/null 2>&1 || true
sdkmanager "platform-tools" "platforms;android-35" "build-tools;35.0.0"
echo "ANDROID_HOME=${ANDROID_HOME}" >> "$GITHUB_ENV" || echo "ANDROID_HOME=${ANDROID_HOME}" >> "$HOME/.env"
echo "${ANDROID_HOME}/cmdline-tools/latest/bin" >> "$GITHUB_PATH" || export PATH="${ANDROID_HOME}/cmdline-tools/latest/bin:${PATH}"
echo "${ANDROID_HOME}/platform-tools" >> "$GITHUB_PATH" || export PATH="${ANDROID_HOME}/platform-tools:${PATH}"
- name: Pre-cache Android platform artifacts
run: flutter precache --android
- name: Accept Android SDK licenses
run: |
yes | sdkmanager --licenses || true
- name: Install dependencies
run: flutter pub get
- name: Generate stubs (lint gate support)
run: python3 ci_stub_gen.py
- name: Analyze (gate before build)
run: flutter analyze --fatal-warnings
- name: Run tests (gate before build)
run: flutter test --reporter=expanded
# Optional: run whitelabel build script to regenerate lib/generated/
# Skip gracefully if theme.json is missing or script fails
- name: Run whitelabel build script
if: hashFiles('theme.json') != ''
run: python3 build_whitelabel.py
- name: Build APK (release)
run: flutter build apk --release
- name: Build App Bundle (release)
run: flutter build appbundle --release
- name: List build outputs
run: |
echo "=== APK output ==="
ls -lh build/app/outputs/flutter-apk/ || true
echo "=== AAB output ==="
ls -lh build/app/outputs/bundle/release/ || true
- name: "Note: artifact storage not configured"
run: |
echo "WARNING: Gitea Actions artifact storage is not configured on this instance."
echo "Build outputs available in runner workspace:"
echo " APK: build/app/outputs/flutter-apk/app-release.apk"
echo " AAB: build/app/outputs/bundle/release/app-release.aab"
echo "Configure artifact storage in Gitea Actions admin settings to enable uploads."
# ── Stage 3 (parallel): iOS build ───────────────────────────────
build-ios:
name: Build iOS
runs-on: self-hosted
needs: [test]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Flutter
run: |
curl -fsSL "https://storage.googleapis.com/flutter_infra_release/releases/stable/macos/flutter_macos_3.44.8-stable.zip" \
-o flutter.zip
unzip -q flutter.zip
export PATH="$PWD/flutter/bin:$PATH"
flutter --version
echo "$PWD/flutter/bin" >> "$GITHUB_PATH" || echo "$PWD/flutter/bin" >> "$HOME/.env_path"
- name: Install dependencies
run: flutter pub get
- name: Install CocoaPods dependencies
run: cd ios && pod install --repo-update
- name: Build iOS (release, no-codesign)
run: flutter build ios --release --no-codesign
- name: "Note: iOS artifact storage not configured"
run: |
echo "WARNING: Gitea Actions artifact storage is not configured on this instance."
echo "iOS build outputs available in runner workspace:"
echo " build/ios/iphoneos/"
echo "Configure artifact storage in Gitea Actions admin settings to enable uploads."