Skip to content

chore: release v1.1.2 #64

chore: release v1.1.2

chore: release v1.1.2 #64

Workflow file for this run

name: CI
on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
workflow_dispatch:
# Cancel in-flight runs for the same branch on new pushes
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
# ── Dart analysis + format ──────────────────────────────────────────────────
analyze:
name: Analyze & Format
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
flutter-version-file: .flutter-version
channel: stable
cache: true
- name: Get dependencies (plugin)
run: flutter pub get
- name: Override gen dependency to local path
run: |
printf 'dependency_overrides:\n native_workmanager:\n path: ..\n meta: ">=1.17.0 <3.0.0"\n' > native_workmanager_gen/pubspec_overrides.yaml
- name: Get dependencies (gen)
working-directory: native_workmanager_gen
run: dart pub get
- name: Verify formatting (plugin)
run: dart format --output=none --set-exit-if-changed lib test
- name: Verify formatting (gen)
working-directory: native_workmanager_gen
run: dart format --output=none --set-exit-if-changed lib
- name: Analyze plugin
run: flutter analyze --no-fatal-infos
- name: Analyze gen package
working-directory: native_workmanager_gen
run: dart analyze
- name: Pub publish dry-run (plugin)
run: dart pub publish --dry-run
- name: Pub publish dry-run (gen)
working-directory: native_workmanager_gen
run: dart pub publish --dry-run
# ── Dart unit tests ─────────────────────────────────────────────────────────
test:
name: Unit Tests
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
flutter-version-file: .flutter-version
channel: stable
cache: true
- name: Get dependencies
run: flutter pub get
- name: Run plugin unit tests with coverage
run: flutter test test/unit/ --coverage --reporter=expanded
- name: Upload coverage
uses: codecov/codecov-action@v4
with:
files: ./coverage/lcov.info
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false
# ── gen package tests ───────────────────────────────────────────────────────
test-gen:
name: Gen Package Tests
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
flutter-version-file: .flutter-version
channel: stable
cache: true
- name: Get dependencies (plugin — needed by gen)
run: flutter pub get
- name: Override gen dependency to local path
run: |
printf 'dependency_overrides:\n native_workmanager:\n path: ..\n meta: ">=1.17.0 <3.0.0"\n' > native_workmanager_gen/pubspec_overrides.yaml
- name: Get dependencies (gen)
working-directory: native_workmanager_gen
run: dart pub get
- name: Run gen tests
working-directory: native_workmanager_gen
run: |
if [ -d "test" ] && [ -n "$(ls test/*.dart 2>/dev/null)" ]; then
dart test
else
echo "No tests found in native_workmanager_gen — skipping."
fi
# ── Android build + unit tests ──────────────────────────────────────────────
build-android:
name: Build Android
runs-on: ubuntu-latest
timeout-minutes: 25
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
flutter-version-file: .flutter-version
channel: stable
cache: true
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '17'
cache: gradle
- name: Get dependencies
run: flutter pub get
- name: Build Android (debug)
working-directory: example
run: flutter build apk --debug --no-shrink
- name: Run Android unit tests
working-directory: example/android
run: ./gradlew testDebugUnitTest --stacktrace
# ── iOS build ───────────────────────────────────────────────────────────────
build-ios:
name: Build iOS (Simulator)
runs-on: macos-latest
timeout-minutes: 40
steps:
- uses: actions/checkout@v4
with:
lfs: true
- uses: subosito/flutter-action@v2
with:
flutter-version-file: .flutter-version
channel: stable
cache: true
- name: Get dependencies
run: flutter pub get
- name: Cache CocoaPods
uses: actions/cache@v4
with:
path: example/ios/Pods
key: pods-${{ hashFiles('example/ios/Podfile.lock') }}
restore-keys: pods-
- name: Install CocoaPods
working-directory: example/ios
run: pod install --repo-update
- name: Build iOS (simulator, no signing)
working-directory: example/ios
run: |
xcodebuild build \
-workspace Runner.xcworkspace \
-scheme Runner \
-sdk iphonesimulator \
-destination 'platform=iOS Simulator,name=iPhone 16,OS=latest' \
CODE_SIGNING_ALLOWED=NO \
| xcpretty
# ── Integration smoke test (iOS Simulator) ──────────────────────────────────
integration-ios-simulator:
name: Integration (iOS Simulator)
runs-on: macos-latest
timeout-minutes: 40
continue-on-error: true # flaky on GitHub-hosted runners; gate is all-checks
if: github.event_name != 'pull_request'
steps:
- uses: actions/checkout@v4
with:
lfs: true
- uses: subosito/flutter-action@v2
with:
flutter-version-file: .flutter-version
channel: stable
cache: true
- name: Get dependencies
run: flutter pub get
- name: Cache CocoaPods
uses: actions/cache@v4
with:
path: example/ios/Pods
key: pods-${{ hashFiles('example/ios/Podfile.lock') }}
restore-keys: pods-
- name: Install CocoaPods
working-directory: example/ios
run: pod install
# L-04 fix: robust simulator selection with fallback chain
- name: Resolve simulator UDID
id: sim
run: |
# Try iPhone 16 first, fall back to any available iPhone simulator
UDID=$(xcrun simctl list devices available | grep 'iPhone 16 ' | head -1 | grep -Eo '\([A-F0-9-]+\)' | tr -d '()')
if [ -z "$UDID" ]; then
UDID=$(xcrun simctl list devices available | grep 'iPhone' | grep -v 'Plus\|Pro\|Max' | head -1 | grep -Eo '\([A-F0-9-]+\)' | tr -d '()')
fi
if [ -z "$UDID" ]; then
echo "❌ No iPhone simulator found. Available devices:"
xcrun simctl list devices available
exit 1
fi
echo "Using simulator UDID: $UDID"
echo "udid=$UDID" >> "$GITHUB_OUTPUT"
- name: Boot simulator
run: xcrun simctl boot "${{ steps.sim.outputs.udid }}" || true
- name: Run integration tests (simulator subset)
working-directory: example
run: |
flutter test integration_test/device_integration_test.dart \
-d "${{ steps.sim.outputs.udid }}" \
--dart-define=SIMULATOR=true \
--timeout=120s
# ── Gate ───────────────────────────────────────────────────────────────────
all-checks:
name: All Checks Passed
runs-on: ubuntu-latest
needs: [analyze, test, test-gen, build-android, build-ios]
if: always()
steps:
- name: Verify all required jobs succeeded
run: |
results=(
"${{ needs.analyze.result }}"
"${{ needs.test.result }}"
"${{ needs.test-gen.result }}"
"${{ needs.build-android.result }}"
"${{ needs.build-ios.result }}"
)
for r in "${results[@]}"; do
if [[ "$r" != "success" ]]; then
echo "❌ One or more required jobs failed or were skipped."
exit 1
fi
done
echo "✅ All required checks passed."