LoginSignup
2

More than 1 year has passed since last update.

Dart の快適 GitHub Actions まとめ

Last updated at Posted at 2020-04-15

簡素な雛形まとめ。
最新の改善版は 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 ./

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2