Skip to content

Commit

Permalink
Enable code coverage for all platforms (#247)
Browse files Browse the repository at this point in the history
* Enable iOS unit tests

* Add ios test target for circleci

* Remove flutter branch for ios unit tests and use latest

* Upgrade xCode version for running circleci unit tests

* Add flutter pub get and pod install before running ios testS

* switch to branch 1.22.0 of flutter

* Add flutter precache command

* Try with latest flutter

* Enable iOS code coverage

* Add codecov.yml to push comments

* Generate coverage for flutter

* Make coverage collection it's own step

* Fix config error

* Make project code coverage at 70 and diff coverage at 80%

* Add android test coverage

* Add coverage config to all plugins

* Change xml report names for android coverage to get properly uploaded by codecov

* Remove generated companion kotlin classes from exclusion for codecov

* Change project coverage to 65% for now

* Change android to Android in comment
  • Loading branch information
Amplifiyer authored Dec 14, 2020
1 parent 78b2143 commit 876db16
Show file tree
Hide file tree
Showing 14 changed files with 1,955 additions and 38 deletions.
9 changes: 9 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ jobs:
- run:
name: Run Flutter Unit Tests
command: melos run test:unit:flutter
- run:
name: Upload flutter test coverage
command: melos run upload:coverage:flutter
- run:
name: Save test results
command: |
Expand All @@ -90,6 +93,9 @@ jobs:
- run:
name: Run iOS Unit Tests
command: melos run test:unit:ios
- run:
name: Upload ios test coverage
command: melos run upload:coverage:ios
- run:
name: Save test results
command: |
Expand All @@ -114,6 +120,9 @@ jobs:
- run:
name: Run Android Unit Tests
command: melos run test:unit:android
- run:
name: Upload android test coverage
command: melos run upload:coverage:android
- run:
name: Save test results
command: |
Expand Down
10 changes: 8 additions & 2 deletions .circleci/test_all_plugins.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ for plugin_dir in */; do
echo "=== Running Flutter unit tests for $plugin ==="
if [ -d "test" ]; then
mkdir -p test-results
if flutter test --machine | tojunit --output "test-results/$plugin-flutter-test.xml"; then
if flutter test --machine --coverage | tojunit --output "test-results/$plugin-flutter-test.xml"; then
echo "PASSED: Flutter unit tests for $plugin passed."
passed_plugins+=("$plugin")
else
Expand Down Expand Up @@ -51,7 +51,13 @@ for plugin_dir in */; do

if ./gradlew :"$plugin":testDebugUnitTest; then
echo "PASSED: Android unit tests for $plugin passed."
passed_plugins+=("$plugin")
if ./gradlew :"$plugin":testDebugUnitTestCoverage; then
echo "PASSED: Generating android unit tests coverage for $plugin passed."
passed_plugins+=("$plugin")
else
echo "FAILED: Generating android unit tests coverage for $plugin failed."
failed_plugins+=("$plugin")
fi
else
echo "FAILED: Android unit tests for $plugin failed."
failed_plugins+=("$plugin")
Expand Down
21 changes: 21 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
codecov:
notify:
after_n_builds: 1

coverage:
status:
project:
default:
target: 65%
if_not_found: success
patch:
default:
target: 80%
if_not_found: success

comment:
layout: "diff, flags, files"
behavior: default
require_changes: false # if true: only post the comment if coverage changes
require_base: no # [yes :: must have a base report to post]
require_head: yes # [yes :: must have a head report to post]
Loading

0 comments on commit 876db16

Please sign in to comment.