forked from rerun-io/rerun
-
Notifications
You must be signed in to change notification settings - Fork 2
259 lines (218 loc) · 8.02 KB
/
rust.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
name: CI (Rust)
on:
push:
branches:
- "main"
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }} # Cancel previous CI jobs on the same branch
cancel-in-progress: true
env:
# web_sys_unstable_apis is required to enable the web_sys clipboard API which egui_web uses
# https://rustwasm.github.io/wasm-bindgen/api/web_sys/struct.Clipboard.html
# https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html
RUSTFLAGS: --cfg=web_sys_unstable_apis -D warnings
# See https://github.com/ericseppanen/cargo-cranky/issues/8
RUSTDOCFLAGS: -D warnings -D rustdoc::missing_crate_level_docs
permissions:
# deployments permission to deploy GitHub pages website
deployments: write
# contents permission to update benchmark contents in gh-pages branch
contents: write
jobs:
rs-benchmarks:
name: Rust Criterion benchmarks
# Only save the rs-benchmarks job when a commit gets pushed to main
if: ${{ github.event_name == 'push' }}
runs-on: ubuntu-latest-16-cores
container:
image: rerunio/ci_docker:0.5
env:
RUSTFLAGS: ${{env.RUSTFLAGS}}
RUSTDOCFLAGS: ${{env.RUSTDOCFLAGS}}
steps:
- uses: actions/checkout@v3
- name: Set up cargo cache
uses: Swatinem/rust-cache@v2
with:
env-vars: CARGO CC CFLAGS CXX CMAKE RUST CACHE_KEY
# Don't update the cache -- it will be updated by the lint job
# TODO(jleibs): this job will likely run before rust.yml updates
# the cache. Better cross-job sequencing would be nice here
save-if: false
- name: Run benchmark
# Use bash shell so we get pipefail behavior with tee
shell: bash
run: |
cargo bench \
--all-features \
-p re_arrow_store \
-p re_data_store \
-p re_log_types \
-p re_query \
-p re_tuid \
-- --output-format=bencher | tee output.txt
- name: Store benchmark result
uses: benchmark-action/github-action-benchmark@v1
with:
name: Rust Benchmark
tool: "cargo"
output-file-path: output.txt
github-token: ${{ secrets.GITHUB_TOKEN }}
# Show alert with commit comment on detecting possible performance regression
comment-on-alert: true
alert-threshold: "150%"
fail-on-alert: true
comment-always: true
# Push and deploy GitHub pages branch automatically
auto-push: true
gh-pages-branch: gh-pages
benchmark-data-dir-path: dev/bench
max-items-in-chart: 30
# ---------------------------------------------------------------------------
rs-lints:
name: Rust lints (fmt, check, cranky, tests, doc)
runs-on: ubuntu-latest-16-cores
container:
image: rerunio/ci_docker:0.5
env:
RUSTFLAGS: ${{env.RUSTFLAGS}}
RUSTDOCFLAGS: ${{env.RUSTDOCFLAGS}}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Don't do a shallow clone since we need to push gh-pages
- name: Set up cargo cache
uses: Swatinem/rust-cache@v2
with:
env-vars: CARGO CC CFLAGS CXX CMAKE RUST CACHE_KEY
# See: https://github.com/rerun-io/rerun/pull/497
save-if: ${{ github.event_name == 'push'}}
# First do our check with --locked to make sure `Cargo.lock` is up to date
- name: Check all features
uses: actions-rs/cargo@v1
with:
command: check
args: --locked --all-features
- name: Rustfmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
- name: Cranky
uses: actions-rs/cargo@v1
with:
command: cranky
args: --all-targets --all-features -- -D warnings
- name: Check no default features
uses: actions-rs/cargo@v1
with:
command: check
args: --locked --no-default-features --features __ci --lib
- name: Test doc-tests
uses: actions-rs/cargo@v1
with:
command: test
args: --doc --all-features
- name: cargo doc
uses: actions-rs/cargo@v1
with:
command: doc
args: --no-deps --all-features
- name: cargo doc --document-private-items
uses: actions-rs/cargo@v1
with:
command: doc
args: --document-private-items --no-deps --all-features
- name: Test
uses: actions-rs/cargo@v1
with:
command: test
args: --all-targets --all-features
- name: Set up git author
if: ${{ github.event_name == 'push' }}
run: |
remote_repo="https://${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
git config --global user.name "${GITHUB_ACTOR}"
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set up ghp-import
if: ${{ github.event_name == 'push' }}
run: pip install ghp-import
- name: Patch in a redirect page
if: ${{ github.event_name == 'push' }}
run: echo "<meta http-equiv=\"refresh\" content=\"0; url=${REDIRECT_CRATE}\">" > target/doc/index.html
env:
REDIRECT_CRATE: rerun
# See: https://github.com/c-w/ghp-import
- name: Deploy the docs
if: ${{ github.event_name == 'push' }}
run: |
git fetch
python3 -m ghp_import -n -p -x docs/rust/head target/doc/ -m "Update the rust docs"
# ---------------------------------------------------------------------------
rs-check-wasm:
name: Check Rust web build (wasm32 + wasm-bindgen)
runs-on: ubuntu-latest-16-cores
container:
image: rerunio/ci_docker:0.5
env:
RUSTFLAGS: ${{env.RUSTFLAGS}}
RUSTDOCFLAGS: ${{env.RUSTDOCFLAGS}}
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.67.0
target: wasm32-unknown-unknown
override: true
- name: Set up cargo cache
uses: Swatinem/rust-cache@v2
with:
env-vars: CARGO CC CFLAGS CXX CMAKE RUST CACHE_KEY
# See: https://github.com/rerun-io/rerun/pull/497
save-if: ${{ github.event_name == 'push'}}
- name: Check re_viewer wasm32
uses: actions-rs/cargo@v1
with:
command: check
args: --locked --all-features --lib --target wasm32-unknown-unknown -p re_viewer
- name: Check re_renderer examples wasm32
uses: actions-rs/cargo@v1
with:
command: check
args: --locked --target wasm32-unknown-unknown -p re_renderer --examples
- run: ./scripts/wasm_bindgen_check.sh --skip-setup
# ---------------------------------------------------------------------------
rs-cargo-deny:
name: Check Rust dependencies (cargo-deny)
runs-on: ubuntu-latest-16-cores
container:
image: rerunio/ci_docker:0.5
env:
RUSTFLAGS: ${{env.RUSTFLAGS}}
RUSTDOCFLAGS: ${{env.RUSTDOCFLAGS}}
steps:
- uses: actions/checkout@v2
- name: cargo deny aarch64-apple-darwin check
uses: actions-rs/cargo@v1
with:
command: deny
args: --log-level=error --all-features --target aarch64-apple-darwin check
- name: cargo deny wasm32-unknown-unknown check
uses: actions-rs/cargo@v1
with:
command: deny
args: --log-level=error --all-features --target wasm32-unknown-unknown check
- name: cargo deny x86_64-pc-windows-msvc
uses: actions-rs/cargo@v1
with:
command: deny
args: --log-level=error --all-features --target x86_64-pc-windows-msvc check
- name: cargo deny x86_64-unknown-linux-musl check
uses: actions-rs/cargo@v1
with:
command: deny
args: --log-level=error --all-features --target x86_64-unknown-linux-musl check