簡素な雛形まとめ。
最新の改善版は https://github.com/sensuikan1973/dart-boilerplate にあります。
静的解析
../github/workflows/analyzer.yaml
name: Analyzer
on:
pull_request:
types: [opened, synchronize] # PR 作った時と、そこへの push で走らせる
push:
branches: [ master ] # master への push があったら必ず走らせる
jobs:
build:
runs-on: ubuntu-latest
container:
image: google/dart:latest # version 指定したければ https://hub.docker.com/r/google/dart/tags を参照
steps:
- uses: actions/checkout@v2
- name: install dependencies
run: pub get
- name: analyzer
run: dartanalyzer --fatal-warnings --fatal-infos .
フォーマッター
../github/workflows/format.yaml
name: Format
on:
pull_request:
types: [opened, synchronize]
push:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
container:
image: google/dart:latest
steps:
- uses: actions/checkout@v2
- name: dartfmt
run: dart format ./ -n -l 120 --set-exit-if-changed
テスト
../github/workflows/test.yaml
name: Unit Test
on:
pull_request:
types: [opened, synchronize]
push:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
container:
image: google/dart:latest
steps:
- uses: actions/checkout@v2
- name: install dependencies
run: pub get
- name: test
run: pub run test ./