Test the project coverage and upload to codecov #284
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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@v4 | |
with: | |
fetch-depth: 0 | |
- name: Verify Changed files | |
uses: tj-actions/changed-files@v42 | |
id: verify-changed-files | |
with: | |
files: | | |
.github/workflows/test-coverage.yml | |
pubspec.yaml | |
pubspec.lock | |
l10n.yaml | |
lib/** | |
android/** | |
test/** | |
integration_test/** | |
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 | |
- uses: actions/setup-java@v2 | |
with: | |
distribution: 'zulu' | |
java-version: '11' | |
- uses: subosito/flutter-action@v2 | |
with: | |
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 | |
- name: run integration tests | |
uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
api-level: 31 | |
arch: x86_64 | |
profile: pixel_6_pro | |
avd-name: Pixel_6_Pro_API_31 | |
force-avd-creation: false | |
ram-size: 4096M | |
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 |