Skip to content

Test the project coverage and upload to codecov #153

Test the project coverage and upload to codecov

Test the project coverage and upload to codecov #153

Workflow file for this run

name: test-coverage
run-name: Test the project coverage and upload to codecov
permissions:
contents: write
packages: write
deployments: write
issues: write
pull-requests: write
repository-projects: write
security-events: write
statuses: write
on: push
jobs:
check_changes:
outputs:
run_build: ${{ steps.verify-changed-files.outputs.any_changed }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Verify Changed files
uses: tj-actions/changed-files@v37
id: verify-changed-files
with:
files: |
pubspec.yaml
pubspec.lock
l10n.yaml
lib
android
build:
runs-on: macos-latest
needs: check_changes
if: needs.check_changes.outputs.run_build == 'true'
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Gradle cache
uses: gradle/gradle-build-action@v2
- name: AVD cache
uses: actions/cache@v3
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-33
- name: create AVD and generate snapshot for caching
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 31
arch: x86_64
profile: pixel_6_pro
force-avd-creation: false
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: false
script: echo "Generated AVD snapshot for caching."
- uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: '11'
- uses: subosito/flutter-action@v2
with:
flutter-version: '3.10.6'
channel: 'stable'
cache: true
cache-key: 'flutter-:os:-:channel:-:version:' # optional, change this to force refresh cache
architecture: x64
- run: flutter pub get
- run: dart pub global activate full_coverage
- run: flutter analyze .
- run: flutter gen-l10n
- run: dart pub global run full_coverage
- run: flutter test --coverage --dart-define=USERNAME=${{ secrets.USERNAME }} --dart-define=PASSWORD=${{ secrets.PASSWORD }}
- name: run integration tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 31
arch: x86_64
profile: pixel_6_pro
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
script: flutter test integration_test/app_test.dart --coverage --dart-define=USERNAME=${{ secrets.USERNAME }} --dart-define=PASSWORD=${{ secrets.PASSWORD }} --dart-define=NAME="${{ secrets.NAME }}"
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3