Skip to content
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 70 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,14 @@ on:
pull_request:
branches: [ main ]

defaults:
run:
shell: bash

jobs:
test-app:
name: App
timeout-minutes: 40

runs-on: ubuntu-latest

Expand All @@ -36,27 +41,53 @@ jobs:
- name: Download pub dependencies
run: flutter pub get

# - name: Pub Global
# run: dart pub global activate flutter_gen
# - name: Pub Global
# run: dart pub global activate flutter_gen

# - name: Build runner
# run: flutter packages pub run build_runner build --delete-conflicting-outputs
# - name: Build runner
# run: flutter packages pub run build_runner build --delete-conflicting-outputs

# - name: Generate intl
# run: flutter pub run intl_utils:generate
# - name: Generate intl
# run: flutter pub run intl_utils:generate

# - name: Run fluttergen
# run: fluttergen -c pubspec.yaml
# - name: Run fluttergen
# run: fluttergen -c pubspec.yaml

- name: Run analyzer
run: flutter analyze

# - name: Run Dart code metrics
# run: flutter pub run dart_code_metrics:metrics analyze lib
# - name: Run Dart code metrics
# run: flutter pub run dart_code_metrics:metrics analyze lib

- name: Run tests
run: flutter test --coverage

# - name: Create Android emulator
# uses: reactivecircus/android-emulator-runner@v2
# with:
# api-level: 28
# target: google_apis
# arch: x86_64
# profile: Nexus 6
# script: |
# flutter test integration_test/app_test.dart --flavor dev --timeout none
#
# echo "Closing connection with emulator-5554"
# adb -s emulator-5554 emu kill || true
#
# echo "Closing connection with emulator-5556"
# adb -s emulator-5556 emu kill || true

- name: Install lcov
run: sudo apt-get install -y lcov

- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: integration-test-results
path: build/

- name: Install lcov
run: sudo apt-get install -y lcov

Expand All @@ -79,5 +110,32 @@ jobs:
- name: Run codacy-coverage-reporter
uses: codacy/codacy-coverage-reporter-action@v1
with:
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
coverage-reports: ./coverage/lcov.info
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
coverage-reports: ./coverage/lcov.info

integration_tests:
runs-on: macos-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
channel: stable

- name: Install dependencies
run: flutter pub get

- uses: futureware-tech/simulator-action@v4
with:
model: 'iPhone 16 Pro'

# Pre-building the app serves two purposes:
# 1. Verifies that the app builds successfully before running integration tests.
# 2. Speeds up the integration test startup, reducing the risk of test timeouts.
- name: Pre-build the app
run: flutter build ios --simulator --target=integration_test/app_test.dart --flavor dev

- name: Run integration tests
run: flutter test integration_test/app_test.dart --flavor dev --timeout 1h
6 changes: 1 addition & 5 deletions integration_test/app_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,11 @@ void main() {
app.main([]);
await tester.pumpAndSettle();

expect(find.text('Launches'), findsOneWidget);
expect(find.text('Emails'), findsOneWidget);
expect(find.text('Settings'), findsOneWidget);

expect(find.textContaining('Mission'), findsAtLeast(1));

await tester.fling(find.byType(ListView), const Offset(0, -300), 1000);
await tester.pumpAndSettle();

expect(find.textContaining('Mission'), findsAtLeast(1));
});
}, timeout: Timeout.none);
}
Loading