-
Notifications
You must be signed in to change notification settings - Fork 98
470 lines (432 loc) · 15.3 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
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
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
name: CI
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
env:
RUST_LOG: INFO
jobs:
test:
name: "Test"
strategy:
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
fail-fast: false
runs-on: ${{ matrix.platform }}
timeout-minutes: 60
steps:
- name: Print available space (Windows only)
run: Get-PSDrive
if: runner.os == 'Windows'
- name: Override cargo target dir (Windows only)
run: echo "CARGO_TARGET_DIR=C:\cargo-target" >> "$GITHUB_ENV"
shell: bash
if: runner.os == 'Windows'
- uses: actions/checkout@v3
- uses: r7kamura/[email protected]
- run: cargo --version --verbose
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
if: runner.os == 'Linux'
with:
# this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
tool-cache: false
# all of these default to true, but feel free to set to
# "false" if necessary for your workflow
android: true
dotnet: true
haskell: true
large-packages: false
docker-images: true
swap-storage: false
- name: Free disk Space (Windows)
if: runner.os == 'Windows'
run: |
docker system prune --all -f
Remove-Item "C:\Android" -Force -Recurse
- uses: Swatinem/rust-cache@v2
with:
cache-provider: buildjet
cache-on-failure: true
# only save caches for `main` branch
save-if: ${{ github.ref == 'refs/heads/main' }}
cache-directories: ${{ env.CARGO_TARGET_DIR }}
- name: "Check"
run: cargo check --all
- name: "Build (Without Python node as it is build with maturin)"
run: cargo build --all --exclude dora-node-api-python
- name: "Test"
run: cargo test --all --exclude dora-ros2-bridge-python
# Run examples as separate job because otherwise we will exhaust the disk
# space of the GitHub action runners.
examples:
name: "Examples"
strategy:
matrix:
platform: [ubuntu-22.04, macos-latest, windows-latest]
fail-fast: false
runs-on: ${{ matrix.platform }}
timeout-minutes: 60
steps:
- uses: actions/checkout@v3
- uses: r7kamura/[email protected]
- run: cargo --version --verbose
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
if: runner.os == 'Linux'
with:
# this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
tool-cache: true
# all of these default to true, but feel free to set to
# "false" if necessary for your workflow
android: true
dotnet: true
haskell: true
large-packages: false
docker-images: true
swap-storage: true
- name: Free disk Space (Windows)
if: runner.os == 'Windows'
run: |
docker system prune --all -f
Remove-Item "C:\Android" -Force -Recurse
- uses: Swatinem/rust-cache@v2
with:
cache-provider: buildjet
cache-on-failure: true
# only save caches for `main` branch
save-if: ${{ github.ref == 'refs/heads/main' }}
# general examples
- name: "Build examples"
timeout-minutes: 30
run: cargo build --examples
- name: "Rust Dataflow example"
timeout-minutes: 30
run: cargo run --example rust-dataflow
- name: "Multiple Daemons example"
timeout-minutes: 30
run: cargo run --example multiple-daemons
- name: "C Dataflow example"
timeout-minutes: 15
run: cargo run --example c-dataflow
- name: "C++ Dataflow example"
timeout-minutes: 15
run: cargo run --example cxx-dataflow
- name: "Cmake example"
if: runner.os == 'Linux'
timeout-minutes: 30
run: cargo run --example cmake-dataflow
- name: "Unix Domain Socket example"
if: runner.os == 'Linux'
run: cargo run --example rust-dataflow -- dataflow_socket.yml
# ROS2 bridge examples
ros2-bridge-examples:
name: "ROS2 Bridge Examples"
runs-on: ubuntu-22.04
timeout-minutes: 45
steps:
- uses: actions/checkout@v3
- uses: r7kamura/[email protected]
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
if: runner.os == 'Linux'
with:
# this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
tool-cache: false
# all of these default to true, but feel free to set to
# "false" if necessary for your workflow
android: true
dotnet: true
haskell: true
large-packages: false
docker-images: true
swap-storage: false
- run: cargo --version --verbose
- uses: Swatinem/rust-cache@v2
with:
cache-provider: buildjet
cache-on-failure: true
# only save caches for `main` branch
save-if: ${{ github.ref == 'refs/heads/main' }}
- uses: ros-tooling/[email protected]
with:
required-ros-distributions: humble
- run: 'source /opt/ros/humble/setup.bash && echo AMENT_PREFIX_PATH=${AMENT_PREFIX_PATH} >> "$GITHUB_ENV"'
- name: "Install pyarrow for testing"
run: pip install numpy pyarrow
- name: "Test"
run: cargo test -p dora-ros2-bridge-python
- name: "Rust ROS2 Bridge example"
timeout-minutes: 30
env:
QT_QPA_PLATFORM: offscreen
run: |
source /opt/ros/humble/setup.bash && ros2 run turtlesim turtlesim_node &
source /opt/ros/humble/setup.bash && ros2 run examples_rclcpp_minimal_service service_main &
cargo run --example rust-ros2-dataflow --features="ros2-examples"
- uses: actions/setup-python@v2
if: runner.os != 'Windows'
with:
python-version: "3.8"
- uses: actions/setup-python@v2
if: runner.os == 'Windows'
with:
python-version: "3.10"
- name: "python-ros2-dataflow"
timeout-minutes: 30
env:
QT_QPA_PLATFORM: offscreen
run: |
# Reset only the turtlesim instance as it is not destroyed at the end of the previous job
source /opt/ros/humble/setup.bash && ros2 service call /reset std_srvs/srv/Empty &
cargo run --example python-ros2-dataflow --features="ros2-examples"
- name: "c++-ros2-dataflow"
timeout-minutes: 30
env:
QT_QPA_PLATFORM: offscreen
run: |
# Reset only the turtlesim instance as it is not destroyed at the end of the previous job
source /opt/ros/humble/setup.bash && ros2 service call /reset std_srvs/srv/Empty &
cargo run --example cxx-ros2-dataflow --features="ros2-examples"
bench:
name: "Bench"
strategy:
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
fail-fast: false
runs-on: ${{ matrix.platform }}
timeout-minutes: 60
steps:
- uses: actions/checkout@v3
- uses: r7kamura/[email protected]
- run: cargo --version --verbose
- uses: Swatinem/rust-cache@v2
with:
cache-provider: buildjet
cache-on-failure: true
# only save caches for `main` branch
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: "Benchmark example"
timeout-minutes: 30
run: cargo run --example benchmark --release
CLI:
name: "CLI Test"
strategy:
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
fail-fast: false
runs-on: ${{ matrix.platform }}
timeout-minutes: 60
steps:
- uses: actions/checkout@v3
- uses: r7kamura/[email protected]
- run: cargo --version --verbose
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
if: runner.os == 'Linux'
with:
# this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
tool-cache: true
# all of these default to true, but feel free to set to
# "false" if necessary for your workflow
android: true
dotnet: true
haskell: true
large-packages: false
docker-images: true
swap-storage: true
- uses: Swatinem/rust-cache@v2
with:
cache-provider: buildjet
cache-on-failure: true
# only save caches for `main` branch
save-if: ${{ github.ref == 'refs/heads/main' }}
# CLI tests
- name: "Build cli and binaries"
timeout-minutes: 45
# fail-fast by using bash shell explictly
shell: bash
run: |
cargo install --path binaries/cli --locked
- name: "Test CLI (Rust)"
timeout-minutes: 30
# fail-fast by using bash shell explictly
shell: bash
run: |
# Test Rust template Project
dora new test_rust_project --internal-create-with-path-dependencies
cd test_rust_project
cargo build --all
dora up
dora list
dora start dataflow.yml --name ci-rust-test --detach
sleep 10
dora stop --name ci-rust-test --grace-duration 5s
cd ..
dora build examples/rust-dataflow/dataflow_dynamic.yml
dora start examples/rust-dataflow/dataflow_dynamic.yml --name ci-rust-dynamic --detach
cargo run -p rust-dataflow-example-sink-dynamic
sleep 5
dora stop --name ci-rust-dynamic --grace-duration 5s
dora destroy
- name: "Test CLI (Python)"
timeout-minutes: 30
# fail-fast by using bash shell explictly
shell: bash
run: |
# Test Python template Project
python3 -m venv .venv
if [ ! -d ".venv/bin" ]; then
mv .venv/Scripts .venv/bin # venv is placed under `Scripts` on Windows
fi
source .venv/bin/activate
pip3 install maturin
maturin build -m apis/python/node/Cargo.toml
pip3 install target/wheels/*
dora new test_python_project --lang python --internal-create-with-path-dependencies
cd test_python_project
dora up
dora list
dora build dataflow.yml
dora start dataflow.yml --name ci-python-test --detach
sleep 10
dora stop --name ci-python-test --grace-duration 5s
# Run Python Node Example
dora build ../examples/python-dataflow/dataflow.yml
dora start ../examples/python-dataflow/dataflow.yml --name ci-python --detach
sleep 80
dora stop --name ci-python --grace-duration 5s
# Run Python Dynamic Node Example
dora start ../examples/python-dataflow/dataflow_dynamic.yml --name ci-python-dynamic --detach
opencv-plot --name plot
sleep 80
dora stop --name ci-python-dynamic --grace-duration 5s
# Run Python Operator Example
dora start ../examples/python-operator-dataflow/dataflow.yml --name ci-python-operator --detach
sleep 80
dora stop --name ci-python-operator --grace-duration 5s
dora destroy
- name: "Test CLI (C)"
timeout-minutes: 30
# fail-fast by using bash shell explictly
shell: bash
if: runner.os == 'Linux'
run: |
# Test C template Project
dora new test_c_project --lang c --internal-create-with-path-dependencies
cd test_c_project
dora up
dora list
cmake -B build
cmake --build build
cmake --install build
dora start dataflow.yml --name ci-c-test --detach
sleep 10
dora stop --name ci-c-test --grace-duration 5s
dora destroy
- name: "Test CLI (C++)"
timeout-minutes: 30
# fail-fast by using bash shell explictly
shell: bash
if: runner.os == 'Linux'
run: |
# Test C++ template Project
dora new test_cxx_project --lang cxx --internal-create-with-path-dependencies
cd test_cxx_project
dora up
dora list
cmake -B build
cmake --build build
cmake --install build
dora start dataflow.yml --name ci-cxx-test --detach
sleep 10
dora stop --name ci-cxx-test --grace-duration 5s
dora destroy
clippy:
name: "Clippy"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: r7kamura/[email protected]
- run: cargo --version --verbose
- name: "Clippy"
run: cargo clippy --all
- name: "Clippy (tracing feature)"
run: cargo clippy --all --features tracing
if: false # only the dora-runtime has this feature, but it is currently commented out
- name: "Clippy (metrics feature)"
run: cargo clippy --all --features metrics
if: false # only the dora-runtime has this feature, but it is currently commented out
rustfmt:
name: "Formatting"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: r7kamura/[email protected]
- name: "rustfmt"
run: cargo fmt --all -- --check
check-license:
name: "License Checks"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: r7kamura/[email protected]
- run: cargo --version --verbose
- uses: Swatinem/rust-cache@v2
with:
cache-provider: buildjet
cache-on-failure: true
# only save caches for `main` branch
save-if: ${{ github.ref == 'refs/heads/main' }}
- run: cargo install cargo-lichking
- name: "Check dependency licenses"
run: cargo lichking check
typos:
name: Typos
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Typos check with custom config file
uses: crate-ci/typos@master
cross-check:
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- runner: ubuntu-20.04
target: x86_64-unknown-linux-gnu
- runner: ubuntu-20.04
target: i686-unknown-linux-gnu
- runner: ubuntu-20.04
target: aarch64-unknown-linux-gnu
- runner: ubuntu-20.04
target: aarch64-unknown-linux-musl
- runner: ubuntu-20.04
target: armv7-unknown-linux-musleabihf
- runner: macos-12
target: aarch64-apple-darwin
- runner: macos-12
target: x86_64-apple-darwin
fail-fast: false
steps:
- uses: actions/checkout@v3
- uses: r7kamura/[email protected]
- name: "Add toolchains"
run: rustup target add ${{ matrix.platform.target }}
- name: "Build"
uses: actions-rs/cargo@v1
with:
use-cross: true
command: check
args: --target ${{ matrix.platform.target }} -p dora-cli