-
Notifications
You must be signed in to change notification settings - Fork 9
192 lines (156 loc) · 5.52 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
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-latest
cargo-command: cross
cargo-dir: ~/.cargo
target: aarch64-linux-android
- name: linux
os: ubuntu-latest
cargo-command: cargo
cargo-dir: ~/.cargo
- name: windows
os: windows-latest
cargo-command: cargo
cargo-dir: ~\cargo
steps:
- uses: actions/checkout@v4
- 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-ffi
${{ 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
check_kotlin_bindings:
name: check kotlin bindings
runs-on: ubuntu-latest
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/gradle-build-action@v2.4.2
- 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_ffi library, not the android one and
# the linux version does currently unconditionally depend on fuse.
run: sudo apt-get install libfuse-dev
- 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') }}
- 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: Run spotless
working-directory: bindings/kotlin
run: ./gradlew spotlessCheck
- name: Run lint
working-directory: bindings/kotlin
run: ./gradlew lint
- name: Run unit tests
working-directory: bindings/kotlin
run: ./gradlew lib:testDebugUnitTest
- name: Build the example app
working-directory: bindings/kotlin
run: ./gradlew example:assembleDebug
check_dart_bindings:
name: check dart bindings
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
channel: 'stable'
cache: true
# Cache rust artifacts
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
ouisync/target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}
- name: Install system dependencies
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
working-directory: bindings/dart
run: |
dart analyze lib
dart analyze example
- name: Building the ouisync library for tests
run: cargo build -p ouisync-ffi --lib
- name: Run tests
working-directory: bindings/dart
env:
RUST_LOG: ouisync=debug,sqlx=warn
run: flutter test