-
Notifications
You must be signed in to change notification settings - Fork 4
158 lines (139 loc) · 5.04 KB
/
flutter-ci.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
name: Flutter CI
on: [push, pull_request]
jobs:
static-analysis:
name: Static analysis
runs-on: ubuntu-latest
steps:
- uses: subosito/flutter-action@v1
with:
channel: 'stable'
- uses: actions/checkout@v2
- run: |
for PKG in native network core; do
(cd meesign_$PKG; dart pub get)
done
flutter pub get
- run: flutter analyze --no-fatal-infos
- run: flutter format --output none --set-exit-if-changed .
create-build:
name: Create ${{ matrix.target }} build
runs-on: ${{ matrix.os }}
strategy:
matrix:
target: [Windows, Linux, Android]
include:
- os: windows-2022
target: Windows
build_target: windows
build_path: build\windows\runner\Release
asset_extension: .zip
asset_content_type: application/zip
toolchain_file: C:\vcpkg\scripts\buildsystems\vcpkg.cmake
- os: ubuntu-latest
target: Linux
build_target: linux
build_path: build/linux/x64/release/bundle
asset_extension: .tar.gz
asset_content_type: application/gzip
- os: ubuntu-latest
target: Android
build_target: apk
build_path: build/app/outputs/flutter-apk
asset_extension: .apk
asset_content_type: application/vnd.android.package-archive
# Disable fail-fast as we want results from all even if one fails.
fail-fast: false
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Clone Flutter repository with stable channel
uses: subosito/flutter-action@4389e6cbc6cb8a4b18c628ff96ff90be0e926aa8
with:
channel: stable
- name: Install Android dependencies
if: matrix.target == 'Android'
uses: actions/setup-java@v1
with:
java-version: '12.x'
- name: Set up Rust for Android
if: matrix.target == 'Android'
env:
ANDROID_NDK_HOME: /usr/local/lib/android/sdk/ndk/21.4.7075529
ANDROID_API: 30
# add rust android targets,
# point cargo to local Android NDK installation
run: |
rustup target add \
aarch64-linux-android \
armv7-linux-androideabi \
x86_64-linux-android \
i686-linux-android
bash ./tool/cargo-config-gen-android.sh >> ~/.cargo/config.toml
cat ~/.cargo/config.toml
- name: Install Linux dependencies
if: matrix.target == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y \
libgtk-3-dev libx11-dev libblkid-dev \
pkg-config cmake ninja-build
- name: Cache Vcpkg packages
uses: actions/cache@v2
if: matrix.target == 'Windows'
with:
path: C:\vcpkg
key: vcpkg-root
- name: Install Windows dependencies
if: matrix.target == 'Windows'
env:
VCPKG_DEFAULT_TRIPLET: x64-windows-static-md
run: |
vcpkg install openssl
- name: Enable desktop support
if: matrix.target != 'Android'
run: |
flutter config --enable-linux-desktop
flutter config --enable-windows-desktop
# Check setup, fetch dart packages
- run: flutter doctor -v
- run: flutter pub get
- name: Build app
env:
CMAKE_TOOLCHAIN_FILE: ${{ matrix.toolchain_file }}
# env vars used by rust openssl
VCPKG_ROOT: C:\vcpkg
# needed to fetch Android deps (podofo + freetype AARs)
USERNAME: ${{ github.actor }}
TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: >
flutter build -v ${{ matrix.build_target }}
--release
--dart-define=ALLOW_BAD_CERTS=true
# Package the build.
- name: Copy VC redistributables to release directory for Windows
if: matrix.target == 'Windows'
run: |
Copy-Item (vswhere -latest -find 'VC\Redist\MSVC\*\x64\*\msvcp140.dll') .
Copy-Item (vswhere -latest -find 'VC\Redist\MSVC\*\x64\*\vcruntime140.dll') .
Copy-Item (vswhere -latest -find 'VC\Redist\MSVC\*\x64\*\vcruntime140_1.dll') .
working-directory: ${{ matrix.build_path }}
- name: Rename build for Android
if: matrix.target == 'Android'
run: mv app-release.apk $GITHUB_WORKSPACE/meesign_client_${{ matrix.target }}.apk
working-directory: ${{ matrix.build_path }}
- name: Compress build for Linux
if: matrix.target == 'Linux'
run: tar czf $GITHUB_WORKSPACE/meesign_client_${{ matrix.target }}.tar.gz *
working-directory: ${{ matrix.build_path }}
- name: Compress build for Windows
if: matrix.target == 'Windows'
run: compress-archive -Path * -DestinationPath ${env:GITHUB_WORKSPACE}\meesign_client_${{ matrix.target }}.zip
working-directory: ${{ matrix.build_path }}
# Upload the build.
- name: Upload build outputs
uses: actions/upload-artifact@v2
with:
name: meesign_client_${{ matrix.target }}${{ matrix.asset_extension }}
path: ./meesign_client_${{ matrix.target }}${{ matrix.asset_extension }}
retention-days: 10