forked from equalitie/ouisync
-
Notifications
You must be signed in to change notification settings - Fork 0
235 lines (192 loc) · 7.03 KB
/
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
232
233
234
name: CI
on: [push]
env:
PROPTEST_CASES: 32
jobs:
check_rust_crates:
name: check rust crates on ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
name: [android, linux, windows]
include:
- name: android
os: ubuntu-24.04
cargo-command: cross
cargo-dir: ~/.cargo
target: aarch64-linux-android
- name: linux
os: ubuntu-24.04
cargo-command: cargo
cargo-dir: ~/.cargo
- name: windows
os: windows-latest
cargo-command: cargo
cargo-dir: ~\cargo
steps:
- uses: actions/checkout@v4
- name: Show rustc version
run: rustc --version
- name: Add rust target
if: matrix.target != ''
run: rustup target add ${{ matrix.target }}
- uses: actions/cache@v3
with:
path: |
${{ matrix.cargo-dir }}/bin/
${{ matrix.cargo-dir }}/registry/index/
${{ matrix.cargo-dir }}/registry/cache/
${{ matrix.cargo-dir }}/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}
- name: Install system dependencies
if: matrix.name == 'linux'
# NOTE: libfuse-dev is required only to build and run the ouisync
# application. It is not required for building and using the ouisync
# library.
run: sudo apt-get install libfuse-dev
- name: Install cross
if: matrix.cargo-command == 'cross'
run: cargo install cross --force --git https://github.com/cross-rs/cross
- name: Run clippy
run: >
${{ matrix.cargo-command }} clippy
--package ouisync --package ouisync-bridge --package ouisync-service
${{ matrix.target != '' && format('--target {0}', matrix.target) || '' }}
--all-targets
--no-deps
-- -Dwarnings
- name: Run unit tests
if: matrix.name == 'linux'
run: ${{ matrix.cargo-command }} test --lib
- name: Run lib integration tests
if: matrix.name == 'linux'
run: ${{ matrix.cargo-command }} test --package ouisync --test gc --test network --test sync
env:
RUST_LOG: ouisync=debug,gc=debug,network=debug,sync=debug
- name: Run cli integration tests
if: matrix.name == 'linux'
run: ${{ matrix.cargo-command }} test --package ouisync-cli --test cli
# TODO: The kotlin bindings need to be updated to the new service architecture, disabled for now
# check_kotlin_bindings:
# name: check kotlin bindings
# runs-on: ubuntu-24.04
# steps:
# - uses: actions/checkout@v4
# - name: Add rust targets
# run: rustup target add x86_64-linux-android armv7-linux-androideabi aarch64-linux-android
# - name: Setup java
# uses: actions/setup-java@v3
# with:
# distribution: 'temurin'
# java-version: '17'
# - name: Setup gradle
# uses: gradle/[email protected]
# - name: Install system dependencies
# # NOTE: fuse isn't used by the bindings themselves but it's required for the unit tests
# # because they use the linux version of the ouisync_service library, not the android one
# # and the linux version does currently unconditionally depend on fuse.
# run: sudo apt-get install libfuse-dev
# # - name: Install NDK
# # uses: nttld/setup-ndk@v1
# # with:
# # ndk-version: r27c
# # link-to-sdk: true
# # local-cache: true
# - name: Cache cargo artifacts
# uses: actions/cache@v3
# with:
# path: |
# ~/.cargo/bin/
# ~/.cargo/registry/index/
# ~/.cargo/registry/cache/
# ~/.cargo/git/db/
# target/
# key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}
# restore-keys: |
# ${{ runner.os }}-cargo-
# - name: Cache gradle artifacts
# uses: actions/cache@v3
# with:
# path: |
# ~/.gradle/caches
# ~/.gradle/wrapper
# key: ${{ runner.os }}-gradle-${{ hashFiles('bindings/kotlin/**/*.gradle*', 'bindings/kotlin/**/gradle-wrapper.properties') }}
# restore-keys: |
# ${{ runner.os }}-gradle-
# - name: Create local.properties
# working-directory: bindings/kotlin
# run: echo "useLocalLib=true" > local.properties
# - name: Run spotless
# working-directory: bindings/kotlin
# run: ./gradlew --stacktrace spotlessCheck
# - name: Run lint
# working-directory: bindings/kotlin
# run: ./gradlew --stacktrace lint
# - name: Run unit tests
# working-directory: bindings/kotlin
# run: ./gradlew --stacktrace lib:testDebugUnitTest
# - name: Build the example app
# working-directory: bindings/kotlin
# run: ./gradlew --stacktrace example:assembleDebug
check_dart_bindings:
name: check dart bindings on ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
name: [linux, windows]
include:
- name: linux
os: ubuntu-24.04
env:
OUISYNC_LIB: ../../target/debug/libouisync_service.so
cargo-dir: ~/.cargo
- name: windows
os: windows-latest
env:
OUISYNC_LIB: ..\..\target\debug\ouisync_service.dll
DOKAN_DLL_OUTPUT_PATH: C:\Windows\System32
cargo-dir: ~\cargo
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
channel: 'stable'
cache: true
# Cache rust artifacts
- uses: actions/cache@v3
with:
path: |
${{ matrix.cargo-dir }}/bin/
${{ matrix.cargo-dir }}/registry/index/
${{ matrix.cargo-dir }}/registry/cache/
${{ matrix.cargo-dir }}/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}
- name: Install system dependencies
if: matrix.name == 'linux'
run: sudo apt-get install libfuse-dev
- name: Get dart dependencies
working-directory: bindings/dart
run: flutter pub get
- name: Generate bindings
working-directory: bindings/dart
run: dart run util/bindgen.dart
- name: Analyze
# analyze should be the same on all platforms so run it on just one to save time
if: matrix.name == 'linux'
working-directory: bindings/dart
run: |
dart analyze lib
dart analyze test
dart analyze example
- name: Build the ouisync service library for tests
run: cargo build -p ouisync-service --lib
- name: DEBUG
run: Get-Location
if: matrix.name == 'windows'
- name: Run tests
working-directory: bindings/dart
env:
RUST_LOG: ouisync=debug,sqlx=warn
run: flutter test