-
Notifications
You must be signed in to change notification settings - Fork 11
388 lines (328 loc) · 12.3 KB
/
Copy pathci.yml
File metadata and controls
388 lines (328 loc) · 12.3 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
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
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
name: CI
on:
push:
paths-ignore:
- '**/README.md'
pull_request:
branches: [master]
env:
cargo_cache_path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
ouisync/target/
jobs:
test_linux:
name: test on linux
runs-on: self-hosted
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Create container name
run: echo "CONTAINER=ouisync-unit-test-linux-$GITHUB_RUN_ID" >> $GITHUB_ENV
- name: Start container
run: ./docker/linux.sh --container $CONTAINER --srcdir . --cache container start
- name: Analyze
run: ./docker/linux.sh --container $CONTAINER analyze
- name: Run tests
run: ./docker/linux.sh --container $CONTAINER unit-test
- name: Stop container
run: ./docker/linux.sh --container $CONTAINER container stop
if: always()
test_windows:
name: test on windows
runs-on: windows-latest
env:
# Install Dokan2.dll to where `flutter test` can find it
DOKAN_DLL_OUTPUT_PATH: C:\Windows\System32
OUISYNC_LIB: ouisync\target\debug\ouisync_service.dll
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup cargo cache
id: cargo-cache
uses: actions/cache@v4
with:
path: ${{ env.cargo_cache_path }}
key: ${{ runner.os }}-cargo-test-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-
# FIXME: when dokan is installed some tests fail with weird panic from the dokan-rust library.
# Disabling for now. See also the comment in the 'Run tests' step.
# - name: Install dependencies (windows)
# run: choco install dokany2
- uses: subosito/flutter-action@v2
with:
channel: 'stable'
flutter-version-file: pubspec.yaml
cache: true
- name: Run Flutter doctor
run: flutter doctor -v
- name: Get Flutter packages
run: dart pub get
- name: Generate the Dart bindings for the Ouisync library
working-directory: ouisync/bindings/dart
run: dart tool/bindgen.dart
- name: Analyze
run: |
pushd lib
flutter analyze
popd
pushd test
flutter analyze
popd
pushd util
flutter analyze
popd
- name: Test util
run: |
dart util/test.dart
# HACK: dokan-sys puts Dokan2.dll to C:\Windows\System but not if it's cached (the crate
# doesn't rebuild itself when the dll is missing likely due to missing
# `cargo:rerun-if-changed` directive in its build.rs). Clean the cached version to force
# rebuild.
# TODO: We should patch dokan-sys to rebuild itself when the dll is missing.
- name: "[HACK] Force dokan-sys to build"
run: cargo clean --package dokan-sys
working-directory: ouisync
- name: Build Ouisync service library for tests
working-directory: ouisync
run: cargo build --package ouisync-service --lib
- name: Run tests
# FIXME: The mount test fails on windows CI with a panic somewhere in the dokan-rust
# crate. Disabling for now but it needs to be looked into.
run: flutter test --exclude-tags mount
- name: Upload test/debug artifacts
uses: actions/upload-artifact@v4
with:
# Name of the produced zip file
name: test-artifacts-${{ runner.os }}
path: test/widget/artifacts/*
if-no-files-found: ignore
# Upload when tests fail
if: failure()
build:
name: build on ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
name: [android, linux, windows]
include:
- name: android
os: ubuntu-24.04
target: aarch64-linux-android armv7-linux-androideabi x86_64-linux-android
ndk:
abi: arm64-v8a
build-args: --apk
artifact-files: ouisync*.apk
# For GLIBC and GLIBCXX compatibility we build on not-the-most-recent Ubuntu version
- name: linux
os: ubuntu-22.04
build-args: --deb-gui --deb-cli
artifact-files: ouisync*.deb
- name: windows
os: windows-latest
build-args: --exe
artifact-files: ouisync*.exe
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup cargo cache
id: cargo-cache
uses: actions/cache@v4
with:
path: ${{ env.cargo_cache_path }}
key: ${{ runner.os }}${{ matrix.name == 'android' && '-android' || '' }}-cargo-release-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-
- name: Setup gradle cache
id: gradle-cache
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
if: matrix.name == 'android'
- name: Add rust target
run: rustup target add ${{ matrix.target }}
if: matrix.target != ''
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
if: matrix.name == 'android'
- name: Install dependencies (linux)
run: |
# https://github.com/orgs/community/discussions/109146
sudo apt update -y
sudo apt-get install libappindicator3-dev \
libcurl4-openssl-dev \
libfuse-dev \
libgtk-3-dev \
libsecret-1-dev \
ninja-build \
imagemagick
if: matrix.name == 'linux'
- name: Set NDK ABI filter
run: echo "ndk.abiFilters=${{ matrix.ndk.abi }}" >> android/local.properties
if: matrix.ndk.abi != ''
- uses: subosito/flutter-action@v2
with:
channel: 'stable'
flutter-version-file: pubspec.yaml
cache: true
- name: Install Inno Setup (Windows exe installation builder)
run: |
Invoke-WebRequest https://files.jrsoftware.org/is/6/innosetup-6.4.3.exe -OutFile C:/TEMP/innosetup.exe
C:/TEMP/innosetup.exe /SP- /VERYSILENT /ALLUSERS /SUPPRESSMSGBOXES
shell: pwsh
if: matrix.name == 'windows'
- name: Get Flutter packages
run: dart pub get
- name: Generate the Dart bindings for the Ouisync library
working-directory: ouisync/bindings/dart
run: dart tool/bindgen.dart
- name: Setup Sentry DSN for artifact build (different from the production releases)
run: |
mkdir -p secrets/
echo $NIGHTLY_SENTRY_DSN > secrets/sentry_dsn
shell: bash
env:
NIGHTLY_SENTRY_DSN : ${{ secrets.NIGHTLY_SENTRY_DSN }}
if: env.NIGHTLY_SENTRY_DSN != null
- name: Setup secrets for artifact signing (different from the production releases)
run: |
dir=secrets/android
mkdir -p $dir
echo $NIGHTLY_KEYSTORE_JKS_HEX > $dir/keystore.jks.hex
# Use `keytool` to generate the `keystore.jks` keystore.
# The keystore.jks.hex file can then be generated by
#
# $ xxd -p keystore.jks keystore.jks.hex
#
xxd -r -p $dir/keystore.jks.hex $dir/keystore.jks
echo "storePassword=$NIGHTLY_KEYSTORE_PASSWORD" > $dir/key.properties
echo "keyPassword=$NIGHTLY_KEYSTORE_PASSWORD" >> $dir/key.properties
echo "keyAlias=nightly" >> $dir/key.properties
echo "storeFile=../../$dir/keystore.jks" >> $dir/key.properties
shell: bash
env:
NIGHTLY_KEYSTORE_JKS_HEX : ${{ secrets.NIGHTLY_KEYSTORE_JKS_HEX }}
NIGHTLY_KEYSTORE_PASSWORD : ${{ secrets.NIGHTLY_KEYSTORE_PASSWORD }}
if: env.NIGHTLY_KEYSTORE_JKS_HEX != null && env.NIGHTLY_KEYSTORE_PASSWORD != null
- name: Build artifacts
run: |
key_properties_path=secrets/android/key.properties
sentry_dsn_path=secrets/sentry_dsn
flavor=$([ -f $key_properties_path ] && echo 'nightly' || echo 'unofficial' )
keystore=$([ "$flavor" = 'nightly' ] && echo "--android-key-properties=$key_properties_path" || true)
sentry=$([ -f $sentry_dsn_path ] && echo "--sentry=$sentry_dsn_path" || true)
dart run util/release.dart --flavor=$flavor $keystore $sentry ${{ matrix.build-args }}
shell: bash
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
# Name of the produced zip file
name: ${{ matrix.name }}
path: releases/release_*/${{ matrix.artifact-files }}
integration_test_android:
name: "run integration tests on android ${{ matrix.api-level }}"
runs-on: self-hosted
strategy:
fail-fast: false
# These jobs are very RAM hungry - reducing the number of them running at the same time to
# avoid exhausting all RAM.
max-parallel: 1
matrix:
api-level:
# These don't work due to various missing apis
# - 23
# - 24
# - 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Run tests
run: |
./docker/linux.sh \
--container ouisync-integration-test-android \
--srcdir . \
--cache \
integration-test --platform android --api ${{ matrix.api-level }}
# - name: Upload logcat
# uses: actions/upload-artifact@v4
# with:
# # Name of the produced zip file
# name: logcat-${{ matrix.api-level }}
# path: logcat.txt
# if-no-files-found: ignore
# # Upload only when the tests fail
# if: failure() || cancelled()
# TODO: Integration tests on both linux and windows currently fail or hang. Commenting them out until they are fixed.
# integration_test_desktop:
# name: run integration tests on ${{ matrix.name }}
# runs-on: ${{ matrix.os }}
# strategy:
# matrix:
# name: [linux, windows]
# include:
# - name: linux
# os: ubuntu-24.04
# - name: windows
# os: windows-latest
# steps:
# - uses: actions/checkout@v4
# with:
# submodules: recursive
# - name: Setup cargo cache
# id: cargo-cache
# uses: actions/cache@v4
# with:
# path: ${{ env.cargo_cache_path }}
# key: ${{ runner.os }}-cargo-test-${{ hashFiles('**/Cargo.lock') }}
# restore-keys: ${{ runner.os }}-cargo-
# - name: Install dependencies (linux)
# run: |
# sudo apt update -y
# sudo apt-get install libappindicator3-dev \
# libcurl4-openssl-dev \
# libfuse-dev \
# libgtk-3-dev \
# libsecret-1-dev \
# ninja-build \
# imagemagick
# if: matrix.name == 'linux'
# - uses: subosito/flutter-action@v2
# with:
# channel: 'stable'
# flutter-version-file: pubspec.yaml
# cache: true
# - name: Get Flutter packages
# run: dart pub get
# - name: Generate the Dart bindings for the Ouisync library
# working-directory: ouisync/bindings/dart
# run: dart tool/bindgen.dart
# # Note that xvfb is used only on linux. On other platforms the tests are run without any
# # special setup: https://github.com/marketplace/actions/setup-xvfb
# - name: Run tests
# uses: coactions/setup-xvfb@v1
# with:
# run: flutter test integration_test/ --dart-define OUISYNC_FLAVOR=itest --verbose