-
-
Notifications
You must be signed in to change notification settings - Fork 90
140 lines (132 loc) · 4.1 KB
/
build.yml
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
name: Build the package
on:
workflow_dispatch:
push:
branches:
- main
- dev
pull_request:
branches:
- main
- dev
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
# This is Dart 3.5.0
FLUTTER_MIN_SDK: '3.24.0'
jobs:
format:
name: "Check formatting"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
cache: true
- run: dart format --set-exit-if-changed .
- run: dart format --set-exit-if-changed example
lint:
name: "Check linting"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
cache: true
- run: flutter pub get
- run: dart run build_runner build --delete-conflicting-outputs
- run: flutter analyze
- run: flutter pub get
working-directory: example
- run: flutter analyze
working-directory: example
build-android:
name: "Build Android"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
sdk: [ min, stable, beta ]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: 'gradle'
- uses: subosito/flutter-action@v2
with:
cache: true
flutter-version: ${{ matrix.sdk == 'min' && env.FLUTTER_MIN_SDK || '' }}
channel: ${{ matrix.sdk == 'min' && 'stable' || matrix.sdk }}
- run: flutter pub get
- run: dart run build_runner build --delete-conflicting-outputs
- name: Build example APK
working-directory: example
run: flutter build apk
- name: Upload apk as artifact
uses: actions/upload-artifact@v4
if: ${{ matrix.sdk == 'stable' }}
with:
name: background-downloader-demo.apk
path: example/build/app/outputs/flutter-apk/app-release.apk
build-ios:
name: "Build iOS"
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
sdk: [ min, stable, beta ]
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
cache: true
flutter-version: ${{ matrix.sdk == 'min' && env.FLUTTER_MIN_SDK || '' }}
channel: ${{ matrix.sdk == 'min' && 'stable' || matrix.sdk }}
- uses: maxim-lobanov/setup-cocoapods@v1
with:
version: latest
- run: flutter pub get
- run: dart run build_runner build --delete-conflicting-outputs
- name: Build example iOS package
run: flutter build ios --simulator
working-directory: example
- name: Upload Runner.app as artifact
if: ${{ matrix.sdk == 'stable' }}
uses: actions/upload-artifact@v4
with:
name: background-downloader-demo.app
path: example/build/ios/iphonesimulator
build-linux:
name: "Build Linux"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
sdk: [ stable, beta ]
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
cache: true
flutter-version: ${{ matrix.sdk == 'min' && env.FLUTTER_MIN_SDK || '' }}
channel: ${{ matrix.sdk == 'min' && 'stable' || matrix.sdk }}
- name: Setup Linux build environment
run: |
flutter config --enable-linux-desktop
sudo apt-get install -y ninja-build
sudo apt-get install -y libgtk-3-dev
export CMAKE_CXX_COMPILER=$(which g++)
- run: flutter pub get
- run: dart run build_runner build --delete-conflicting-outputs
- name: Build example Linux package
run: flutter build linux
working-directory: example
- name: Upload example Linux package as artifact
if: ${{ matrix.sdk == 'stable' }}
uses: actions/upload-artifact@v4
with:
name: background-downloader-demo-linux
path: example/build/linux/x64/release/bundle