forked from rerun-io/rerun
-
Notifications
You must be signed in to change notification settings - Fork 0
156 lines (127 loc) · 5.16 KB
/
reusable_checks_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
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:
# 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 --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
permissions:
contents: "read"
id-token: "write"
jobs:
# ---------------------------------------------------------------------------
rs-lints:
name: Rust lints (fmt, check, clippy, tests, doc)
# 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.8.1
with:
pixi-version: v0.39.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 (PR subset)
if: ${{ inputs.CHANNEL == 'pr' }}
run: pixi run rs-check --only base_checks sdk_variations cargo_deny wasm docs tests
- name: Rust most checks & tests
if: ${{ inputs.CHANNEL == 'main' }}
run: pixi run rs-check --skip individual_crates docs_slow
- name: Rust all checks & tests
if: ${{ inputs.CHANNEL == 'nightly' }}
run: pixi run rs-check
# Run some basics tests on Mac and Windows
mac-windows-tests:
name: Test on ${{ matrix.name }}
strategy:
matrix:
include:
- os: "macos-latest"
name: "macos"
- os: "windows-latest-8-cores"
name: "windows"
# Note: we can't use `matrix.os` here because its evaluated before the matrix stuff.
if: ${{ inputs.CHANNEL == 'main' || inputs.CHANNEL == 'nightly' }}
runs-on: ${{ matrix.os }}
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.8.1
with:
pixi-version: v0.39.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
if: ${{ matrix.name != 'macos' }}
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
if: ${{ inputs.CHANNEL == 'main' }}
run: pixi run rs-check --only tests
- name: Rust all checks & tests
if: ${{ inputs.CHANNEL == 'nightly' }}
run: pixi run rs-check