-
Notifications
You must be signed in to change notification settings - Fork 4
83 lines (79 loc) · 3.06 KB
/
flutter_test.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
name: flutter_test
on:
pull_request:
types: [opened, synchronize]
push:
branches:
- main
jobs:
flutter_test:
runs-on: ubuntu-latest
# timeout-minutesのデフォルト値は6時間
# タイムアウトを設定しないと処理が終わらないまま放置され、莫大な請求額になるため短めに設定する
timeout-minutes: 10
steps:
# ソースコードをチェックアウト
- name: Checkout
uses: actions/checkout@v3
# fvm のバージョンとチャネルを環境変数に設定する
- name: Check fvm
uses: kuhnroyal/flutter-fvm-config-action@v1
# Flutter SDK の設定
- name: Setup Flutter SDK
uses: subosito/flutter-action@v2
with:
# バージョンとチャネルは fvm の値を使う
flutter-version: ${{ env.FLUTTER_VERSION }}
channel: ${{ env.FLUTTER_CHANNEL }}
# 次回以降起動を速くするためにキャッシュしておく
cache: true
cache-key: flutter
cache-path: ${{ runner.tool_cache }}/flutter
# /opt/hostedtoolcache/flutter
# melosの設定
# デフォルトでmelos bootstrapコマンドが実行される
- name: Setup melos
uses: bluefireteam/melos-action@v1
with:
run-bootstrap: false
# melos bootstrap
- name: melos bootstrap
run: melos bootstrap --sdk-path=${{ runner.tool_cache }}/flutter
# 依存関係を解決
- name: Install Flutter dependencies by melos
run: melos pg --sdk-path=${{ runner.tool_cache }}/flutter
# テストを実行
- name: Run Flutter Test by melos
run: melos exec --sdk-path=${{ runner.tool_cache }}/flutter -- "flutter test --machine --coverage > test-report.log"
# file path 確認用コマンド
- name: pwd
run: pwd
# fileが存在するか確認
- name: ls -a
run: ls -a
# # flutter pub get を実行
# - name: Install Flutter dependencies
# run: flutter pub get
# # テストを実行
# # あとでテスト結果を GitHub Actions 上に表示するので log に出力する
# # あとでカバレッジ結果をCodecovに送信するのでカバレッジありで実行する
# - name: Run Flutter Test
# run: flutter test --machine --coverage > test-report.log
# テスト結果を GitHub Actions に表示する
- name: Report Test
uses: dorny/test-reporter@v1
# テスト結果を表示するのでテストが失敗しても実行する
if: always()
with:
name: Flutter Test Report
path: /home/runner/work/mottai-flutter-app/mottai-flutter-app/test-report.log
reporter: flutter-json
# Codecov に結果を送信
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
with:
token: ${{secrets.CODECOV_TOKEN}}
file: coverage/lcov.info
fail_ci_if_error: true
flags: unittests
verbose: true