Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
uses: ./.github/workflows/flutter_package.yml
with:
flutter_channel: stable
flutter_version: 3.35.0
flutter_version: "3.41.x"
setup: flutter doctor --verbose
working_directory: examples/flutter_package

Expand Down
65 changes: 44 additions & 21 deletions .github/workflows/dart_package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ on:
required: false
type: string
default: "lib test"
collect_coverage_from:
required: false
type: string
default: "imports"
description: "Whether to collect coverage from imported files only or all files. Allowed values: imports, all."
concurrency:
required: false
type: number
Expand All @@ -15,6 +20,7 @@ on:
required: false
type: string
default: ""
description: "Space-separated list of globs to exclude files from the coverage report (e.g. '**/*.g.dart **/gen/*.dart')."
dart_sdk:
required: false
type: string
Expand All @@ -30,6 +36,10 @@ on:
required: false
type: number
default: 100
no_example:
required: false
type: boolean
default: false
platform:
required: false
type: string
Expand All @@ -38,10 +48,19 @@ on:
required: false
type: boolean
default: false
description: "Whether to check for and respect coverage ignore comments (e.g. // coverage:ignore-line)."
report_on:
required: false
type: string
default: "lib"
run_bloc_lint:
required: false
type: boolean
default: true
run_skipped:
required: false
type: boolean
default: false
runs_on:
required: false
type: string
Expand All @@ -50,22 +69,20 @@ on:
required: false
type: string
default: ""
working_directory:
required: false
type: string
default: "."
run_skipped:
show_uncovered:
required: false
type: boolean
default: false
no_example:
default: true
description: "Whether to show uncovered lines when coverage is below 100%."
test_optimization:
required: false
type: boolean
default: false
run_bloc_lint:
type: boolean
default: true
description: "Whether to apply optimizations for test performance."
working_directory:
required: false
type: string
default: "."
secrets:
ssh_key:
required: false
Expand Down Expand Up @@ -96,7 +113,9 @@ jobs:
ssh-private-key: ${{secrets.ssh_key}}

- name: 📦 Install Dependencies
run: dart pub get ${{(inputs.no_example && '--no-example') || ''}}
run: |
dart pub global activate very_good_cli
dart pub get ${{(inputs.no_example && '--no-example') || ''}}

- name: ⚙️ Run Setup
if: "${{inputs.setup != ''}}"
Expand All @@ -115,13 +134,17 @@ jobs:
bloc lint .

- name: 🧪 Run Tests
run: |
dart pub global activate coverage 1.15.0
dart test -j ${{inputs.concurrency}} --coverage=coverage --platform=${{inputs.platform}} ${{(inputs.run_skipped && '--run-skipped') || ''}} && dart pub global run coverage:format_coverage --lcov ${{(inputs.check_ignore && '--check-ignore') || ''}} --in=coverage --out=coverage/lcov.info --packages=.dart_tool/package_config.json --report-on=${{inputs.report_on}}

- name: 📊 Check Code Coverage
uses: VeryGoodOpenSource/very_good_coverage@v3
with:
path: ${{inputs.working_directory}}/coverage/lcov.info
exclude: ${{inputs.coverage_excludes}}
min_coverage: ${{inputs.min_coverage}}
run: >-
very_good dart test
-j ${{inputs.concurrency}}
--coverage
--platform ${{inputs.platform}}
--min-coverage ${{inputs.min_coverage}}
${{inputs.coverage_excludes != '' && format('--exclude-coverage "{0}"', inputs.coverage_excludes) || ''}}
${{format('--report-on {0}', inputs.report_on)}}
${{inputs.collect_coverage_from != 'imports' && format('--collect-coverage-from {0}', inputs.collect_coverage_from) || ''}}
${{inputs.check_ignore && '--check-ignore' || '--no-check-ignore'}}
${{inputs.show_uncovered && '--show-uncovered' || ''}}
${{inputs.run_skipped && '--run-skipped' || ''}}
${{(inputs.test_optimization && '--optimization') || '--no-optimization'}}
--test-randomize-ordering-seed random
64 changes: 47 additions & 17 deletions .github/workflows/flutter_package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ on:
required: false
type: string
default: "lib test"
collect_coverage_from:
required: false
type: string
default: "imports"
description: "Whether to collect coverage from imported files only or all files. Allowed values: imports, all."
concurrency:
required: false
type: number
Expand All @@ -15,6 +20,7 @@ on:
required: false
type: string
default: ""
description: "Space-separated list of globs to exclude files from the coverage report (e.g. '**/*.g.dart **/gen/*.dart')."
flutter_channel:
required: false
type: string
Expand All @@ -34,6 +40,27 @@ on:
required: false
type: number
default: 100
package_get_excludes:
required: false
type: string
default: "!*"
platform:
required: false
type: string
default: ""
description: "The platform to run tests on (e.g., 'chrome', 'android', 'ios')."
report_on:
required: false
type: string
default: "lib"
run_bloc_lint:
required: false
type: boolean
default: true
run_skipped:
required: false
type: boolean
default: false
runs_on:
required: false
type: string
Expand All @@ -42,6 +69,11 @@ on:
required: false
type: string
default: ""
show_uncovered:
required: false
type: boolean
default: true
description: "Whether to show uncovered lines when coverage is below 100%."
test_optimization:
required: false
type: boolean
Expand All @@ -54,14 +86,6 @@ on:
required: false
type: string
default: "."
package_get_excludes:
required: false
type: string
default: "!*"
run_bloc_lint:
type: boolean
default: true
required: false
secrets:
ssh_key:
required: false
Expand Down Expand Up @@ -96,7 +120,7 @@ jobs:

- name: 📦 Install Dependencies
run: |
flutter pub global activate very_good_cli
dart pub global activate very_good_cli
very_good packages get --recursive --ignore=${{inputs.package_get_excludes}}

- name: ⚙️ Run Setup
Expand All @@ -116,11 +140,17 @@ jobs:
bloc lint .

- name: 🧪 Run Tests
run: very_good test -j ${{inputs.concurrency}} ${{(inputs.test_recursion && '--recursive') || ''}} ${{(inputs.test_optimization && '--optimization') || '--no-optimization'}} --coverage --test-randomize-ordering-seed random

- name: 📊 Check Code Coverage
uses: VeryGoodOpenSource/very_good_coverage@v3
with:
path: ${{inputs.working_directory}}/coverage/lcov.info
exclude: ${{inputs.coverage_excludes}}
min_coverage: ${{inputs.min_coverage}}
run: >-
very_good test
-j ${{inputs.concurrency}}
${{(inputs.test_recursion && '--recursive') || ''}}
${{(inputs.test_optimization && '--optimization') || '--no-optimization'}}
--coverage
--min-coverage ${{inputs.min_coverage}}
${{inputs.coverage_excludes != '' && format('--exclude-coverage "{0}"', inputs.coverage_excludes) || ''}}
${{format('--report-on {0}', inputs.report_on)}}
${{inputs.collect_coverage_from != 'imports' && format('--collect-coverage-from {0}', inputs.collect_coverage_from) || ''}}
${{inputs.show_uncovered && '--show-uncovered' || ''}}
${{inputs.run_skipped && '--run-skipped' || ''}}
${{inputs.platform != '' && format('--platform {0}', inputs.platform) || ''}}
--test-randomize-ordering-seed random
3 changes: 3 additions & 0 deletions site/docs/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/dart_pub_publish.
# A reusable workflow for publishing Mason bricks
uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/mason_publish.yml@v1

# A reusable workflow to keep track of the rights and restrictions external dependencies might impose on Dart or Flutter projects
uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/license_check.yml@v1

```

[github_workflows_link]: https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions
Expand Down
43 changes: 36 additions & 7 deletions site/docs/workflows/dart_package.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,14 @@ This workflow runs helpful checks on a Dart package according to the steps below

The Dart package workflow consists of the following steps:

1. Install dependencies
2. Format
3. Analyze
4. Run tests
5. Check code coverage
1. Setup Dart
2. Set SSH Key (if provided)
3. Install dependencies
4. Run Setup (if provided)
5. Format
6. Analyze
7. Bloc Lint (if enabled)
8. Run tests (includes coverage collection and enforcement)

## Inputs

Expand All @@ -26,7 +29,7 @@ The Dart package workflow consists of the following steps:

### `coverage_excludes`

**Optional** List of paths to exclude from the coverage report, separated by an empty space. Supports `globs` to describe file patterns.
**Optional** Space-separated list of globs to exclude files from the coverage report (e.g. '**/\*.g.dart **/gen/\*.dart').

**Default** `""`

Expand Down Expand Up @@ -66,7 +69,7 @@ The Dart package workflow consists of the following steps:

### `check_ignore`

**Optional** Allows ignoring lines from [coverage](https://pub.dev/packages/coverage).
**Optional** Whether to check for and respect coverage ignore comments (e.g. `// coverage:ignore-line`).

**Default** `false`

Expand Down Expand Up @@ -107,6 +110,32 @@ The Dart package workflow consists of the following steps:

**Default** `false`

### `show_uncovered`

**Optional** Whether to show uncovered lines when coverage is below 100%. Implicitly enables coverage collection when used alone.

**Default** `true`

### `collect_coverage_from`

**Optional** Whether to collect coverage from imported files only or all files. Counting untested files against coverage (`all`) results in stricter enforcement.

**Allowed values** `imports`, `all`

**Default** `"imports"`

### `test_optimization`

**Optional** Whether to apply optimizations for test performance.

**Default** `true`

### `run_bloc_lint`

**Optional** Whether to run [bloc lint](https://pub.dev/packages/bloc_tools) on the package.

**Default** `true`

## Secrets

### `ssh_key`
Expand Down
53 changes: 47 additions & 6 deletions site/docs/workflows/flutter_package.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,14 @@ This workflow runs helpful checks on a Flutter package according to the steps be

The Flutter package workflow consists of the following steps:

1. Install dependencies
2. Format
3. Analyze
4. Run tests
5. Check code coverage
1. Setup Flutter
2. Set SSH Key (if provided)
3. Install dependencies
4. Run Setup (if provided)
5. Format
6. Analyze
7. Bloc Lint (if enabled)
8. Run tests (includes coverage collection and enforcement)

## Inputs

Expand All @@ -38,7 +41,7 @@ The Flutter package workflow consists of the following steps:

### `coverage_excludes`

**Optional** A space-separated list of paths to exclude from the coverage report. Supports `globs` to describe file patterns.
**Optional** Space-separated list of globs to exclude files from the coverage report (e.g. '**/\*.g.dart **/gen/\*.dart').

**Default** `""`

Expand Down Expand Up @@ -102,6 +105,44 @@ The Flutter package workflow consists of the following steps:

**Default** `"!*"`

### `platform`

**Optional** The platform to run tests on (e.g., `chrome`, `android`, `ios`).

**Default** `""`

### `report_on`

**Optional** A comma-separated list of folders that should be checked in code coverage.

**Default** `"lib"`

### `run_bloc_lint`

**Optional** Whether to run [bloc lint](https://pub.dev/packages/bloc_tools) on the package.

**Default** `true`

### `run_skipped`

**Optional** Run skipped tests instead of skipping them.

**Default** `false`

### `show_uncovered`

**Optional** Whether to show uncovered lines when coverage is below 100%. Implicitly enables coverage collection when used alone.

**Default** `true`

### `collect_coverage_from`

**Optional** Whether to collect coverage from imported files only or all files. Counting untested files against coverage (`all`) results in stricter enforcement.

**Allowed values** `imports`, `all`

**Default** `"imports"`

## Secrets

### `ssh_key`
Expand Down
Loading