Skip to content

Commit df02596

Browse files
committed
add github actions workflow
1 parent 179ce8d commit df02596

File tree

1 file changed

+282
-0
lines changed

1 file changed

+282
-0
lines changed
Lines changed: 282 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,282 @@
1+
name: build
2+
3+
# Controls when the action will run. Triggers the workflow on push or pull request
4+
# events but only for the develop branch
5+
on:
6+
push:
7+
branches: [ develop, master ]
8+
pull_request:
9+
branches: [ develop ]
10+
11+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
12+
jobs:
13+
format:
14+
name: Format
15+
16+
# The type of runner that the job will run on
17+
runs-on: ubuntu-latest
18+
19+
# Steps represent a sequence of tasks that will be executed as part of the job
20+
steps:
21+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
22+
- uses: actions/checkout@v2
23+
24+
# Make sure the stable version of Flutter is available
25+
- uses: subosito/flutter-action@v1
26+
with:
27+
channel: 'stable'
28+
29+
# Download all Flutter packages
30+
- name: Download dependencies
31+
run: flutter pub get
32+
33+
# Run Flutter Format to ensure formatting is valid
34+
- name: Run Flutter Format
35+
run: flutter format --set-exit-if-changed .
36+
37+
analyze:
38+
name: Analyze
39+
40+
# The type of runner that the job will run on
41+
runs-on: ubuntu-latest
42+
43+
# Steps represent a sequence of tasks that will be executed as part of the job
44+
steps:
45+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
46+
- uses: actions/checkout@v2
47+
48+
# Make sure the stable version of Flutter is available
49+
- uses: subosito/flutter-action@v1
50+
with:
51+
channel: 'stable'
52+
53+
# Download all Flutter packages
54+
- name: Download dependencies
55+
run: flutter pub get
56+
57+
# Run Flutter Analyzer
58+
- name: Run Flutter Analyzer
59+
run: flutter analyze
60+
61+
build_android:
62+
name: Build Android App
63+
64+
# The type of runner that the job will run on
65+
runs-on: ubuntu-latest
66+
67+
env:
68+
example-directory: ./example
69+
70+
# Steps represent a sequence of tasks that will be executed as part of the job
71+
steps:
72+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
73+
- uses: actions/checkout@v2
74+
75+
# Ensure correct JAVA version is installed.
76+
- uses: actions/setup-java@v1
77+
with:
78+
java-version: '12.x'
79+
80+
# Make sure the stable version of Flutter is available
81+
- uses: subosito/flutter-action@v1
82+
with:
83+
channel: 'stable'
84+
85+
# Download all Flutter packages
86+
- name: Download dependencies
87+
run: flutter pub get
88+
89+
# Build Android version of the example App
90+
- name: Run Android build
91+
run: flutter build apk --release
92+
working-directory: ${{env.example-directory}}
93+
94+
build_ios:
95+
name: Build iOS App
96+
97+
# The type of runner that the job will run on
98+
runs-on: macos-latest
99+
100+
env:
101+
example-directory: ./example
102+
103+
# Steps represent a sequence of tasks that will be executed as part of the job
104+
steps:
105+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
106+
- uses: actions/checkout@v2
107+
108+
# Make sure the stable version of Flutter is available
109+
- uses: subosito/flutter-action@v1
110+
with:
111+
channel: 'stable'
112+
113+
# Download all Flutter packages
114+
- name: Download dependencies
115+
run: flutter pub get
116+
117+
# Build iOS version of the example App
118+
- name: Run iOS build
119+
run: flutter build ios --release --no-codesign
120+
working-directory: ${{env.example-directory}}
121+
122+
build_macOS:
123+
name: Build macOS App
124+
125+
# The type of runner that the job will run on
126+
runs-on: macos-latest
127+
128+
env:
129+
example-directory: ./example
130+
131+
# Steps represent a sequence of tasks that will be executed as part of the job
132+
steps:
133+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
134+
- uses: actions/checkout@v2
135+
136+
# Make sure the stable version of Flutter is available
137+
- uses: subosito/flutter-action@v1
138+
with:
139+
channel: 'stable'
140+
141+
# Enable platform support
142+
- name: Enable macOS
143+
run: flutter config --enable-macos-desktop
144+
145+
# Download all Flutter packages
146+
- name: Download dependencies
147+
run: flutter pub get
148+
149+
# Build macOS version of the example App
150+
- name: Run macOS build
151+
run: flutter build macos --release
152+
working-directory: ${{env.example-directory}}
153+
154+
build_windows:
155+
name: Build Windows App
156+
157+
# The type of runner that the job will run on
158+
runs-on: windows-latest
159+
160+
env:
161+
example-directory: ./example
162+
163+
# Steps represent a sequence of tasks that will be executed as part of the job
164+
steps:
165+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
166+
- uses: actions/checkout@v2
167+
168+
# Make sure the stable version of Flutter is available
169+
- uses: subosito/flutter-action@v1
170+
with:
171+
channel: 'stable'
172+
173+
# Enable platform support
174+
- name: Enable Windows
175+
run: flutter config --enable-windows-desktop
176+
177+
# Download all Flutter packages
178+
- name: Download dependencies
179+
run: flutter pub get
180+
181+
# Build iOS version of the example App
182+
- name: Run Windows build
183+
run: flutter build windows --release
184+
working-directory: ${{env.example-directory}}
185+
186+
build_linux:
187+
name: Build Linux App
188+
189+
# The type of runner that the job will run on
190+
runs-on: ubuntu-latest
191+
192+
env:
193+
example-directory: ./example
194+
195+
# Steps represent a sequence of tasks that will be executed as part of the job
196+
steps:
197+
# Install libraries for Linux
198+
- run: sudo apt-get update -y
199+
- run: sudo apt-get install -y ninja-build libgtk-3-dev libblkid-dev
200+
201+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
202+
- uses: actions/checkout@v2
203+
204+
# Make sure the stable version of Flutter is available
205+
- uses: subosito/flutter-action@v1
206+
with:
207+
channel: 'stable'
208+
209+
# Enable platform support
210+
- name: Enable Linux
211+
run: flutter config --enable-linux-desktop
212+
213+
# Enable platform support
214+
- name: Flutter Doctor
215+
run: flutter doctor
216+
217+
# Download all Flutter packages
218+
- name: Download dependencies
219+
run: flutter pub get
220+
221+
# Build iOS version of the example App
222+
- name: Run Linux build
223+
run: flutter build linux --release
224+
working-directory: ${{env.example-directory}}
225+
226+
build_web:
227+
name: Build Web App
228+
229+
# The type of runner that the job will run on
230+
runs-on: ubuntu-latest
231+
232+
env:
233+
example-directory: ./example
234+
235+
# Steps represent a sequence of tasks that will be executed as part of the job
236+
steps:
237+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
238+
- uses: actions/checkout@v2
239+
240+
# Make sure the stable version of Flutter is available
241+
- uses: subosito/flutter-action@v1
242+
with:
243+
channel: 'stable'
244+
245+
# Download all Flutter packages
246+
- name: Download dependencies
247+
run: flutter pub get
248+
249+
# Build Web version of the example App
250+
- name: Run Web build
251+
run: flutter build web --release
252+
working-directory: ${{env.example-directory}}
253+
254+
tests:
255+
name: Unit-tests
256+
# The type of runner that the job will run on
257+
runs-on: ubuntu-latest
258+
259+
# Steps represent a sequence of tasks that will be executed as part of the job
260+
steps:
261+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
262+
- uses: actions/checkout@v2
263+
264+
# Make sure the stable version of Flutter is available
265+
- uses: subosito/flutter-action@v1
266+
with:
267+
channel: 'stable'
268+
269+
# Download all Flutter packages
270+
- name: Download dependencies
271+
run: flutter pub get
272+
273+
# Run all unit-tests with code coverage
274+
- name: Run unit tests
275+
run: flutter test --coverage
276+
277+
# Upload code coverage information
278+
- uses: codecov/codecov-action@v1
279+
with:
280+
file: ./coverage/lcov.info # optional
281+
name: CacheManager # optional
282+
fail_ci_if_error: true

0 commit comments

Comments
 (0)