From 1066db940d427c6bb76b5364392f33622dab0ffb Mon Sep 17 00:00:00 2001 From: Bruno Mendes Date: Tue, 1 Aug 2023 20:28:58 +0100 Subject: [PATCH 1/4] Add code cov to test step --- .github/workflows/format_lint_test.yaml | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/.github/workflows/format_lint_test.yaml b/.github/workflows/format_lint_test.yaml index 1163a17aa..2a820260a 100644 --- a/.github/workflows/format_lint_test.yaml +++ b/.github/workflows/format_lint_test.yaml @@ -6,7 +6,7 @@ env: jobs: format: - name: 'Format' + name: "Format" runs-on: ubuntu-latest defaults: run: @@ -20,7 +20,7 @@ jobs: - run: dart format $(find . -type f -name "*.dart" -a -not -name "*.g.dart") --set-exit-if-changed lint: - name: 'Lint' + name: "Lint" runs-on: ubuntu-latest needs: format defaults: @@ -31,7 +31,7 @@ jobs: - uses: actions/setup-java@v3 with: java-version: ${{ env.JAVA_VERSION }} - distribution: 'zulu' + distribution: "zulu" - uses: subosito/flutter-action@v2 with: flutter-version: ${{ env.FLUTTER_VERSION }} @@ -46,7 +46,7 @@ jobs: - run: flutter analyze . test: - name: 'Test' + name: "Test" runs-on: ubuntu-latest needs: lint defaults: @@ -57,9 +57,17 @@ jobs: - uses: actions/setup-java@v3 with: java-version: ${{ env.JAVA_VERSION }} - distribution: 'zulu' + distribution: "zulu" - uses: subosito/flutter-action@v2 with: flutter-version: ${{ env.FLUTTER_VERSION }} - - run: flutter test --no-sound-null-safety + - name: Test with coverage + run: flutter test --coverage --coverage=./coverage + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v1 + with: + token: ${{ secrets.CODECOV_TOKEN }} + fail_ci_if_error: true + files: ./coverage/lcov.info From 5e3295d9d09d4293924c09273822c31b4dceb50f Mon Sep 17 00:00:00 2001 From: Bruno Mendes Date: Tue, 1 Aug 2023 20:54:07 +0100 Subject: [PATCH 2/4] Add ignore yaml --- .github/workflows/format_lint_test.yaml | 3 +-- codecov.yml | 2 ++ uni/analysis_options.yaml | 4 +--- 3 files changed, 4 insertions(+), 5 deletions(-) create mode 100644 codecov.yml diff --git a/.github/workflows/format_lint_test.yaml b/.github/workflows/format_lint_test.yaml index 2a820260a..d53b0f003 100644 --- a/.github/workflows/format_lint_test.yaml +++ b/.github/workflows/format_lint_test.yaml @@ -63,11 +63,10 @@ jobs: flutter-version: ${{ env.FLUTTER_VERSION }} - name: Test with coverage - run: flutter test --coverage --coverage=./coverage + run: flutter test --coverage - name: Upload coverage to Codecov uses: codecov/codecov-action@v1 with: token: ${{ secrets.CODECOV_TOKEN }} fail_ci_if_error: true - files: ./coverage/lcov.info diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 000000000..ae5cf3b2b --- /dev/null +++ b/codecov.yml @@ -0,0 +1,2 @@ +ignore: + - "**/*.g.dart" diff --git a/uni/analysis_options.yaml b/uni/analysis_options.yaml index be33d4712..92d895f92 100644 --- a/uni/analysis_options.yaml +++ b/uni/analysis_options.yaml @@ -3,8 +3,7 @@ include: package:very_good_analysis/analysis_options.yaml analyzer: # Exclude auto-generated files from dart analysis exclude: - - '**.g.dart' - - '**.freezed.dart' + - "**.g.dart" # Custom linter rules. A list of all rules can be found at # https://dart-lang.github.io/linter/lints/options/options.html @@ -13,4 +12,3 @@ linter: public_member_api_docs: false avoid_equals_and_hash_code_on_mutable_classes: false one_member_abstracts: false - From 27cd1bb6b416d8ccf32f36bddb8f8c30cfd4d700 Mon Sep 17 00:00:00 2001 From: Bruno Mendes Date: Tue, 1 Aug 2023 21:56:38 +0100 Subject: [PATCH 3/4] Add coverage badge --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 68355e652..25c1236cd 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,7 @@ [![Build badge](https://img.shields.io/github/actions/workflow/status/NIAEFEUP/uni/format_lint_test.yaml?style=for-the-badge)](https://github.com/NIAEFEUP/uni/actions) [![Deploy badge](https://img.shields.io/github/actions/workflow/status/NIAEFEUP/uni/deploy.yaml?label=Deploy&style=for-the-badge)](https://github.com/NIAEFEUP/uni/actions) +[![Codecov branch](https://img.shields.io/codecov/c/github/NIAEFEUP/uni/develop?style=for-the-badge)](https://app.codecov.io/gh/NIAEFEUP/uni/) [![style: very good analysis](https://img.shields.io/badge/style-very_good_analysis-B22C89.svg?style=for-the-badge)](https://pub.dev/packages/very_good_analysis) [![License badge](https://img.shields.io/github/license/NIAEFEUP/uni?style=for-the-badge)](https://github.com/NIAEFEUP/uni/blob/develop/LICENSE) From 8f659ff4191aad9039739094e9c5465a7596d111 Mon Sep 17 00:00:00 2001 From: Bruno Mendes Date: Tue, 1 Aug 2023 22:43:16 +0100 Subject: [PATCH 4/4] Setup PR coverage comments --- codecov.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/codecov.yml b/codecov.yml index ae5cf3b2b..25d8f819f 100644 --- a/codecov.yml +++ b/codecov.yml @@ -1,2 +1,8 @@ ignore: - "**/*.g.dart" +comment: + layout: "diff, flags, files" + behavior: default + require_changes: false + require_base: false + require_head: true