-
Notifications
You must be signed in to change notification settings - Fork 1
199 lines (180 loc) · 6.65 KB
/
flutter.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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
name: flutter
on:
pull_request:
push:
branches:
- master
tags:
- "*.*"
env:
GRADLE_OPTS: -Dorg.gradle.daemon=false
jobs:
build:
strategy:
fail-fast: false
matrix:
os: [macOS-latest, ubuntu-latest, windows-latest]
include:
- os: macOS-latest
platform: ios
app_artifact_path: "flutter/build/ios/iphoneos/Runner.app"
- os: windows-latest
platform: android
app_artifact_path: "flutter/build/app/outputs/apk/debug/app-debug.apk"
- os: ubuntu-latest
platform: android
app_artifact_path: "flutter/build/app/outputs/apk/debug/app-debug.apk"
upload_coverage: true
runs-on: ${{ matrix.os }}
steps:
- name: "Support >260 characters long paths in Git repositories (Windows)"
run: git config --global core.longpaths true
- uses: actions/checkout@v2
with:
submodules: recursive
- run: git fetch --tags
working-directory: flutter/.flutter
- uses: actions/setup-ruby@v1
with:
ruby-version: 2.6
- name: "Install fastlane"
run: |
gem install bundler --no-doc
bundle install --clean --deployment
- name: "Override Android SDK path to one that is writeable"
if: runner.os == 'Linux'
run: |
echo ANDROID_SDK_ROOT=/tmp/android >> $GITHUB_ENV
echo ANDROID_HOME=/tmp/android >> $GITHUB_ENV
- name: "Install dependencies"
working-directory: flutter
run: |
bundle exec fastlane install_dependencies
bundle exec fastlane install_ci_keys
- name: "Generate and lint"
working-directory: flutter
run: |
bundle exec fastlane generate
bundle exec fastlane lint
- name: "Run unit tests"
working-directory: flutter
run: bundle exec fastlane run flutter args:test,--coverage
- name: "Upload coverage"
if: matrix.upload_coverage
uses: codecov/codecov-action@v1
- name: "Workaround for fastlane & Dart generating files with LF"
if: runner.os == 'Windows'
run: git add .
- name: "Check that all files were properly formatted and generated"
run: bundle exec fastlane run ensure_git_status_clean show_diff:true
- uses: actions/setup-java@v1
if: matrix.platform == 'android'
with:
java-version: 1.8
- name: "Install and configure CocoaPods"
if: matrix.platform == 'ios'
run: |
bundle exec pod repo update
bundle binstubs cocoapods --force --path "${HOME?}/bin"
echo "${HOME?}/bin" >> $GITHUB_PATH
- run: bundle exec fastlane ${{ matrix.platform }} build
working-directory: flutter
- name: "Update Podfile.lock in case iOS build failed"
if: failure() && matrix.platform == 'ios'
working-directory: flutter/ios
run: pod update
- name: "Check that no source files were modified during build"
run: bundle exec fastlane run ensure_git_status_clean show_diff:true
- name: "Upload application artifacts"
uses: actions/upload-artifact@v1
if: always()
with:
name: "flutter app (${{ matrix.os }})"
path: ${{ matrix.app_artifact_path }}
- name: "Clean up generated files before packing a snapshot of changes"
if: failure() && runner.os != 'Windows'
run: git clean -f -x -d && rm -rf flutter/.flutter
- name: >
Upload snapshot of source code.
To copy over: 'cd project/flutter && unzip -o ~/Downloads/flutter.zip'
if: failure() && runner.os != 'Windows'
uses: actions/upload-artifact@v1
with:
name: flutter
path: flutter
publish:
if: >
startsWith(github.repository, 'futureware-tech/') &&
github.event_name == 'push'
needs: build
strategy:
fail-fast: false
matrix:
os: [macOS-latest, ubuntu-latest]
include:
- os: macOS-latest
platform: ios
- os: ubuntu-latest
platform: android
env:
SUPPLY_JSON_KEY: /tmp/gcloud-service-account.json
GOOGLE_APPLICATION_CREDENTIALS: /tmp/gcloud-service-account.json
ANDROID_KEYSTORE_PATH: /tmp/upload.keystore
APP_STORE_CONNECT_API_KEY_PATH: /tmp/app_store_connect_api_key.json
# See similar constuction above. GitHub Actions Linux image comes with an
# older SDK and its installation directory is not world-writeable.
ANDROID_SDK_ROOT: /tmp/android
ANDROID_HOME: /tmp/android
CLOUDSDK_CORE_DISABLE_PROMPTS: 1
MATCH_GIT_URL: ${{ secrets.MATCH_GIT_URL }}
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
with:
# Need history for build number etc.
fetch-depth: 0
submodules: recursive
- run: git fetch --tags
working-directory: flutter/.flutter
- uses: actions/setup-ruby@v1
with:
ruby-version: 2.6
- name: "Install fastlane"
run: |
gem install bundler --no-doc
bundle install --clean --deployment
- name: "Install dependencies"
working-directory: flutter
run: bundle exec fastlane install_dependencies
- if: matrix.platform == 'android'
uses: actions/setup-java@v1
with:
java-version: 1.8
- if: matrix.platform == 'android'
run: |
echo '${{ secrets.ANDROID_KEYSTORE_DATA }}' |
base64 -d > "${ANDROID_KEYSTORE_PATH?}"
curl -sL https://sentry.io/get-cli/ | bash
# The credentials are going to be used for both gcloud and Play Store.
- run: >
echo '${{ secrets.GOOGLE_APPLICATION_CREDENTIALS_DATA }}' |
base64 -d > "${GOOGLE_APPLICATION_CREDENTIALS?}"
- run: >
echo '${{ secrets.APP_STORE_CONNECT_API_KEY_DATA }}' |
base64 -d > "${APP_STORE_CONNECT_API_KEY_PATH?}"
- if: matrix.platform == 'ios'
uses: google-github-actions/setup-gcloud@master
- name: "Configure GCloud to fetch 'fastlane match' repo"
if: matrix.platform == 'ios'
run: >
gcloud auth activate-service-account
--key-file "${GOOGLE_APPLICATION_CREDENTIALS?}"
git config --global
credential.https://source.developers.google.com.helper
gcloud.sh
- working-directory: flutter
run: >
bundle exec fastlane ${{ matrix.platform }} publish
release:$(sed -n -e 's|^refs/tags/||p' <<<$GITHUB_REF)