Skip to content

ci: add github action #1

ci: add github action

ci: add github action #1

name: Flutter Plugin CI
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
build_android:
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: "17"
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: "3.35.4"
- name: Cache Flutter dependencies
uses: actions/cache@v3
with:
path: ~/.pub-cache
key: ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.lock') }}
restore-keys: ${{ runner.os }}-pub-
- name: Install dependencies
run: flutter pub get
- name: Build example (Android)
working-directory: example
run: flutter build apk --debug
- name: List .so 16KB page-size compatibility
shell: bash
run: |
APK="example/build/app/outputs/flutter-apk/app-debug.apk"
unzip -o "$APK" -d output_apk >/dev/null
while IFS= read -r -d '' so; do
aligns=$(readelf -Wl "$so" | awk '/Program Headers/{ph=1} ph && /LOAD/ {for (i=1;i<=NF;i++) if ($i=="Align") print $(i+1)}')
ok=true
for a in $aligns; do
if [[ "$a" =~ ^0x ]]; then val=$((a)); else val=$a; fi
if [ "$val" -lt 16384 ]; then
ok=false
break
fi
done
if $ok; then
echo "[OK] $so (16KB SAFE)"
else
echo "[FAIL] $so (NOT 16KB SAFE)"
fi
done < <(find output_apk -name "*.so" -print0)
build_ios:
runs-on: macos-latest
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: "3.35.4"
- name: Cache Flutter dependencies
uses: actions/cache@v3
with:
path: ~/.pub-cache
key: ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.lock') }}
restore-keys: ${{ runner.os }}-pub-
- name: Install dependencies
run: flutter pub get
- name: Build example (iOS)
working-directory: example
run: flutter build ios --no-codesign