-
Notifications
You must be signed in to change notification settings - Fork 52
146 lines (124 loc) · 4.4 KB
/
ci.yml
File metadata and controls
146 lines (124 loc) · 4.4 KB
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
on: [push, pull_request]
name: CI (Android, iOS)
jobs:
build:
name: Compile and Build (Android, iOS)
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Cache LLVM and Clang
id: cache-llvm
uses: actions/cache@v2
with:
path: ${{ runner.temp }}/llvm/10.0
key: ${{ runner.os }}-cached-llvm-10.0
- name: Install LLVM and Clang
uses: KyleMayes/install-llvm-action@v1
with:
version: '10.0'
directory: ${{ runner.temp }}/llvm/10.0
cached: ${{ steps.cache-llvm.outputs.cache-hit }}
- name: Checkout sources
uses: actions/checkout@v2
- name: Install Rust Toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: rustfmt
- name: Cache Cargo
uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
~/.cargo/bin
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install Cargo Make
uses: actions-rs/cargo@v1
continue-on-error: true
with:
command: install
args: cargo-make
- name: Setup Flutter
uses: subosito/flutter-action@v1
with:
channel: 'stable'
- name: Run Flutter pub get
run: flutter pub get
- name: Set up JDK 1.8 (Android only)
uses: actions/setup-java@v1
if: matrix.os == 'ubuntu-latest'
with:
java-version: 1.8
- name: Setup Android SDK (Android only)
if: matrix.os == 'ubuntu-latest'
uses: android-actions/setup-android@v2
- name: Cache NDK (Android only)
if: matrix.os == 'ubuntu-latest'
id: cache-ndk
uses: actions/cache@v2
with:
path: /home/runner/android/ndk-bundle
key: ${{ runner.os }}-ndk
- name: Install Android NDK (Android only)
if: steps.cache-ndk.outputs.cache-hit != 'true' && matrix.os == 'ubuntu-latest'
run: $ANDROID_SDK_ROOT/tools/bin/sdkmanager ndk-bundle
- name: Set Android NDK Env (Android only)
if: matrix.os == 'ubuntu-latest'
run: echo 'name=ANDROID_NDK_HOME::/home/runner/android/ndk-bundle' >> $GITHUB_ENV
- name: Install Android Targets (Android only)
if: matrix.os == 'ubuntu-latest'
run: rustup target add aarch64-linux-android armv7-linux-androideabi x86_64-linux-android i686-linux-android
- name: Run cargo make android
if: matrix.os == 'ubuntu-latest'
uses: actions-rs/cargo@v1
continue-on-error: false
with:
command: make
args: android
- name: Build APK (Fat, Debug)
if: matrix.os == 'ubuntu-latest'
run: flutter build apk --debug --no-sound-null-safety
- name: Install iOS Targets (iOS only)
if: matrix.os == 'macos-latest'
run: rustup target add aarch64-apple-ios x86_64-apple-ios
- name: Run cargo make ios
if: matrix.os == 'macos-latest'
uses: actions-rs/cargo@v1
continue-on-error: false
with:
command: make
args: ios
- name: Build iOS App (Simulator, Debug)
if: matrix.os == 'macos-latest'
run: flutter build ios --debug --no-codesign --simulator --no-sound-null-safety
- name: Create Release (Android)
id: create_release
if: matrix.os == 'ubuntu-latest'
uses: ChanTsune/release-with-commit@v2.1.0
with:
regexp: "Release (\\d+([.]\\d+)*)\n*((\\s|\\S)+)"
regexp_options: 'us'
release_name: 'version $1'
tag_name: 'v$1'
body: '$3'
draft: false
prerelease: false
env:
GITHUB_TOKEN: '${{secrets.GITHUB_TOKEN}}'
- name: Upload Release (Android)
id: upload-release-asset
if: matrix.os == 'ubuntu-latest' && steps.create_release.outputs.created == 'true'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./build/app/outputs/flutter-apk/app-debug.apk
asset_name: apk-debug.apk
asset_content_type: application/octet-stream