Files
kryz-go-flutter/.gitea/workflows/ci.yml
T
robot 2cd080b559 fix(ci): use [self-hosted, linux] runner labels for lint and test jobs
The pipeline was failing because Lint and Test jobs used runs-on:
ubuntu-latest which 'act' does not recognize as a local runner label.
On the Mac build server (Magrathea), these jobs were routed to the
macOS runner where Docker containers failed to run Flutter correctly.

Changed:
- lint: ubuntu-latest -> [self-hosted, linux]
- test: ubuntu-latest -> [self-hosted, linux]
- build-android: ubuntu-latest (unchanged)
- build-ios: [self-hosted, macos] (unchanged)

The Linux runner should pick up lint/test while Magrathea handles iOS
builds as intended.
2026-08-02 06:56:42 +00:00

231 lines
7.9 KiB
YAML

# kryz-go-flutter CI Pipeline
# Triggers on push and pull_request
# Stages: lint -> test -> build (Android + iOS) -> artifacts
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
env:
FLUTTER_VERSION: "stable"
jobs:
# ── Stage 1: Lint & static analysis ──────────────────────────────
lint:
name: Lint
runs-on: [self-hosted, linux]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
cache: true
- 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, linux]
needs: [lint]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
cache: true
- 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
- name: Run tests with coverage
if: gitea.ref == 'refs/heads/main' && gitea.event_name == 'push'
run: flutter test --coverage
- name: "Note: coverage artifact storage not configured"
if: gitea.ref == 'refs/heads/main' && gitea.event_name == 'push'
run: |
echo "WARNING: Gitea Actions artifact storage is not configured."
echo "Coverage report available at: coverage/lcov.info"
# ── Stage 3: Android build ──────────────────────────────────────
build-android:
name: Build Android
runs-on: ubuntu-latest
needs: [test]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Java 17
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: "17"
cache: gradle
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
cache: true
- 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-linux-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"
# Gitea Actions: set env vars for subsequent steps in same job
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: Setup Python (for whitelabel build script)
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- 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: Configure release signing
if: env.ANDROID_KEYSTORE_BASE64 != ''
env:
ANDROID_KEYSTORE_BASE64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }}
ANDROID_KEYSTORE_PASS: ${{ secrets.ANDROID_KEYSTORE_PASS }}
ANDROID_KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }}
ANDROID_KEY_PASS: ${{ secrets.ANDROID_KEY_PASS }}
run: |
# Decode keystore
echo "$ANDROID_KEYSTORE_BASE64" | base64 -d > android/app/release.keystore
# Write key.properties for Gradle to consume
cat > android/key.properties <<EOF
storePassword=$ANDROID_KEYSTORE_PASS
keyPassword=$ANDROID_KEY_PASS
keyAlias=$ANDROID_KEY_ALIAS
storeFile=../release.keystore
EOF
- 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 ───────────────────────────────
# Note: requires a macOS runner. Uses 'self-hosted' label which
# matches our Gitea Actions runner. Falls back to --no-codesign
# if Apple signing secrets are not configured.
build-ios:
name: Build iOS
runs-on: [self-hosted, macos]
needs: [test]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
cache: true
- 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."