-
Notifications
You must be signed in to change notification settings - Fork 2
157 lines (150 loc) · 7.37 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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
---
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/[email protected]
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/[email protected]
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/overview#widget-tests
flutter_widget_test:
needs: [flutter_format, flutter_analyze]
runs-on: ${{ matrix.runner_machine }}
timeout-minutes: 15
strategy:
fail-fast: false
matrix: # https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs
os: [windows, macos-intel-silicon, macos-latest, ubuntu]
include:
- os: windows
runner_machine: windows-latest
setup_for_flutter_desktop_script: .github/scripts/windows/install_additional_requirements_for_flutter.sh
- os: macos-intel-silicon
# 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/about-github-hosted-runners#standard-github-hosted-runners-for-public-repositories
runner_machine: macos-13
setup_for_flutter_desktop_script: .github/scripts/macos/install_additional_requirements_for_flutter.sh
- os: macos-latest
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#standard-github-hosted-runners-for-public-repositories
runner_machine: macos-14
setup_for_flutter_desktop_script: .github/scripts/macos/install_additional_requirements_for_flutter.sh
- os: ubuntu
runner_machine: ubuntu-latest
setup_for_flutter_desktop_script: .github/scripts/linux/install_additional_requirements_for_flutter.sh
steps:
- uses: actions/checkout@v4
- uses: subosito/[email protected]
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
- name: widget test
run: flutter test --verbose --coverage --coverage-path=./coverage/lcov.widget_test.info --concurrency=1
- uses: codecov/codecov-action@v5 # https://docs.codecov.com/docs/merging-reports#multiple-languages
with: # ref: https://github.com/codecov/codecov-action/blob/v4.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
flutter_integration_test:
needs: [flutter_format, flutter_analyze]
runs-on: ${{ matrix.runner_machine }}
timeout-minutes: 15
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-intel-silicon, macos-latest, ubuntu]
include:
- os: windows
runner_machine: windows-latest
setup_for_flutter_desktop_script: .github/scripts/windows/install_additional_requirements_for_flutter.sh
# workaround for https://github.com/sensuikan1973/pedax/pull/1746#issuecomment-1975666851
integration_test_command: flutter test integration_test --device-id windows --verbose --coverage --coverage-path=./coverage/lcov.integration_test.info
- os: macos-intel-silicon
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#standard-github-hosted-runners-for-public-repositories
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: macos-latest
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#standard-github-hosted-runners-for-public-repositories
runner_machine: macos-latest
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
# https://github.com/flutter/flutter/issues/90676#issuecomment-1229973541
# https://stackoverflow.com/a/72072757
integration_test_command: |
mkdir -p ./coverage
timeout 240 xvfb-run -a \
flutter test integration_test --device-id linux --verbose --coverage --coverage-path=./coverage/lcov.integration_test.info
steps:
- uses: actions/checkout@v4
- uses: subosito/[email protected]
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
- name: integration test
run: ${{ matrix.integration_test_command }}
# https://docs.codecov.com/docs/merging-reports#multiple-languages
- uses: codecov/codecov-action@v5
with: # ref: https://github.com/codecov/codecov-action/blob/v4.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 }}