-
Notifications
You must be signed in to change notification settings - Fork 94
315 lines (289 loc) · 10 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
name: CI
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
env:
RUST_LOG: trace
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"
run: cargo build --all
- name: "Test"
# Remove Windows as there is `pdb` linker issue.
# See: https://github.com/dora-rs/dora/pull/359#discussion_r1360268497
if: runner.os == 'Linux' || runner.os == 'macOS'
run: cargo test --all
- name: "Test"
if: runner.os == 'Windows'
run: cargo test --all --lib
# 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-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: 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' }}
# 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
# python examples
- uses: actions/setup-python@v2
if: runner.os == 'Linux' || runner.os == 'macOS'
with:
python-version: "3.8"
- name: "Python Dataflow example"
if: runner.os == 'Linux' || runner.os == 'macOS'
run: cargo run --example python-dataflow
- name: "Python Operator Dataflow example"
if: runner.os == 'Linux' || runner.os == 'macOS'
run: cargo run --example python-operator-dataflow
# ROS2 bridge examples
ros2-bridge-examples:
name: "ROS2 Bridge Examples"
runs-on: ubuntu-latest
timeout-minutes: 45
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' }}
- 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: "Rust ROS2 Bridge example"
timeout-minutes: 30
env:
QT_QPA_PLATFORM: offscreen
run: |
source /opt/ros/humble/setup.bash && ros2 run turtlesim turtlesim_node &
cargo run --example rust-ros2-dataflow --features="ros2-examples"
- uses: actions/setup-python@v2
with:
python-version: "3.8"
- 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"
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
- 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/coordinator --locked
cargo install --path binaries/daemon --locked
cargo install --path binaries/cli --locked
- name: "Test CLI"
timeout-minutes: 30
# fail-fast by using bash shell explictly
shell: bash
run: |
dora-cli up
dora-cli list
# Test Rust template Project
dora-cli new test_rust_project --internal-create-with-path-dependencies
cd test_rust_project
cargo build --all
dora-cli start dataflow.yml --name ci-rust-test
sleep 10
dora-cli stop --name ci-rust-test
cd ..
# Test Python template Project
pip3 install maturin
maturin build -m apis/python/node/Cargo.toml
pip3 install target/wheels/*
dora-cli new test_python_project --lang python --internal-create-with-path-dependencies
cd test_python_project
dora-cli start dataflow.yml --name ci-python-test
sleep 10
dora-cli stop --name ci-python-test
cd ..
dora-cli 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