-
Notifications
You must be signed in to change notification settings - Fork 1
151 lines (128 loc) · 4.22 KB
/
main.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
name: build
on:
pull_request:
branches:
- main
push:
branches:
- main
workflow_dispatch:
env:
FLUTTER_VERSION: 3.10.3
jobs:
android:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: 'Checkout Repo'
uses: actions/checkout@v2
with:
fetch-depth: 0 # to get all branches and tags
- name: 'Set Java version'
uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: '12'
cache: 'gradle'
- name: 'Cache Flutter'
id: flutter-cache
uses: actions/cache@v2
with:
key: ${{ runner.OS }}-flutter-install-cache-${{ env.FLUTTER_VERSION }}
path: /opt/hostedtoolcache/flutter
- name: 'Cache Flutter dependencies'
id: pub-cache
uses: actions/cache@v2
with:
key: ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.lock') }}
path: |
${{ env.FLUTTER_HOME }}/.pub-cache
**/.packages
**/.flutter-plugins
**/.flutter-plugin-dependencies
**/.dart_tool/package_config.json
- name: 'Set Flutter version'
if: steps.flutter-cache.cache.outputs.cache-hit != 'true'
uses: subosito/flutter-action@v1
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
- name: 'Install Dart dependencies'
if: steps.pub-cache.cache.outputs.cache-hit != 'true'
run: flutter pub get;
- name: 'Format'
run: dart format $(find . -name "*.dart" -not -wholename "*/generated/*") --set-exit-if-changed
- uses: invertase/github-action-dart-analyzer@v1
with:
fatal-infos: true
fatal-warnings: true
annotate: true
working-directory: ./lib
- name: 'Run unit tests'
run: flutter test --no-pub --coverage --test-randomize-ordering-seed random
- name: 'Build example'
run: |
cd ${{ github.workspace }}/example;
flutter build apk;
ios:
runs-on: macos-11
timeout-minutes: 25
steps:
- name: 'Checkout Repo'
uses: actions/checkout@v2
with:
fetch-depth: 0 # to get all branches and tags
- name: 'Cache Flutter'
id: flutter-cache
uses: actions/cache@v2
with:
key: ${{ runner.OS }}-flutter-install-cache-${{ env.FLUTTER_VERSION }}
path: /Users/runner/hostedtoolcache/flutter
- name: 'Cache Flutter dependencies'
id: pub-cache
uses: actions/cache@v2
with:
key: ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.lock') }}
path: |
${{ env.FLUTTER_HOME }}/.pub-cache
**/.packages
**/.flutter-plugins
**/.flutter-plugin-dependencies
**/.dart_tool/package_config.json
- name: 'Cache Ruby dependencies'
id: ruby-cache
uses: actions/cache@v2
with:
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile') }}
path: ${{ github.workspace }}/vendor/bundle
- name: 'Cache Pods'
id: pod-cache
uses: actions/cache@v2
with:
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}
path: ${{ github.workspace }}/example/ios/Pods
- name: 'Set Flutter version'
if: steps.flutter-cache.cache.outputs.cache-hit != 'true'
uses: subosito/flutter-action@v1
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
- name: 'Set Ruby version'
uses: ruby/setup-ruby@v1
with:
ruby-version: '2.7.2'
- name: 'Set Xcode version'
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '13.1'
- name: 'Install Dart dependencies'
if: steps.pub-cache.cache.outputs.cache-hit != 'true'
run: flutter pub get
- name: 'Install Ruby dependencies'
if: steps.ruby-cache.cache.outputs.cache-hit != 'true'
run: |
bundle config path ${{ github.workspace }}/vendor/bundle;
cd ${{ github.workspace }}/example/ios;
bundle install;
- name: 'Build example'
run: |
cd ${{ github.workspace }}/example;
flutter build ios --simulator;