Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

💚 Fix CI coverage reporting #423

Merged
merged 10 commits into from
May 14, 2023
59 changes: 26 additions & 33 deletions .github/workflows/dart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,14 @@ jobs:
- job_001
- job_002
job_004:
name: "unit_test; PKGS: chopper, chopper_built_value; `dart test -p chrome`"
name: "unit_test; PKGS: chopper, chopper_built_value; `dart pub global run coverage:test_with_coverage`"
runs-on: ubuntu-latest
steps:
- name: Cache Pub hosted dependencies
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8
with:
path: "~/.pub-cache/hosted"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:chopper-chopper_built_value;commands:test_1"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:chopper-chopper_built_value;commands:test_with_coverage"
restore-keys: |
os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:chopper-chopper_built_value
os:ubuntu-latest;pub-cache-hosted;sdk:stable
Expand All @@ -144,6 +144,8 @@ jobs:
uses: dart-lang/setup-dart@d6a63dab3335f427404425de0fbfed4686d93c4f
with:
sdk: stable
- name: "Activate package:coverage"
run: "dart pub global activate coverage '>=1.5.0'"
- id: checkout
name: Checkout repository
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
Expand All @@ -152,32 +154,44 @@ jobs:
run: dart pub upgrade
if: "always() && steps.checkout.conclusion == 'success'"
working-directory: chopper
- name: "chopper; dart test -p chrome"
run: dart test -p chrome
- name: "chopper; dart pub global run coverage:test_with_coverage"
run: "dart pub global run coverage:test_with_coverage"
if: "always() && steps.chopper_pub_upgrade.conclusion == 'success'"
working-directory: chopper
- name: Upload coverage to codecov.io
uses: codecov/codecov-action@main
with:
files: chopper/coverage/lcov.info
fail_ci_if_error: true
name: coverage_00
- id: chopper_built_value_pub_upgrade
name: chopper_built_value; dart pub upgrade
run: dart pub upgrade
if: "always() && steps.checkout.conclusion == 'success'"
working-directory: chopper_built_value
- name: "chopper_built_value; dart test -p chrome"
run: dart test -p chrome
- name: "chopper_built_value; dart pub global run coverage:test_with_coverage"
run: "dart pub global run coverage:test_with_coverage"
if: "always() && steps.chopper_built_value_pub_upgrade.conclusion == 'success'"
working-directory: chopper_built_value
- name: Upload coverage to codecov.io
uses: codecov/codecov-action@main
with:
files: chopper_built_value/coverage/lcov.info
fail_ci_if_error: true
name: coverage_01
needs:
- job_001
- job_002
- job_003
job_005:
name: "unit_test; PKGS: chopper, chopper_built_value; `dart test`"
name: "unit_test; PKGS: chopper, chopper_built_value; `dart test -p chrome`"
runs-on: ubuntu-latest
steps:
- name: Cache Pub hosted dependencies
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8
with:
path: "~/.pub-cache/hosted"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:chopper-chopper_built_value;commands:test_0"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:chopper-chopper_built_value;commands:test"
restore-keys: |
os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:chopper-chopper_built_value
os:ubuntu-latest;pub-cache-hosted;sdk:stable
Expand All @@ -195,41 +209,20 @@ jobs:
run: dart pub upgrade
if: "always() && steps.checkout.conclusion == 'success'"
working-directory: chopper
- name: chopper; dart test
run: dart test
- name: "chopper; dart test -p chrome"
run: dart test -p chrome
if: "always() && steps.chopper_pub_upgrade.conclusion == 'success'"
working-directory: chopper
- id: chopper_built_value_pub_upgrade
name: chopper_built_value; dart pub upgrade
run: dart pub upgrade
if: "always() && steps.checkout.conclusion == 'success'"
working-directory: chopper_built_value
- name: chopper_built_value; dart test
run: dart test
- name: "chopper_built_value; dart test -p chrome"
run: dart test -p chrome
if: "always() && steps.chopper_built_value_pub_upgrade.conclusion == 'success'"
working-directory: chopper_built_value
needs:
- job_001
- job_002
- job_003
job_006:
name: Coverage
runs-on: ubuntu-latest
steps:
- uses: dart-lang/setup-dart@v1.3
with:
sdk: stable
- id: checkout
uses: actions/checkout@v3
- id: upload_coverage
name: chopper; tool/coverage.sh
run: bash tool/coverage.sh
if: "always() && steps.checkout.conclusion == 'success'"
env:
CODECOV_TOKEN: "${{ secrets.CODECOV_TOKEN }}"
needs:
- job_001
- job_002
- job_003
- job_004
- job_005
2 changes: 1 addition & 1 deletion chopper/mono_pkg.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ stages:
- format
- analyze: --fatal-infos .
- unit_test:
- test:
- test_with_coverage:
- test: -p chrome

cache:
Expand Down
2 changes: 1 addition & 1 deletion chopper_built_value/mono_pkg.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ stages:
- format
- analyze: --fatal-infos .
- unit_test:
- test:
- test_with_coverage:
- test: -p chrome

cache:
Expand Down
30 changes: 9 additions & 21 deletions mono_repo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,16 @@ github:
on:
push:
branches:
- master
- develop
- master
- develop
pull_request:
branches:
- master
- develop
on_completion:
- name: "Coverage"
runs-on: ubuntu-latest
steps:
- uses: dart-lang/setup-dart@v1.3
with:
sdk: stable
- id: checkout
uses: actions/checkout@v3
- id: upload_coverage
name: "chopper; tool/coverage.sh"
if: "always() && steps.checkout.conclusion == 'success'"
run: bash tool/coverage.sh
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- master
- develop

merge_stages:
- analyzer_and_format
- unit_test
- analyzer_and_format
- unit_test

coverage_service:
- codecov
10 changes: 5 additions & 5 deletions tool/ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,14 @@ for PKG in ${PKGS}; do
echo 'dart format --output=none --set-exit-if-changed .'
dart format --output=none --set-exit-if-changed . || EXIT_CODE=$?
;;
test_0)
echo 'dart test'
dart test || EXIT_CODE=$?
;;
test_1)
test)
echo 'dart test -p chrome'
dart test -p chrome || EXIT_CODE=$?
;;
test_with_coverage)
echo 'dart pub global run coverage:test_with_coverage'
dart pub global run coverage:test_with_coverage || EXIT_CODE=$?
;;
*)
echo -e "\033[31mUnknown TASK '${TASK}' - TERMINATING JOB\033[0m"
exit 64
Expand Down
11 changes: 0 additions & 11 deletions tool/coverage.sh

This file was deleted.