-
Notifications
You must be signed in to change notification settings - Fork 6
231 lines (201 loc) · 7.21 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
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
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
name: Flutter CI
on: [push, pull_request]
jobs:
static-analysis:
name: Static analysis
runs-on: ubuntu-latest
steps:
- uses: subosito/flutter-action@v2
with:
channel: 'stable'
cache: true
- uses: actions/checkout@v3
with:
submodules: true
- 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: dart format --output none --set-exit-if-changed .
dart-test:
name: Dart test
runs-on: ubuntu-latest
steps:
- uses: dart-lang/setup-dart@v1
- uses: actions/checkout@v3
with:
submodules: true
- name: Install protoc
uses: arduino/setup-protoc@v2
with:
version: "23.x"
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Install pdfsig
run: sudo apt-get install -y poppler-utils
- name: Install native
run: |
cargo build --release
echo "LD_LIBRARY_PATH=$(pwd)/target/release/" >> "$GITHUB_ENV"
working-directory: meesign_native/native/meesign-crypto
- name: Setup server
run: |
wget https://raw.githubusercontent.com/crocs-muni/meesign-server/main/generate_keys.sh
bash generate_keys.sh
chmod a+r keys/*
podman pull crocsmuni/meesign:nightly
podman run --detach \
--publish 1337:1337 --volume $(pwd)/keys/:/meesign/keys/:Z \
crocsmuni/meesign:nightly
- name: Run tests
run: cd meesign_core; dart test
build:
name: ${{ matrix.target }} build
runs-on: ${{ matrix.os }}
strategy:
matrix:
# target: [Windows, Linux, macOS, Android]
target: [macOS]
include:
# - os: windows-latest
# target: Windows
# build_target: windows
# build_path: build\windows\x64\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: macos-latest
target: macOS
build_target: macos
build_path: build/macos/Build/Products/Release
asset_extension: .zip
asset_content_type: application/zip
# - 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@v3
with:
submodules: true
- name: Install protoc
uses: arduino/setup-protoc@v2
with:
version: "23.x"
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Clone Flutter repository with stable channel
uses: subosito/flutter-action@v2
with:
channel: stable
cache: true
- name: Install Android dependencies
if: matrix.target == 'Android'
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Set up Rust for Android
if: matrix.target == 'Android'
env:
ANDROID_NDK_HOME: /usr/local/lib/android/sdk/ndk/25.2.9519653
ANDROID_API: 33
# 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@v3
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
flutter config --enable-macos-desktop
# Fetch dart packages
- 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
- name: Build native libs for macOS
if: matrix.target == 'macOS'
env:
OPENSSL_STATIC: 1
run: |
cd meesign_native/native/meesign-crypto/
cargo build --release
cp target/release/libmeesign_crypto.dylib ../../../build/macos/Build/Products/Release/meesign_client.app/Contents/Frameworks/
# 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 }}
- name: Compress build for macOS
if: matrix.target == 'macOS'
run: ditto -c -k --sequesterRsrc --keepParent meesign_client.app $GITHUB_WORKSPACE/meesign_client_${{ matrix.target }}.zip
working-directory: ${{ matrix.build_path }}
# Upload the build.
- name: Upload build outputs
uses: actions/upload-artifact@v3
with:
name: meesign_client_${{ matrix.target }}${{ matrix.asset_extension }}
path: ./meesign_client_${{ matrix.target }}${{ matrix.asset_extension }}
retention-days: 10