|
| 1 | +--- |
| 2 | +title: Dart Package |
| 3 | +description: A reusable workflow for running checks on Dart packages. |
| 4 | +image: /images/meta/open-graph.png |
| 5 | +--- |
| 6 | + |
| 7 | +# Dart Package |
| 8 | + |
| 9 | +This workflow runs helpful checks on a Dart package according to the steps below. As with any workflow, it can be customized. |
| 10 | + |
| 11 | +## Steps |
| 12 | + |
| 13 | +The Dart package workflow consists of the following steps: |
| 14 | + |
| 15 | +1. Install dependencies |
| 16 | +2. Format |
| 17 | +3. Analyze |
| 18 | +4. Run tests |
| 19 | +5. Check code coverage |
| 20 | + |
| 21 | +## Inputs |
| 22 | + |
| 23 | +### `concurrency` |
| 24 | + |
| 25 | +**Optional** The number of concurrent test suites run. |
| 26 | + |
| 27 | +**Default** `4` |
| 28 | + |
| 29 | +### `coverage_excludes` |
| 30 | + |
| 31 | +**Optional** List of paths to exclude from the coverage report, separated by an empty space. Supports `globs` to describe file patterns. |
| 32 | + |
| 33 | +**Default** `""` |
| 34 | + |
| 35 | +### `dart_sdk` |
| 36 | + |
| 37 | +**Optional** Which Dart SDK version to use. It can be a version (e.g. `3.5.0`) or a channel (e.g. `stable`): |
| 38 | + |
| 39 | +**Default** `"stable"` |
| 40 | + |
| 41 | +### `format_line_length` |
| 42 | + |
| 43 | +**Optional** The preferred line length preferred for running the `dart format` command. Be aware that this does not change the behavior of the analysis step and longer lines could still make the workflow fail if the rule `lines_longer_than_80_chars` is used. |
| 44 | + |
| 45 | +### `min_coverage` |
| 46 | + |
| 47 | +**Optional** The minimum coverage percentage allowed. |
| 48 | + |
| 49 | +**Default** 100 |
| 50 | + |
| 51 | +### `working_directory` |
| 52 | + |
| 53 | +**Optional** The path to the root of the Dart package. |
| 54 | + |
| 55 | +**Default** `"."` |
| 56 | + |
| 57 | +### `analyze_directories` |
| 58 | + |
| 59 | +**Optional** A space-separated list of folders that should be analyzed. |
| 60 | + |
| 61 | +**Default** `"lib test"` |
| 62 | + |
| 63 | +### `format_directories` |
| 64 | + |
| 65 | +**Optional** A space-separated list of folders that should be formatted. |
| 66 | + |
| 67 | +**Default** `"."` |
| 68 | + |
| 69 | +### `check_ignore` |
| 70 | + |
| 71 | +**Optional** Allows ignoring lines from [coverage](https://pub.dev/packages/coverage). |
| 72 | + |
| 73 | +**Default** `false` |
| 74 | + |
| 75 | +### `report_on` |
| 76 | + |
| 77 | +**Optional** A comma-separated list of folders that should be checked in code coverage. |
| 78 | + |
| 79 | +**Default** `"lib"` |
| 80 | + |
| 81 | +### `runs_on` |
| 82 | + |
| 83 | +**Optional** The operating system on which to run the workflow. |
| 84 | + |
| 85 | +**Default** `"ubuntu-latest"` |
| 86 | + |
| 87 | +### `setup` |
| 88 | + |
| 89 | +**Optional** A command that should be executed immediately after dependencies are installed. |
| 90 | + |
| 91 | +**Default** `""` |
| 92 | + |
| 93 | +### `platform` |
| 94 | + |
| 95 | +**Optional** A comma-separated list of platforms on which to run the tests. |
| 96 | +`[vm (default), chrome, firefox, safari, node]` |
| 97 | + |
| 98 | +**Default** `"vm"` |
| 99 | + |
| 100 | +### `run_skipped` |
| 101 | + |
| 102 | +**Optional** Run skipped tests instead of skipping them. |
| 103 | + |
| 104 | +**Default** `false` |
| 105 | + |
| 106 | +### `no_example` |
| 107 | + |
| 108 | +**Optional** To avoid getting packages in `example/` when running `dart pub get` (if it exists). |
| 109 | + |
| 110 | +**Default** `false` |
| 111 | + |
| 112 | +## Secrets |
| 113 | + |
| 114 | +### `ssh_key` |
| 115 | + |
| 116 | +**Optional** An SSH key used to access private repositories when installing dependencies. |
| 117 | + |
| 118 | +## Example Usage |
| 119 | + |
| 120 | +```yaml |
| 121 | +name: My Dart Workflow |
| 122 | + |
| 123 | +on: pull_request |
| 124 | + |
| 125 | +jobs: |
| 126 | + build: |
| 127 | + uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/dart_package.yml@v1 |
| 128 | + with: |
| 129 | + coverage_excludes: '*.g.dart' |
| 130 | + dart_sdk: 'stable' |
| 131 | + platform: 'chrome,vm' |
| 132 | + working_directory: 'examples/my_dart_package' |
| 133 | + secrets: |
| 134 | + ssh_key: ${{secrets.EXAMPLE_KEY}} |
| 135 | +``` |
0 commit comments