Skip to content

Split example app

Split example app #101

Workflow file for this run

name: CI
on:
push:
branches: [main]
pull_request:
env:
FLUTTER_MINIMUM_VERSION: 3.27.0
JAVA_VERSION: 17
JAVA_DISTRIBUTION: corretto
IPHONE_NAME: iPhone 16 Pro
IPHONE_OS_VERSION: 18.4
jobs:
flutter-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
channel: 'stable'
- name: Install dependencies
run: flutter pub get
- name: Analyze project source
run: dart analyze . --fatal-infos
- name: Import sort
run: dart run import_sorter:main . --no-comments --exit-if-changed
- name: Format code
run: dart format . --set-exit-if-changed
- name: Run tests
run: flutter test ./test/* --coverage
- name: Upload coverage report as artifact
uses: actions/upload-artifact@v4
with:
name: flutter-coverage
path: coverage/lcov.info
flutter-minimum-version-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_MINIMUM_VERSION }}
channel: 'stable'
- name: Install dependencies
run: flutter pub get
- name: Analyze project source
run: dart analyze . --fatal-infos
- name: Run tests
run: flutter test ./test/*
ios-tests:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
channel: 'stable'
- name: Install dependencies
run: |
brew install xcresultparser
flutter config --enable-swift-package-manager
flutter pub get
cd example/full-permission/ios
flutter build ios --config-only
cd ../..
- name: Run tests
run: |
xcodebuild test -workspace ./example/ios/Runner.xcworkspace \
-scheme EventideTests \
-destination "platform=iOS Simulator,name=${{ env.IPHONE_NAME }},OS=${{ env.IPHONE_OS_VERSION }}" \
-resultBundlePath build/reports/EventideTests.xcresult \
-quiet
- name: Prepare coverage xml file
run: |
xcresultparser \
--output-format cobertura \
build/reports/EventideTests.xcresult > build/reports/ios-coverage.xml
- name: Upload coverage report as artifact
uses: actions/upload-artifact@v4
with:
name: ios-coverage
path: build/reports/ios-coverage.xml
android-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: ${{ env.JAVA_DISTRIBUTION }}
java-version: ${{ env.JAVA_VERSION }}
cache: 'gradle'
- uses: subosito/flutter-action@v2
with:
channel: 'stable'
- name: Install dependencies
run: flutter pub get
- name: Build and test
run: |
./example/full-permission/android/gradlew testDebugUnitTest -p ./example/full-permission/android/
- name: Upload coverage report as artifact
uses: actions/upload-artifact@v4
with:
name: android-coverage
path: android/build/reports/jacocoTestReport.xml
upload-coverage:
runs-on: ubuntu-latest
needs: [flutter-tests, ios-tests, android-tests]
if: always() && !cancelled() && (needs.flutter-tests.result == 'success' || needs.ios-tests.result == 'success' || needs.android-tests.result == 'success')
steps:
- name: Download flutter coverage report
uses: actions/download-artifact@v4
if: needs.flutter-tests.result == 'success'
with:
name: flutter-coverage
path: coverage
- name: Download ios coverage report
uses: actions/download-artifact@v4
if: needs.ios-tests.result == 'success'
with:
name: ios-coverage
path: build/reports
- name: Download android coverage report
uses: actions/download-artifact@v4
if: needs.android-tests.result == 'success'
with:
name: android-coverage
path: android/build/reports/
- name: Prepare coverage files list
id: coverage-files
run: |
files=""
if [ -f "coverage/lcov.info" ]; then
files="$files,coverage/lcov.info"
echo "Found Flutter coverage file"
fi
if [ -f "build/reports/ios-coverage.xml" ]; then
files="$files,build/reports/ios-coverage.xml"
echo "Found iOS coverage file"
fi
if [ -f "android/build/reports/jacocoTestReport.xml" ]; then
files="$files,android/build/reports/jacocoTestReport.xml"
echo "Found Android coverage file"
fi
files=${files#,}
echo "Coverage files: $files"
echo "files=$files" >> $GITHUB_OUTPUT
- name: Upload combined coverage report to Codecov
uses: codecov/codecov-action@v5
if: steps.coverage-files.outputs.files != ''
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false
files: ${{ steps.coverage-files.outputs.files }}
flags: unittests
name: codecov-umbrella