Skip to content

Commit b9f14a4

Browse files
authored
Upload snapshot test results as artifact (#9282)
### What Makes it easier to debug failing snapshots in CI. See here for an example of a failed run: https://github.com/rerun-io/rerun/actions/runs/13853649550/job/38765622419?pr=9282 Click the "Upload test results" section to get a download link
1 parent 7dab48b commit b9f14a4

File tree

3 files changed

+30
-0
lines changed

3 files changed

+30
-0
lines changed

.github/workflows/contrib_checks.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,13 @@ jobs:
132132
- name: Rust checks & tests
133133
run: pixi run rs-check --skip individual_crates docs_slow
134134

135+
- name: Upload test results
136+
uses: actions/upload-artifact@v4
137+
if: always()
138+
with:
139+
name: test-results-ubuntu
140+
path: "**/tests/snapshots"
141+
135142
rerun-lints:
136143
name: Rerun lints
137144
runs-on: ubuntu-latest

.github/workflows/reusable_checks_rust.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,13 @@ jobs:
107107
# See tests/assets/rrd/README.md for more
108108
run: pixi run check-backwards-compatibility
109109

110+
- name: Upload test results
111+
uses: actions/upload-artifact@v4
112+
if: always()
113+
with:
114+
name: test-results-ubuntu
115+
path: "**/tests/snapshots"
116+
110117
# Run some basics tests on Mac and Windows
111118
mac-windows-tests:
112119
name: Test on ${{ matrix.name }}
@@ -160,3 +167,10 @@ jobs:
160167
- name: Rust all checks & tests
161168
if: ${{ inputs.CHANNEL == 'nightly' }}
162169
run: pixi run rs-check
170+
171+
- name: Upload test results
172+
uses: actions/upload-artifact@v4
173+
if: always()
174+
with:
175+
name: test-results-${{ matrix.name }}
176+
path: "**/tests/snapshots"

scripts/ci/rust_checks.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,11 +282,17 @@ def docs_slow(results: list[Result]) -> None:
282282
results.append(run_cargo("doc", "--document-private-items --no-deps --all-features -p rerun"))
283283

284284

285+
test_failure_message = 'See the "Upload test results" step for a link to the snapshot test artifact.'
286+
287+
285288
def tests(results: list[Result]) -> None:
286289
# We first use `--no-run` to measure the time of compiling vs actually running
287290
results.append(run_cargo("test", "--all-targets --all-features --no-run"))
288291
results.append(run_cargo("nextest", "run --all-targets --all-features"))
289292

293+
if not results[-1].success:
294+
print(test_failure_message)
295+
290296
# Cargo nextest doesn't support doc tests yet, run those separately.
291297
results.append(run_cargo("test", "--all-features --doc"))
292298

@@ -296,6 +302,9 @@ def tests_without_all_features(results: list[Result]) -> None:
296302
results.append(run_cargo("test", "--all-targets --no-run"))
297303
results.append(run_cargo("nextest", "run --all-targets"))
298304

305+
if not results[-1].success:
306+
print(test_failure_message)
307+
299308

300309
if __name__ == "__main__":
301310
main()

0 commit comments

Comments
 (0)