ci: let Flutter handle CocoaPods, set iOS platform 13.0, and restrict Android build to Gitea
Build Android APK / Build Release APKs (push) Successful in 17m37s
Build Android APK / Build Release APKs (push) Successful in 17m37s
This commit is contained in:
@@ -1,171 +0,0 @@
|
||||
name: Build Android APK
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- master
|
||||
- 'refactor/**'
|
||||
tags:
|
||||
- 'v*'
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
- master
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build-android:
|
||||
name: Build Release APKs
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
container:
|
||||
image: ghcr.io/cirruslabs/flutter:3.19.3
|
||||
options: --privileged
|
||||
steps:
|
||||
- name: Setup Node.js 20 & ARM64 Flutter Engine
|
||||
run: |
|
||||
ARCH=$(uname -m)
|
||||
if [ "$ARCH" = "aarch64" ] || [ "$ARCH" = "arm64" ]; then NODE_ARCH="arm64"; else NODE_ARCH="x64"; fi
|
||||
curl -fsSL "https://nodejs.org/dist/v20.18.0/node-v20.18.0-linux-${NODE_ARCH}.tar.gz" | tar -xzf - -C /usr/local --strip-components=1
|
||||
node --version
|
||||
git config --global --add safe.directory "$GITHUB_WORKSPACE"
|
||||
git config --global --add safe.directory '*'
|
||||
|
||||
# On Linux ARM64, Flutter engine and Android AAPT2 need x86_64 emulation via QEMU.
|
||||
if [ "$ARCH" = "aarch64" ] || [ "$ARCH" = "arm64" ]; then
|
||||
echo "Setting up ARM64 Flutter environment & QEMU binfmt emulation..."
|
||||
apt-get update -qq && apt-get install -y -qq qemu-user-static binfmt-support libc6-amd64-cross libstdc++6-amd64-cross gcc
|
||||
|
||||
# Setup x86_64 dynamic libraries & prefix for QEMU emulation
|
||||
mkdir -p /etc/qemu-binfmt
|
||||
ln -sf /usr/x86_64-linux-gnu /etc/qemu-binfmt/x86_64
|
||||
mkdir -p /lib64 /usr/lib64
|
||||
ln -sf /usr/x86_64-linux-gnu/lib/ld-linux-x86-64.so.2 /lib64/ld-linux-x86-64.so.2
|
||||
ln -sf /usr/x86_64-linux-gnu/lib/* /lib64/ 2>/dev/null || true
|
||||
ln -sf /usr/x86_64-linux-gnu/lib/* /usr/lib64/ 2>/dev/null || true
|
||||
|
||||
export QEMU_LD_PREFIX=/usr/x86_64-linux-gnu
|
||||
echo "QEMU_LD_PREFIX=/usr/x86_64-linux-gnu" >> "$GITHUB_ENV"
|
||||
|
||||
QEMU_BIN=$(command -v qemu-x86_64-static || command -v qemu-x86_64)
|
||||
|
||||
# Dummy fallbacks for FEX binaries/sockets
|
||||
for fex in /usr/bin/FEXInterpreter /usr/bin/FEX /usr/local/bin/FEXInterpreter /usr/bin/FEXServer /usr/local/bin/FEXServer; do
|
||||
printf '#!/bin/sh\nexit 0\n' > "$fex"
|
||||
chmod +x "$fex" 2>/dev/null || true
|
||||
done
|
||||
|
||||
flutter precache --android
|
||||
for dir in /sdks/flutter/bin/cache/artifacts/engine/android-*; do
|
||||
if [ -d "$dir/linux-x64" ]; then
|
||||
mkdir -p "$dir/linux-arm64"
|
||||
printf '#!/bin/sh\nSCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"\nexec %s -L /usr/x86_64-linux-gnu "$SCRIPT_DIR/../linux-x64/gen_snapshot" "$@"\n' "$QEMU_BIN" > "$dir/linux-arm64/gen_snapshot"
|
||||
chmod +x "$dir/linux-arm64/gen_snapshot"
|
||||
echo "Configured gen_snapshot wrapper for $(basename "$dir")"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup QEMU Interceptor
|
||||
run: |
|
||||
ARCH=$(uname -m)
|
||||
if [ "$ARCH" = "aarch64" ] || [ "$ARCH" = "arm64" ]; then
|
||||
echo "Compiling transparent QEMU execution interceptor..."
|
||||
gcc -O2 -shared -fPIC -o /usr/local/lib/libqemu_intercept.so scripts/ci/qemu_intercept.c -ldl
|
||||
echo "LD_PRELOAD=/usr/local/lib/libqemu_intercept.so" >> "$GITHUB_ENV"
|
||||
rm -f /etc/ld.so.preload
|
||||
echo "Enabled LD_PRELOAD interceptor via GITHUB_ENV"
|
||||
fi
|
||||
|
||||
- name: Make Gradlew Executable
|
||||
run: |
|
||||
if [ -f android/gradlew ]; then
|
||||
chmod +x android/gradlew
|
||||
fi
|
||||
|
||||
- name: Inspect Build Environment
|
||||
run: |
|
||||
flutter --version
|
||||
java -version
|
||||
node --version
|
||||
|
||||
- name: Fetch Flutter Dependencies
|
||||
run: flutter pub get
|
||||
|
||||
- name: Run Code Analysis & Tests
|
||||
run: |
|
||||
flutter analyze
|
||||
flutter test
|
||||
|
||||
- name: Build Universal Release APK
|
||||
run: |
|
||||
flutter build apk --release || {
|
||||
echo "Checking if APK was built despite path mismatch..."
|
||||
find build android -type f -name "*release*.apk" 2>/dev/null
|
||||
}
|
||||
|
||||
- name: Build Split-per-ABI Release APKs
|
||||
run: |
|
||||
flutter build apk --release --split-per-abi || {
|
||||
echo "Checking if split APKs were built despite path mismatch..."
|
||||
find build android -type f -name "*release*.apk" 2>/dev/null
|
||||
}
|
||||
|
||||
- name: Organize Artifacts
|
||||
run: |
|
||||
mkdir -p release-apks
|
||||
# Copy universal APK
|
||||
if [ -f build/app/outputs/flutter-apk/app-release.apk ]; then
|
||||
cp build/app/outputs/flutter-apk/app-release.apk release-apks/oggauer-gemeindetrommler-universal.apk
|
||||
elif [ -f android/app/build/outputs/apk/release/app-release.apk ]; then
|
||||
cp android/app/build/outputs/apk/release/app-release.apk release-apks/oggauer-gemeindetrommler-universal.apk
|
||||
fi
|
||||
# Copy split APKs
|
||||
for apk in build/app/outputs/flutter-apk/*.apk android/app/build/outputs/apk/release/*.apk; do
|
||||
[ -f "$apk" ] || continue
|
||||
case "$(basename "$apk")" in
|
||||
*arm64-v8a*) cp "$apk" release-apks/oggauer-gemeindetrommler-arm64-v8a.apk ;;
|
||||
*armeabi-v7a*) cp "$apk" release-apks/oggauer-gemeindetrommler-armeabi-v7a.apk ;;
|
||||
*x86_64*) cp "$apk" release-apks/oggauer-gemeindetrommler-x86_64.apk ;;
|
||||
esac
|
||||
done
|
||||
echo "=== Generated All 4 APK Artifacts ==="
|
||||
ls -lah release-apks/
|
||||
|
||||
- name: Upload Universal APK
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: oggauer-gemeindetrommler-universal
|
||||
path: release-apks/oggauer-gemeindetrommler-universal.apk
|
||||
retention-days: 7
|
||||
|
||||
- name: Upload ARM64 APK
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: oggauer-gemeindetrommler-arm64-v8a
|
||||
path: release-apks/oggauer-gemeindetrommler-arm64-v8a.apk
|
||||
retention-days: 7
|
||||
|
||||
- name: Upload ARMv7 APK
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: oggauer-gemeindetrommler-armeabi-v7a
|
||||
path: release-apks/oggauer-gemeindetrommler-armeabi-v7a.apk
|
||||
retention-days: 7
|
||||
|
||||
- name: Upload x86_64 APK
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: oggauer-gemeindetrommler-x86_64
|
||||
path: release-apks/oggauer-gemeindetrommler-x86_64.apk
|
||||
retention-days: 7
|
||||
|
||||
- name: Clean Workspace Disk Space
|
||||
if: always()
|
||||
run: |
|
||||
rm -rf build android/.gradle release-apks 2>/dev/null || true
|
||||
@@ -14,6 +14,7 @@ jobs:
|
||||
build-ios:
|
||||
name: Build iOS IPA
|
||||
runs-on: macos-14
|
||||
if: github.server_url == 'https://github.com'
|
||||
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
@@ -32,18 +33,15 @@ jobs:
|
||||
xcodebuild -version
|
||||
pod --version
|
||||
|
||||
- name: Fetch Dependencies
|
||||
- name: Fetch Flutter Dependencies
|
||||
run: flutter pub get
|
||||
|
||||
- name: Install CocoaPods Pods
|
||||
run: |
|
||||
cd ios
|
||||
pod install --repo-update
|
||||
cd ..
|
||||
|
||||
- name: Build iOS (Unsigned IPA)
|
||||
run: |
|
||||
# Flutter automatically manages CocoaPods installation
|
||||
flutter build ios --release --no-codesign
|
||||
|
||||
# Package Runner.app into installable IPA
|
||||
mkdir -p build/ios/iphoneos/Payload
|
||||
cp -r build/ios/iphoneos/Runner.app build/ios/iphoneos/Payload/
|
||||
cd build/ios/iphoneos
|
||||
|
||||
Reference in New Issue
Block a user