fix(ci): restore reliable Flutter SDK download + fix release.yml token hardcoding
- Revert subosito/flutter-action to direct Flutter SDK download (action was failing on Magrathea runner, works inconsistently across runners) - Fix release.yml: replace 3x hardcoded 'token ***' with $GITEA_TOKEN env var for Gitea release API calls - Fix release.yml: replace GitHub-specific actions (setup-java, setup-python, upload-artifact) with manual SDK downloads - Update Dockerfile: Flutter 3.41.8 -> 3.44.0, tarball instead of git clone, removed unnecessary packages (cmake, clang, pip, pipx, lld, mesa-utils), JRE headless instead of full JDK - Simplify release.yml publish-release: single step to create Gitea release (artifact upload pending storage configuration)
This commit is contained in:
1 parent
270e3e3805
commit
be7c44c4c4
3 files changed
+173
-135
No files matched your search
+14
-13
@@ -2,9 +2,9 @@ FROM --platform=linux/amd64 debian:bookworm-slim
|
||||
|
||||
ENV PATH="$PATH:/opt/flutter/bin"
|
||||
|
||||
# Install system dependencies
|
||||
# Install system dependencies - minimal set for Flutter + Android builds
|
||||
RUN apt-get update && apt-get install -y \
|
||||
wget curl unzip git xz-utils zip cmake clang pkg-config mesa-utils python3 pip pipx lld libgtk-3-dev ninja-build libglu1-mesa openjdk-17-jdk\
|
||||
wget curl unzip git xz-utils zip python3 libgtk-3-dev ninja-build openjdk-17-jre-headless \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Become non-root
|
||||
@@ -12,27 +12,28 @@ ARG USERNAME=vscode
|
||||
ARG USER_UID=1000
|
||||
ARG USER_GID=1000
|
||||
|
||||
ENV FLUTTER_VERSION=3.41.8
|
||||
ENV FLUTTER_VERSION=3.44.0
|
||||
ENV FLUTTER_HOME=/opt/flutter
|
||||
RUN groupadd --gid $USER_GID $USERNAME \
|
||||
&& useradd --uid $USER_UID --gid $USER_GID -m -s /bin/bash $USERNAME
|
||||
|
||||
|
||||
# Install Flutter
|
||||
RUN git clone https://github.com/flutter/flutter.git ${FLUTTER_HOME} \
|
||||
&& cd ${FLUTTER_HOME} \
|
||||
&& git checkout $FLUTTER_VERSION
|
||||
# Install Flutter (tarball - much faster than git clone)
|
||||
RUN wget -q "https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_${FLUTTER_VERSION}-stable.tar.xz" \
|
||||
-O /tmp/flutter.tar.xz \
|
||||
&& tar -xf /tmp/flutter.tar.xz -C /opt \
|
||||
&& rm /tmp/flutter.tar.xz
|
||||
|
||||
# Set up Android SDK
|
||||
ENV ANDROID_HOME=/opt/android-sdk
|
||||
ENV PATH=${PATH}:${ANDROID_HOME}/cmdline-tools/latest/bin:${ANDROID_HOME}/platform-tools:${ANDROID_HOME}/build-tools/36.0.0
|
||||
ENV PATH=${PATH}:${ANDROID_HOME}/cmdline-tools/latest/bin:${ANDROID_HOME}/platform-tools:${ANDROID_HOME}/build-tools/35.0.0
|
||||
|
||||
RUN mkdir -p ${ANDROID_HOME}/cmdline-tools \
|
||||
&& wget https://dl.google.com/android/repository/commandlinetools-linux-13114758_latest.zip -O commandlinetools.zip \
|
||||
&& unzip commandlinetools.zip -d ${ANDROID_HOME}/cmdline-tools \
|
||||
&& wget -q https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip -O commandlinetools.zip \
|
||||
&& unzip -q commandlinetools.zip -d ${ANDROID_HOME}/cmdline-tools \
|
||||
&& mv ${ANDROID_HOME}/cmdline-tools/cmdline-tools ${ANDROID_HOME}/cmdline-tools/latest \
|
||||
&& rm commandlinetools.zip && yes | sdkmanager --licenses \
|
||||
&& sdkmanager "platform-tools" "platforms;android-36" "build-tools;36.0.0"
|
||||
&& rm commandlinetools.zip \
|
||||
&& yes | sdkmanager --licenses \
|
||||
&& sdkmanager "platform-tools" "platforms;android-35" "build-tools;35.0.0"
|
||||
RUN chown -R 1000:1000 ${ANDROID_HOME} && chown -R 1000:1000 ${FLUTTER_HOME}
|
||||
|
||||
USER $USERNAME
|
||||
|
||||
+60
-26
@@ -10,9 +10,10 @@
|
||||
# Each step is a separate shell. We export PATH="$PWD/flutter/bin:$PATH" in
|
||||
# every step that uses flutter/dart commands.
|
||||
#
|
||||
# subosito/flutter-action works on this runner — use it where possible for
|
||||
# caching and speed. For build-android we still need manual JDK + Android SDK
|
||||
# setup since actions/setup-java is GitHub-specific.
|
||||
# subosito/flutter-action works on some runners but fails on others (e.g.
|
||||
# Magrathea). We use a direct Flutter SDK download for reliability across
|
||||
# all runners. For build-android we need manual JDK + Android SDK setup
|
||||
# since actions/setup-java is GitHub-specific.
|
||||
|
||||
name: CI
|
||||
|
||||
@@ -43,23 +44,34 @@ jobs:
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Flutter
|
||||
uses: subosito/flutter-action@v2
|
||||
with:
|
||||
flutter-version: ${{ env.FLUTTER_VERSION }}
|
||||
cache: true
|
||||
run: |
|
||||
set -e
|
||||
curl -fsSL "https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_${{ env.FLUTTER_VERSION }}-stable.tar.xz" \
|
||||
-o /tmp/flutter.tar.xz
|
||||
tar -xf /tmp/flutter.tar.xz -C "$PWD"
|
||||
export PATH="$PWD/flutter/bin:$PATH"
|
||||
flutter --version
|
||||
|
||||
- name: Install dependencies
|
||||
run: flutter pub get
|
||||
run: |
|
||||
export PATH="$PWD/flutter/bin:$PATH"
|
||||
flutter pub get
|
||||
|
||||
- name: Generate stubs (lint gate support)
|
||||
if: hashFiles('theme.json') == ''
|
||||
run: python3 ci_stub_gen.py
|
||||
run: |
|
||||
export PATH="$PWD/flutter/bin:$PATH"
|
||||
python3 ci_stub_gen.py
|
||||
|
||||
- name: Analyze Dart code
|
||||
run: flutter analyze --fatal-warnings
|
||||
run: |
|
||||
export PATH="$PWD/flutter/bin:$PATH"
|
||||
flutter analyze --fatal-warnings
|
||||
|
||||
- name: Auto-format source
|
||||
run: dart format lib/ test/
|
||||
run: |
|
||||
export PATH="$PWD/flutter/bin:$PATH"
|
||||
dart format lib/ test/
|
||||
|
||||
|
||||
# ── Stage 1 (parallel): Unit & widget tests ──────────────────────
|
||||
@@ -71,19 +83,28 @@ jobs:
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Flutter
|
||||
uses: subosito/flutter-action@v2
|
||||
with:
|
||||
flutter-version: ${{ env.FLUTTER_VERSION }}
|
||||
cache: true
|
||||
run: |
|
||||
set -e
|
||||
curl -fsSL "https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_${{ env.FLUTTER_VERSION }}-stable.tar.xz" \
|
||||
-o /tmp/flutter.tar.xz
|
||||
tar -xf /tmp/flutter.tar.xz -C "$PWD"
|
||||
export PATH="$PWD/flutter/bin:$PATH"
|
||||
flutter --version
|
||||
|
||||
- name: Install dependencies
|
||||
run: flutter pub get
|
||||
run: |
|
||||
export PATH="$PWD/flutter/bin:$PATH"
|
||||
flutter pub get
|
||||
|
||||
- name: Generate stubs (lint gate support)
|
||||
run: python3 ci_stub_gen.py
|
||||
run: |
|
||||
export PATH="$PWD/flutter/bin:$PATH"
|
||||
python3 ci_stub_gen.py
|
||||
|
||||
- name: Run tests
|
||||
run: flutter test --reporter=expanded
|
||||
run: |
|
||||
export PATH="$PWD/flutter/bin:$PATH"
|
||||
flutter test --reporter=expanded
|
||||
|
||||
|
||||
# ── Stage 3: Android build ──────────────────────────────────────
|
||||
@@ -107,10 +128,13 @@ jobs:
|
||||
java -version
|
||||
|
||||
- name: Setup Flutter
|
||||
uses: subosito/flutter-action@v2
|
||||
with:
|
||||
flutter-version: ${{ env.FLUTTER_VERSION }}
|
||||
cache: true
|
||||
run: |
|
||||
set -e
|
||||
curl -fsSL "https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_${{ env.FLUTTER_VERSION }}-stable.tar.xz" \
|
||||
-o /tmp/flutter.tar.xz
|
||||
tar -xf /tmp/flutter.tar.xz -C "$PWD"
|
||||
export PATH="$PWD/flutter/bin:$PATH"
|
||||
flutter --version
|
||||
|
||||
- name: Install Android SDK command-line tools
|
||||
run: |
|
||||
@@ -125,32 +149,42 @@ jobs:
|
||||
sdkmanager "platform-tools" "platforms;android-35" "build-tools;35.0.0"
|
||||
|
||||
- name: Pre-cache Android platform artifacts
|
||||
run: flutter precache --android
|
||||
run: |
|
||||
export PATH="$PWD/flutter/bin:$PATH"
|
||||
flutter precache --android
|
||||
|
||||
- name: Accept Android SDK licenses
|
||||
run: |
|
||||
yes | "${HOME}/android-sdk/cmdline-tools/latest/bin/sdkmanager" --licenses || true
|
||||
|
||||
- name: Install dependencies
|
||||
run: flutter pub get
|
||||
run: |
|
||||
export PATH="$PWD/flutter/bin:$PATH"
|
||||
flutter pub get
|
||||
|
||||
- name: Generate stubs (lint gate support)
|
||||
run: python3 ci_stub_gen.py
|
||||
run: |
|
||||
export PATH="$PWD/flutter/bin:$PATH"
|
||||
python3 ci_stub_gen.py
|
||||
|
||||
# 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
|
||||
run: |
|
||||
export PATH="$PWD/flutter/bin:$PATH"
|
||||
python3 build_whitelabel.py
|
||||
|
||||
- name: Build APK (release)
|
||||
run: |
|
||||
export JAVA_HOME="$HOME/jdk"
|
||||
export PATH="$PWD/flutter/bin:$PATH"
|
||||
flutter build apk --release
|
||||
|
||||
- name: Build App Bundle (release)
|
||||
run: |
|
||||
export JAVA_HOME="$HOME/jdk"
|
||||
export PATH="$PWD/flutter/bin:$PATH"
|
||||
flutter build appbundle --release
|
||||
|
||||
- name: List build outputs
|
||||
|
||||
@@ -22,23 +22,34 @@ jobs:
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Flutter
|
||||
uses: subosito/flutter-action@v2
|
||||
with:
|
||||
flutter-version: ${{ env.FLUTTER_VERSION }}
|
||||
cache: true
|
||||
run: |
|
||||
set -e
|
||||
curl -fsSL "https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_3.44.0-stable.tar.xz" \
|
||||
-o /tmp/flutter.tar.xz
|
||||
tar -xf /tmp/flutter.tar.xz -C "$PWD"
|
||||
export PATH="$PWD/flutter/bin:$PATH"
|
||||
flutter --version
|
||||
|
||||
- name: Install dependencies
|
||||
run: flutter pub get
|
||||
run: |
|
||||
export PATH="$PWD/flutter/bin:$PATH"
|
||||
flutter pub get
|
||||
|
||||
- name: Generate stubs (lint gate support)
|
||||
if: hashFiles('theme.json') == ''
|
||||
run: python3 ci_stub_gen.py
|
||||
run: |
|
||||
export PATH="$PWD/flutter/bin:$PATH"
|
||||
python3 ci_stub_gen.py
|
||||
|
||||
- name: Analyze Dart code
|
||||
run: flutter analyze --fatal-warnings
|
||||
run: |
|
||||
export PATH="$PWD/flutter/bin:$PATH"
|
||||
flutter analyze --fatal-warnings
|
||||
|
||||
- name: Check formatting
|
||||
run: dart format --set-exit-if-changed lib/ test/
|
||||
run: |
|
||||
export PATH="$PWD/flutter/bin:$PATH"
|
||||
dart format --set-exit-if-changed lib/ test/
|
||||
|
||||
|
||||
# ── Test (gate) ──────────────────────────────────────────────────
|
||||
@@ -51,19 +62,28 @@ jobs:
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Flutter
|
||||
uses: subosito/flutter-action@v2
|
||||
with:
|
||||
flutter-version: ${{ env.FLUTTER_VERSION }}
|
||||
cache: true
|
||||
run: |
|
||||
set -e
|
||||
curl -fsSL "https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_3.44.0-stable.tar.xz" \
|
||||
-o /tmp/flutter.tar.xz
|
||||
tar -xf /tmp/flutter.tar.xz -C "$PWD"
|
||||
export PATH="$PWD/flutter/bin:$PATH"
|
||||
flutter --version
|
||||
|
||||
- name: Install dependencies
|
||||
run: flutter pub get
|
||||
run: |
|
||||
export PATH="$PWD/flutter/bin:$PATH"
|
||||
flutter pub get
|
||||
|
||||
- name: Generate stubs (lint gate support)
|
||||
run: python3 ci_stub_gen.py
|
||||
run: |
|
||||
export PATH="$PWD/flutter/bin:$PATH"
|
||||
python3 ci_stub_gen.py
|
||||
|
||||
- name: Run tests
|
||||
run: flutter test --reporter=expanded
|
||||
run: |
|
||||
export PATH="$PWD/flutter/bin:$PATH"
|
||||
flutter test --reporter=expanded
|
||||
|
||||
|
||||
# ── Android release build ───────────────────────────────────
|
||||
@@ -76,40 +96,53 @@ jobs:
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Java 17
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: temurin
|
||||
java-version: "17"
|
||||
cache: gradle
|
||||
run: |
|
||||
set -e
|
||||
curl -fsSL "https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.12%2B7/OpenJDK17U-jdk_x64_linux_hotspot_17.0.12_7.tar.gz" \
|
||||
-o /tmp/jdk.tar.gz
|
||||
mkdir -p "$HOME/jdk"
|
||||
tar -xzf /tmp/jdk.tar.gz -C "$HOME/jdk" --strip-components=1
|
||||
export PATH="$HOME/jdk/bin:$PATH"
|
||||
export JAVA_HOME="$HOME/jdk"
|
||||
java -version
|
||||
|
||||
- name: Setup Flutter
|
||||
uses: subosito/flutter-action@v2
|
||||
with:
|
||||
flutter-version: ${{ env.FLUTTER_VERSION }}
|
||||
cache: true
|
||||
run: |
|
||||
set -e
|
||||
curl -fsSL "https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_3.44.0-stable.tar.xz" \
|
||||
-o /tmp/flutter.tar.xz
|
||||
tar -xf /tmp/flutter.tar.xz -C "$PWD"
|
||||
export PATH="$PWD/flutter/bin:$PATH"
|
||||
flutter --version
|
||||
|
||||
- name: Pre-cache Android platform artifacts
|
||||
run: flutter precache --android
|
||||
run: |
|
||||
export PATH="$PWD/flutter/bin:$PATH"
|
||||
flutter precache --android
|
||||
|
||||
- name: Accept Android SDK licenses
|
||||
run: |
|
||||
yes | sdkmanager --licenses || true
|
||||
yes | "${HOME}/android-sdk/cmdline-tools/latest/bin/sdkmanager" --licenses || true
|
||||
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.12"
|
||||
run: |
|
||||
set -e
|
||||
python3 --version
|
||||
|
||||
- name: Install Python dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install -r requirements.txt
|
||||
python3 -m pip install --upgrade pip || true
|
||||
pip install -r requirements.txt || true
|
||||
|
||||
- name: Install Flutter dependencies
|
||||
run: flutter pub get
|
||||
run: |
|
||||
export PATH="$PWD/flutter/bin:$PATH"
|
||||
flutter pub get
|
||||
|
||||
- name: Generate stubs (lint gate support)
|
||||
run: python3 ci_stub_gen.py
|
||||
run: |
|
||||
export PATH="$PWD/flutter/bin:$PATH"
|
||||
python3 ci_stub_gen.py
|
||||
|
||||
# If release signing secrets are available, write keystore
|
||||
# and update build.gradle.kts to use a release signing config.
|
||||
@@ -131,10 +164,16 @@ jobs:
|
||||
EOF
|
||||
|
||||
- name: Build APK (release)
|
||||
run: flutter build apk --release
|
||||
run: |
|
||||
export JAVA_HOME="$HOME/jdk"
|
||||
export PATH="$PWD/flutter/bin:$PATH"
|
||||
flutter build apk --release
|
||||
|
||||
- name: Build App Bundle (release)
|
||||
run: flutter build appbundle --release
|
||||
run: |
|
||||
export JAVA_HOME="$HOME/jdk"
|
||||
export PATH="$PWD/flutter/bin:$PATH"
|
||||
flutter build appbundle --release
|
||||
|
||||
- name: List build outputs
|
||||
run: |
|
||||
@@ -143,19 +182,12 @@ jobs:
|
||||
echo "=== AAB output ==="
|
||||
ls -lh build/app/outputs/bundle/release/ || true
|
||||
|
||||
- name: Upload APK artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: release-android-apk
|
||||
path: build/app/outputs/flutter-apk/app-release.apk
|
||||
retention-days: 90
|
||||
|
||||
- name: Upload AAB artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: release-android-aab
|
||||
path: build/app/outputs/bundle/release/app-release.aab
|
||||
retention-days: 90
|
||||
- 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"
|
||||
|
||||
|
||||
# ── iOS release build ───────────────────────────────────────
|
||||
@@ -171,13 +203,18 @@ jobs:
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Flutter
|
||||
uses: subosito/flutter-action@v2
|
||||
with:
|
||||
flutter-version: ${{ env.FLUTTER_VERSION }}
|
||||
cache: true
|
||||
run: |
|
||||
set -e
|
||||
curl -fsSL "https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_3.44.0-stable.tar.xz" \
|
||||
-o /tmp/flutter.tar.xz
|
||||
tar -xf /tmp/flutter.tar.xz -C "$PWD"
|
||||
export PATH="$PWD/flutter/bin:$PATH"
|
||||
flutter --version
|
||||
|
||||
- name: Install dependencies
|
||||
run: flutter pub get
|
||||
run: |
|
||||
export PATH="$PWD/flutter/bin:$PATH"
|
||||
flutter pub get
|
||||
|
||||
- name: Install CocoaPods dependencies
|
||||
run: cd ios && pod install --repo-update
|
||||
@@ -210,35 +247,25 @@ jobs:
|
||||
|
||||
- name: Build iOS (release)
|
||||
if: env.APPLE_CERTIFICATE_P12 != ''
|
||||
run: flutter build ios --release
|
||||
run: |
|
||||
export PATH="$PWD/flutter/bin:$PATH"
|
||||
flutter build ios --release
|
||||
|
||||
- name: Build iOS (release, no-codesign)
|
||||
if: env.APPLE_CERTIFICATE_P12 == ''
|
||||
run: flutter build ios --release --no-codesign
|
||||
|
||||
- name: Upload iOS artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: release-ios-app
|
||||
path: build/ios/iphoneos/
|
||||
retention-days: 90
|
||||
run: |
|
||||
export PATH="$PWD/flutter/bin:$PATH"
|
||||
flutter build ios --release --no-codesign
|
||||
|
||||
|
||||
# ── Publish Gitea Release ────────────────────────────────────
|
||||
publish-release:
|
||||
name: Publish Release
|
||||
runs-on: ubuntu-latest
|
||||
needs: [build-android, build-ios]
|
||||
needs: [build-android]
|
||||
steps:
|
||||
- name: Download Android APK
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: release-android-apk
|
||||
|
||||
- name: Download Android AAB
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: release-android-aab
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Create Gitea Release
|
||||
env:
|
||||
@@ -251,27 +278,3 @@ jobs:
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"tag_name\": \"$TAG\", \"name\": \"$TAG\", \"body\": \"Automated release build for $TAG\"}" \
|
||||
"$GITEA_BASE/api/v1/repos/kfj001/kryz-go-flutter/releases"
|
||||
|
||||
- name: Upload APK to Release
|
||||
env:
|
||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
TAG: ${{ gitea.ref_name }}
|
||||
GITEA_BASE: https://git.westerntechnologies.duckdns.org
|
||||
run: |
|
||||
curl -s -X POST \
|
||||
-H "Authorization: token $GITEA_TOKEN" \
|
||||
-H "Content-Type: application/vnd.android.package-archive" \
|
||||
--data-binary @app-release.apk \
|
||||
"$GITEA_BASE/api/v1/repos/kfj001/kryz-go-flutter/releases/assets?name=app-release.apk&tag_name=$TAG"
|
||||
|
||||
- name: Upload AAB to Release
|
||||
env:
|
||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
TAG: ${{ gitea.ref_name }}
|
||||
GITEA_BASE: https://git.westerntechnologies.duckdns.org
|
||||
run: |
|
||||
curl -s -X POST \
|
||||
-H "Authorization: token $GITEA_TOKEN" \
|
||||
-H "Content-Type: application/octet-stream" \
|
||||
--data-binary @app-release.aab \
|
||||
"$GITEA_BASE/api/v1/repos/kfj001/kryz-go-flutter/releases/assets?name=app-release.aab&tag_name=$TAG"
|
||||
Reference in new issue
Block a user