forked from rerun-io/rerun
-
Notifications
You must be signed in to change notification settings - Fork 0
278 lines (233 loc) · 9.33 KB
/
reusable_checks_rust.yml
File metadata and controls
278 lines (233 loc) · 9.33 KB
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
name: "Rust Checks: Lints, Tests, Docs"
on:
workflow_call:
inputs:
CONCURRENCY:
required: true
type: string
CHANNEL:
required: false
type: string # enum: 'nightly', 'main', or 'pr'
concurrency:
group: ${{ inputs.CONCURRENCY }}-checks_rust
cancel-in-progress: true
env:
RUSTFLAGS: --deny warnings
RUSTDOCFLAGS: --deny warnings
# Disable the GHA backend (Github's 10GB storage) since we use our own GCS backend.
# See: https://github.com/marketplace/actions/sccache-action
SCCACHE_GHA_ENABLED: "false"
# Wrap every `rustc` invocation in `sccache`.
RUSTC_WRAPPER: "sccache"
# Not only `sccache` cannot cache incremental builds, it's counter-productive to generate all
# these incremental artifacts when running on CI.
CARGO_INCREMENTAL: "0"
# Improve diagnostics for crashes.
RUST_BACKTRACE: full
# Sourced from https://vulkan.lunarg.com/sdk/home#linux
VULKAN_SDK_VERSION: "1.3.290.0"
# Via: https://nexte.st/docs/installation/pre-built-binaries/#using-nextest-in-github-actions
# ANSI color codes should be supported by default on GitHub Actions.
CARGO_TERM_COLOR: always
defaults:
run:
shell: bash --noprofile --norc -euo pipefail {0}
permissions:
contents: "read"
id-token: "write"
jobs:
# ---------------------------------------------------------------------------
rs-lints:
name: Rust lints (fmt, check, clippy, doc)
timeout-minutes: 60
# TODO(andreas): setup-vulkan doesn't work on 24.4 right now due to missing .so
runs-on: ubuntu-22.04-large
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || '' }}
lfs: true
- name: Set up Rust
uses: ./.github/actions/setup-rust
with:
cache_key: "build-linux"
save_cache: true
workload_identity_provider: ${{ secrets.GOOGLE_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ secrets.GOOGLE_SERVICE_ACCOUNT }}
- uses: prefix-dev/setup-pixi@v0.9.1
with:
pixi-version: v0.55.0
- name: Rust checks (PR subset)
if: ${{ inputs.CHANNEL == 'pr' }}
run: pixi run rs-check --only base_checks sdk_variations cargo_deny denied_sdk_deps wasm docs
- name: Rust most checks (`main` branch subset)
if: ${{ inputs.CHANNEL == 'main' }}
run: pixi run rs-check --skip individual_crates docs_slow tests tests_without_all_features # Tests run in a separate job
- name: Rust all checks (nightly)
if: ${{ inputs.CHANNEL == 'nightly' }}
run: pixi run rs-check --skip tests tests_without_all_features # Tests run in a separate job
- name: .rrd backwards compatibility
# We don't yet guarantee backwards compatibility, but we at least check it
# so that we _know_ if/when we break it.
# See tests/assets/rrd/README.md for more
run: pixi run check-backwards-compatibility
- name: Check dependency tree (no cycles)
run: pixi run python scripts/ci/crates.py check-dependency-tree
rs-tests:
name: Test on Linux
timeout-minutes: 60
# TODO(andreas): setup-vulkan doesn't work on 24.4 right now due to missing .so
runs-on: ubuntu-22.04-large
env:
RUSTDOCFLAGS: ""
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || '' }}
lfs: true
- name: Set up Rust
uses: ./.github/actions/setup-rust
with:
cache_key: "build-linux"
save_cache: true
workload_identity_provider: ${{ secrets.GOOGLE_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ secrets.GOOGLE_SERVICE_ACCOUNT }}
- uses: prefix-dev/setup-pixi@v0.9.1
with:
pixi-version: v0.55.0
# Install the Vulkan SDK, so we can use the software rasterizer.
# TODO(andreas): It would be nice if `setup_software_rasterizer.py` could do that for us as well (note though that this action here is very fast when cached!)
- name: Install Vulkan SDK
uses: rerun-io/install-vulkan-sdk-action@v1.1.0
with:
vulkan_version: ${{ env.VULKAN_SDK_VERSION }}
install_runtime: true
cache: true
stripdown: true
- name: Setup software rasterizer
run: pixi run python ./scripts/ci/setup_software_rasterizer.py
- name: Rust tests
run: pixi run rs-check --only tests
- name: Rust tests without --all-features (`main`/`nightly` channel)
if: ${{ inputs.CHANNEL != 'pr' }}
run: pixi run rs-check --only tests_without_all_features
- name: Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: test-results-ubuntu
path: "**/tests/snapshots"
# Run tests on Mac and Windows (main channel)
mac-windows-tests-main:
name: Tests only (main)
timeout-minutes: 100 # Windows is very slow
strategy:
matrix:
include:
- runs_on: "macos-26-xlarge"
name: "macos"
- runs_on: "windows-latest-32-cores"
name: "windows"
if: ${{ inputs.CHANNEL == 'main' }}
runs-on: ${{ matrix.runs_on }}
steps:
- uses: actions/checkout@v4
with:
lfs: true
- name: Set up Rust
uses: ./.github/actions/setup-rust
with:
cache_key: "build-${{ matrix.name }}"
save_cache: true
workload_identity_provider: ${{ secrets.GOOGLE_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ secrets.GOOGLE_SERVICE_ACCOUNT }}
# Building with `--all-features` requires extra build tools like `nasm`.
- uses: prefix-dev/setup-pixi@v0.9.1
with:
pixi-version: v0.55.0
# Install the Vulkan SDK, so we can use the software rasterizer.
# TODO(andreas): It would be nice if `setup_software_rasterizer.py` could do that for us as well (note though that this action here is very fast when cached!)
- name: Install Vulkan SDK
uses: rerun-io/install-vulkan-sdk-action@v1.1.0
with:
vulkan_version: ${{ env.VULKAN_SDK_VERSION }}
install_runtime: true
cache: true
stripdown: true
- name: Setup software rasterizer
run: pixi run python ./scripts/ci/setup_software_rasterizer.py
- name: Rust tests
run: pixi run rs-check --only tests
- name: Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: test-results-${{ matrix.name }}
path: "**/tests/snapshots"
# Run all checks on Mac and Windows (nightly channel, split across multiple jobs)
mac-windows-checks-nightly:
name: ${{ matrix.platform.name }}${{ matrix.checks_group.label }}
timeout-minutes: 100 # Windows is very slow
strategy:
fail-fast: false
matrix:
platform:
- runs_on: "macos-26-xlarge"
name: "macos"
- runs_on: "windows-latest-32-cores"
name: "windows"
checks_group:
- name: "base-and-deny"
checks: "base_checks sdk_variations cargo_deny denied_sdk_deps"
label: " (base & deny)"
- name: "wasm-and-examples"
checks: "wasm individual_examples"
label: " (wasm & examples)"
- name: "individual-crates"
checks: "individual_crates"
label: " (individual crates)"
- name: "docs"
checks: "docs docs_slow"
label: " (docs)"
- name: "tests"
checks: "tests"
label: " (tests)"
- name: "tests-default-features"
checks: "tests_without_all_features"
label: " (tests default features)"
if: ${{ inputs.CHANNEL == 'nightly' }}
runs-on: ${{ matrix.platform.runs_on }}
steps:
- uses: actions/checkout@v4
with:
lfs: true
- name: Set up Rust
uses: ./.github/actions/setup-rust
with:
cache_key: "build-${{ matrix.platform.name }}-${{ matrix.checks_group.name }}"
save_cache: true
workload_identity_provider: ${{ secrets.GOOGLE_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ secrets.GOOGLE_SERVICE_ACCOUNT }}
# Building with `--all-features` requires extra build tools like `nasm`.
- uses: prefix-dev/setup-pixi@v0.9.1
with:
pixi-version: v0.55.0
# Install the Vulkan SDK, so we can use the software rasterizer.
# TODO(andreas): It would be nice if `setup_software_rasterizer.py` could do that for us as well (note though that this action here is very fast when cached!)
- name: Install Vulkan SDK
uses: rerun-io/install-vulkan-sdk-action@v1.1.0
with:
vulkan_version: ${{ env.VULKAN_SDK_VERSION }}
install_runtime: true
cache: true
stripdown: true
- name: Setup software rasterizer
run: pixi run python ./scripts/ci/setup_software_rasterizer.py
- name: Rust checks
run: pixi run rs-check --only ${{ matrix.checks_group.checks }}
- name: Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: test-results-${{ matrix.platform.name }}-${{ matrix.checks_group.name }}
path: "**/tests/snapshots"