This GitHub Action (written in JavaScript) allows you to leverage GitHub Actions to analyze your Dart project's Dart code, including Flutter. This runs both the dart analyze
and dartfmt
commands under the hood.
Create a workflow .yml
file in your .github/workflows
directory. An example workflow is available below. For more information, reference the GitHub Help Documentation for Creating a workflow file.
For more information on these inputs, see the Workflow syntax for GitHub Actions
fail-on-infos
: The action fails if any info was found. This will always fail on errors. Optional. Default:false
fail-on-warnings
: The action fails if any warning was found. This will always fail on errors. Optional. Default:false
working-directory
: The working directory. Optional. Default:./
line-length
: The maximum line length. Optional. The formatter will use its default:80
None.
- Your workflow must install Dart before using this action. Suggestion: Dart starter workflow.
- Use the action. For example:
on: push
name: Sample Workflow
jobs:
build:
name: Example
runs-on: ubuntu-latest
container:
image: google/dart:latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install dependencies
run: dart pub get
- name: Analyze Dart
uses: zgosalvez/github-actions-analyze-dart@v1
- Your workflow must install Flutter before using this action. Suggestion: Flutter action.
- Use the action. For example:
on: push
name: Sample Workflow
jobs:
build:
name: Example
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Flutter
uses: subosito/flutter-action@v1
- run: flutter pub get
- name: Analyze Dart
uses: zgosalvez/github-actions-analyze-dart@v2
After following the common workflow above, lint rules can be customized. For more details see:
pedantic
for rules enforced internally at Googleeffective_dart
for rules corresponding to the Effective Dart style guide
This is used in my opinionated GitHub Actions: Flutter Workflows repository along with other actions for a complete end-to-end DevOps experience.
The scripts and documentation in this project are released under the MIT License