-
Notifications
You must be signed in to change notification settings - Fork 2
114 lines (107 loc) · 4.8 KB
/
flutter_ci.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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
---
name: Flutter CI
on:
pull_request:
push:
branches: [main]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
# https://docs.flutter.dev/development/tools/formatting
flutter_format:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2.11.0
with:
cache: true
- name: setup flutter channel
shell: bash
run: ./scripts/setup_flutter.sh
- run: dart format . --line-length 120 --set-exit-if-changed
# https://docs.flutter.dev/reference/flutter-cli#flutter-commands
# https://flutter.dev/docs/development/tools/flutter-fix#applying-project-wide-fixes
flutter_analyze:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2.11.0
with:
cache: true
- name: setup flutter channel
shell: bash
run: ./scripts/setup_flutter.sh
- name: install dependencies
run: flutter pub get
- run: flutter analyze --fatal-infos --fatal-warnings .
# https://docs.flutter.dev/testing
flutter_tests:
needs: [flutter_format, flutter_analyze]
runs-on: ${{ matrix.runner_machine }}
timeout-minutes: 20
strategy:
fail-fast: false # for https://github.com/sensuikan1973/pedax/issues/1221
matrix: # https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs
os: [windows, macos, ubuntu] # pedax uses ffi package(libedax4dart), so run widget test on multiple OS.
include:
- os: windows
runner_machine: windows-latest
setup_for_flutter_desktop_script: .github/scripts/windows/install_additional_requirements_for_flutter.sh
integration_test_command: flutter test integration_test --device-id windows --verbose --coverage --coverage-path=./coverage/lcov.integration_test.info
- os: macos
# Why isn't this macos-latest ? -> workaround for https://github.com/sensuikan1973/pedax/pull/1443
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners
runner_machine: macos-13
setup_for_flutter_desktop_script: .github/scripts/macos/install_additional_requirements_for_flutter.sh
integration_test_command: flutter test integration_test --device-id macos --verbose --coverage --coverage-path=./coverage/lcov.integration_test.info
- os: ubuntu
runner_machine: ubuntu-latest
setup_for_flutter_desktop_script: .github/scripts/linux/install_additional_requirements_for_flutter.sh
integration_test_command: |
touch ./coverage/lcov.integration_test.info
timeout 240 xvfb-run -a \
flutter test integration_test --device-id linux --verbose --coverage --coverage-path=./coverage/lcov.integration_test.info \
|| ( [[ $? -eq 124 ]] && echo "WARNING: timeout" )
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2.11.0
with:
cache: true
- name: setup flutter channel
shell: bash
run: ./scripts/setup_flutter.sh
- name: setup flutter desktop
shell: bash
run: ${{ matrix.setup_for_flutter_desktop_script }}
- name: doctor
run: flutter doctor -v
- name: install dependencies
run: flutter pub get
# https://docs.flutter.dev/testing#widget-tests
- name: widget test
run: flutter test --verbose --coverage --coverage-path=./coverage/lcov.widget_test.info
# https://docs.codecov.com/docs/merging-reports#multiple-languages
- uses: codecov/codecov-action@v3
with: # ref: https://github.com/codecov/codecov-action/blob/v3.1.0/.github/workflows/main.yml
files: ./coverage/lcov.widget_test.info
flags: widget_test,${{ matrix.os }}
fail_ci_if_error: true
# See: https://github.com/codecov/codecov-action/issues/837
# https://app.codecov.io/gh/sensuikan1973/pedax/settings
token: ${{ secrets.CODECOV_TOKEN }}
# https://docs.flutter.dev/testing#integration-tests
- name: integration test
run: ${{ matrix.integration_test_command }}
# https://docs.codecov.com/docs/merging-reports#multiple-languages
- uses: codecov/codecov-action@v3
with: # ref: https://github.com/codecov/codecov-action/blob/v3.1.0/.github/workflows/main.yml
files: ./coverage/lcov.integration_test.info
flags: integration_test,${{ matrix.os }}
fail_ci_if_error: true
# See: https://github.com/codecov/codecov-action/issues/837
# https://app.codecov.io/gh/sensuikan1973/pedax/settings
token: ${{ secrets.CODECOV_TOKEN }}