だいたい毎回追加する Workflow の紹介。
実例は以下の repository にあります。
- https://github.com/sensuikan1973/pedax
- https://github.com/sensuikan1973/dart-boilerplate
- https://github.com/sensuikan1973/libedax4dart
Flutter で毎回入れる CI
format + analyzer + widget test
See: https://github.com/sensuikan1973/pedax/blob/main/.github/workflows/flutter_ci.yaml
on:
pull_request:
paths:
- '**.dart'
- 'pubspec.*'
- 'analysis_options.yaml'
- '.github/workflows/flutter_ci.yaml'
- '.codecov.yml'
push:
branches: [main]
paths:
- '**.dart'
- 'pubspec.*'
- 'analysis_options.yaml'
- '.github/workflows/flutter_ci.yaml'
- '.codecov.yml'
jobs:
format:
runs-on: ubuntu-20.04
timeout-minutes: 5
steps:
- uses: actions/checkout@v2
- uses: subosito/flutter-action@v1
- run: flutter format -l 120 --set-exit-if-changed .
analyze:
runs-on: ubuntu-20.04
timeout-minutes: 5
steps:
- uses: actions/checkout@v2
- uses: subosito/flutter-action@v1
- name: install dependencies
run: flutter pub get
- run: flutter analyze --fatal-infos --fatal-warnings .
widget_test:
runs-on: ubuntu-20.04
timeout-minutes: 10
steps:
- uses: actions/checkout@v2
- uses: subosito/flutter-action@v1
- name: doctor
run: flutter doctor -v
- name: install dependencies
run: flutter pub get
- name: run test
run: flutter test --coverage --coverage-path=./coverage/lcov.info
- uses: codecov/codecov-action@v2.1.0
with:
file: ./coverage/lcov.info
Desktop アプリケーションのビルド
See: https://github.com/sensuikan1973/pedax/blob/main/.github/workflows/flutter_build.yaml
Desktop アプリケーションの Integration Test
See: https://github.com/sensuikan1973/pedax/blob/main/.github/workflows/flutter_integration_test.yaml
Desktop アプリケーションのリリース
See: https://qiita.com/sensuikan1973/items/5f19a75d3ee37e0deb14
See: https://github.com/sensuikan1973/pedax/blob/main/.github/workflows/publish.yaml
Web アプリケーションのデプロイ
web application を deploy する時のやつ
on:
push:
branches: [main]
jobs:
flutter_build_web:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v2
- uses: subosito/flutter-action@v1
with:
channel: 'beta'
- name: setup
run: flutter config --enable-web
- name: install dependencies
run: flutter pub get
- run: flutter build web
- uses: actions/upload-artifact@master
with:
name: foo_app
path: build/web
firebase_hosting_deploy: # 例えば Firebase Hosting に deploy する
needs: flutter_build_web
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: start deployment
uses: bobheadxi/deployments@master
id: deployment
with:
step: start
token: ${{ secrets.GITHUB_TOKEN }}
env: dev
- uses: actions/checkout@v2
- uses: actions/download-artifact@master
with:
name: build
path: build/web
- uses: w9jds/firebase-action@master
with:
args: deploy --only hosting -P aiueo
env:
FIREBASE_TOKEN: ${{ secrets.FIREBASE_DEV_TOKEN }}
- name: update deployment status
uses: bobheadxi/deployments@master
with:
step: finish
token: ${{ secrets.GITHUB_TOKEN }}
status: ${{ job.status }}
deployment_id: ${{ steps.deployment.outputs.deployment_id }}
env_url: https://foo.web.app/
依存関係の定期更新
See: https://qiita.com/sensuikan1973/items/899c0f06c5cf0874546b
See: https://github.com/sensuikan1973/pedax/blob/main/.github/workflows/flutter_deps.yaml
API ドキュメントの公開
See: https://qiita.com/sensuikan1973/items/03663d759a50231c3282