Skip to content

Commit 3f881ab

Browse files
authored
Run C++/rust CI only on C++/rust changes (#5333)
### What * Part of #5332 C++ had some of this already but this PR makes it more aggressive: * don't run _any_ cpp checks if no cpp file was touched * move C++ formatting checks to the cpp check workflow * split out rust checks and for PRs only run them when rust or toml files were touched ### Checklist * [x] I have read and agree to [Contributor Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and the [Code of Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md) * [x] I've included a screenshot or gif (if applicable) * [x] I have tested the web demo (if applicable): * Using newly built examples: [app.rerun.io](https://app.rerun.io/pr/5333/index.html) * Using examples from latest `main` build: [app.rerun.io](https://app.rerun.io/pr/5333/index.html?manifest_url=https://app.rerun.io/version/main/examples_manifest.json) * Using full set of examples from `nightly` build: [app.rerun.io](https://app.rerun.io/pr/5333/index.html?manifest_url=https://app.rerun.io/version/nightly/examples_manifest.json) * [x] The PR title and labels are set such as to maximize their usefulness for the next release's CHANGELOG * [x] If applicable, add a new check to the [release checklist](https://github.com/rerun-io/rerun/blob/main/tests/python/release_checklist)! - [PR Build Summary](https://build.rerun.io/pr/5333) - [Docs preview](https://rerun.io/preview/ee71a7da27fbc49f343046003bcdb75e91ef5f9a/docs) <!--DOCS-PREVIEW--> - [Examples preview](https://rerun.io/preview/ee71a7da27fbc49f343046003bcdb75e91ef5f9a/examples) <!--EXAMPLES-PREVIEW--> - [Recent benchmark results](https://build.rerun.io/graphs/crates.html) - [Wasm size tracking](https://build.rerun.io/graphs/sizes.html)
1 parent ce361be commit 3f881ab

6 files changed

+214
-150
lines changed

.github/workflows/nightly.yml

+15
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,21 @@ jobs:
1111
checks:
1212
name: Checks
1313
uses: ./.github/workflows/reusable_checks.yml
14+
with:
15+
CONCURRENCY: nightly
16+
secrets: inherit
17+
18+
checks-cpp:
19+
name: Checks
20+
uses: ./.github/workflows/reusable_checks_cpp.yml
21+
with:
22+
CONCURRENCY: nightly
23+
FULL: "true"
24+
secrets: inherit
25+
26+
checks-rust:
27+
name: Checks
28+
uses: ./.github/workflows/reusable_checks_rust.yml
1429
with:
1530
CONCURRENCY: nightly
1631
ALL_CHECKS: true

.github/workflows/on_pull_request.yml

+29-3
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,24 @@ jobs:
1919
uses: ./.github/workflows/reusable_checks.yml
2020
with:
2121
CONCURRENCY: pr-${{ github.event.pull_request.number }}
22-
PR_NUMBER: ${{ github.event.pull_request.number }}
2322
secrets: inherit
2423

24+
rust-paths-filter:
25+
runs-on: ubuntu-latest
26+
outputs:
27+
rust_changes: ${{ steps.filter.outputs.rust_changes }}
28+
steps:
29+
- uses: actions/checkout@v4
30+
with:
31+
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || '' }}
32+
- uses: dorny/paths-filter@v2
33+
id: filter
34+
with:
35+
filters: |
36+
rust_changes:
37+
- "**/*.rs"
38+
- "**/*.toml"
39+
2540
cpp-paths-filter:
2641
runs-on: ubuntu-latest
2742
outputs:
@@ -36,17 +51,28 @@ jobs:
3651
filters: |
3752
cpp_changes:
3853
- '**/*.hpp'
39-
- '**/.cpp'
54+
- '**/*.cpp'
4055
- '**/CMakeLists.txt'
4156
57+
rust-checks:
58+
name: "Rust Checks"
59+
if: github.event.pull_request.head.repo.owner.login == 'rerun-io' && needs.cpp-paths-filter.outputs.rust_changes == 'true'
60+
# Wait for the rust-paths-filter to be completed before starting.
61+
needs: rust-paths-filter
62+
uses: ./.github/workflows/reusable_checks_rust.yml
63+
with:
64+
CONCURRENCY: pr-${{ github.event.pull_request.number }}
65+
secrets: inherit
66+
4267
cpp-tests:
4368
name: "C++ tests"
69+
if: needs.cpp-paths-filter.outputs.cpp_changes == 'true'
4470
# Wait for the cpp-paths-filter to be completed before starting.
4571
needs: cpp-paths-filter
4672
uses: ./.github/workflows/reusable_checks_cpp.yml
4773
with:
4874
CONCURRENCY: pr-${{ github.event.pull_request.number }}
49-
FULL: "${{ needs.cpp-paths-filter.outputs.cpp_changes }}"
75+
FULL: "true"
5076
secrets: inherit
5177

5278
min-wheel-build:

.github/workflows/on_push_main.yml

+7
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@ jobs:
2121
FULL: "true"
2222
secrets: inherit
2323

24+
rust_checks:
25+
name: Checks
26+
uses: ./.github/workflows/reusable_checks_rust.yml
27+
with:
28+
CONCURRENCY: push-${{ github.ref_name }}
29+
secrets: inherit
30+
2431
# Check that a CLEAN container with just `cargo` on it can build rerun:
2532
clean-build:
2633
name: cargo build on clean container

.github/workflows/reusable_checks.yml

+1-147
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,11 @@
1-
name: "Checks: Lints, Tests, Docs"
1+
name: "General checks: Lints, Tests, Docs"
22

33
on:
44
workflow_call:
55
inputs:
66
CONCURRENCY:
77
required: true
88
type: string
9-
SAVE_PY_DOCS:
10-
required: false
11-
type: boolean
12-
default: false
13-
SAVE_PY_DOCS_AS:
14-
required: false
15-
type: string
16-
default: ""
17-
SAVE_RUST_DOCS:
18-
required: false
19-
type: boolean
20-
default: false
21-
PR_NUMBER:
22-
required: false
23-
type: string
24-
default: ""
25-
ALL_CHECKS:
26-
required: false
27-
type: boolean
28-
default: false
299

3010
concurrency:
3111
group: ${{ inputs.CONCURRENCY }}-checks
@@ -154,100 +134,6 @@ jobs:
154134
run: |
155135
pixi run codegen --force --check
156136
157-
rs-lints:
158-
name: Rust lints (fmt, check, cranky, tests, doc)
159-
runs-on: ubuntu-latest-16-cores
160-
container:
161-
image: rerunio/ci_docker:0.11.0
162-
env:
163-
RUSTC_WRAPPER: "sccache"
164-
steps:
165-
- uses: actions/checkout@v4
166-
with:
167-
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || '' }}
168-
169-
- name: Set up Rust
170-
uses: ./.github/actions/setup-rust
171-
with:
172-
cache_key: "build-linux"
173-
save_cache: true
174-
workload_identity_provider: ${{ secrets.GOOGLE_WORKLOAD_IDENTITY_PROVIDER }}
175-
service_account: ${{ secrets.GOOGLE_SERVICE_ACCOUNT }}
176-
177-
# We need to build the web viewer for `rust_checks.py` to succeed.
178-
- name: Build web-viewer (release)
179-
uses: actions-rs/cargo@v1
180-
with:
181-
command: run
182-
# We build in release so that we can reuse the results for actual publishing, if necessary
183-
args: --locked -p re_build_web_viewer -- --release
184-
185-
- name: Rust checks & tests
186-
if: ${{ !inputs.ALL_CHECKS }}
187-
run: ./scripts/ci/rust_checks.py --skip-check-individual-crates
188-
189-
- name: Rust all checks & tests
190-
if: inputs.ALL_CHECKS
191-
run: ./scripts/ci/rust_checks.py
192-
193-
# ---------------------------------------------------------------------------
194-
195-
rs-check-wasm:
196-
name: Check Rust web build (wasm32 + wasm-bindgen)
197-
runs-on: ubuntu-latest-16-cores
198-
container:
199-
image: rerunio/ci_docker:0.11.0
200-
env:
201-
RUSTC_WRAPPER: "sccache"
202-
steps:
203-
- uses: actions/checkout@v4
204-
with:
205-
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || '' }}
206-
207-
- name: Set up Rust
208-
uses: ./.github/actions/setup-rust
209-
with:
210-
cache_key: "build-web"
211-
save_cache: true
212-
workload_identity_provider: ${{ secrets.GOOGLE_WORKLOAD_IDENTITY_PROVIDER }}
213-
service_account: ${{ secrets.GOOGLE_SERVICE_ACCOUNT }}
214-
215-
- name: clippy check re_viewer wasm32
216-
shell: bash
217-
run: ./scripts/clippy_wasm.sh
218-
219-
- name: Check re_renderer examples wasm32
220-
uses: actions-rs/cargo@v1
221-
with:
222-
command: check
223-
args: --locked --target wasm32-unknown-unknown --target-dir target_wasm -p re_renderer --examples
224-
225-
- name: Build web-viewer (release)
226-
uses: actions-rs/cargo@v1
227-
with:
228-
command: run
229-
# We build in release so that we can reuse the results for actual publishing, if necessary
230-
args: --locked -p re_build_web_viewer -- --release
231-
232-
# ---------------------------------------------------------------------------
233-
234-
toml-lints:
235-
name: Lint TOML files
236-
runs-on: ubuntu-latest
237-
steps:
238-
- uses: actions/checkout@v4
239-
with:
240-
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || '' }}
241-
242-
- uses: prefix-dev/setup-pixi@v0.4.1
243-
with:
244-
pixi-version: v0.13.0
245-
246-
- name: Taplo check
247-
shell: bash
248-
run: |
249-
pixi run lint-taplo
250-
251137
# ---------------------------------------------------------------------------
252138

253139
misc-rerun-lints:
@@ -312,38 +198,6 @@ jobs:
312198

313199
# ---------------------------------------------------------------------------
314200

315-
rs-cargo-deny:
316-
name: Cargo Deny
317-
runs-on: ubuntu-latest
318-
container:
319-
image: rerunio/ci_docker:0.11.0
320-
steps:
321-
- uses: actions/checkout@v4
322-
with:
323-
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || '' }}
324-
325-
- name: Cargo Deny
326-
shell: bash
327-
id: expected_version
328-
run: ./scripts/ci/cargo_deny.sh
329-
330-
# ---------------------------------------------------------------------------
331-
332-
cpp-formatting:
333-
name: C++ formatting check
334-
runs-on: ubuntu-latest
335-
steps:
336-
- uses: actions/checkout@v4
337-
with:
338-
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || '' }}
339-
340-
- name: Run clang format on all relevant files
341-
uses: jidicula/clang-format-action@v4.11.0
342-
with:
343-
clang-format-version: "16"
344-
# Only check c/cpp/h/hpp (default checks also .proto and others)
345-
include-regex: ^.*\.(c|cpp|h|hpp)$
346-
347201
misc-formatting:
348202
name: Misc formatting
349203
runs-on: ubuntu-latest

.github/workflows/reusable_checks_cpp.yml

+15
Original file line numberDiff line numberDiff line change
@@ -91,3 +91,18 @@ jobs:
9191
${{ matrix.extra_env_vars }} RERUN_WERROR=ON pixi run cpp-build-all
9292
${{ matrix.extra_env_vars }} RERUN_WERROR=ON pixi run cpp-test
9393
${{ matrix.additional_commands }}
94+
95+
cpp-formatting:
96+
name: C++ formatting check
97+
runs-on: ubuntu-latest
98+
steps:
99+
- uses: actions/checkout@v4
100+
with:
101+
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || '' }}
102+
103+
- name: Run clang format on all relevant files
104+
uses: jidicula/clang-format-action@v4.11.0
105+
with:
106+
clang-format-version: "16"
107+
# Only check c/cpp/h/hpp (default checks also .proto and others)
108+
include-regex: ^.*\.(c|cpp|h|hpp)$

0 commit comments

Comments
 (0)