File tree 2 files changed +40
-1
lines changed
2 files changed +40
-1
lines changed Original file line number Diff line number Diff line change @@ -34,8 +34,11 @@ Browse through [`ARCHITECTURE.md`](ARCHITECTURE.md) to get a sense of how all pi
34
34
You can test your code locally by running ` ./scripts/check.sh ` .
35
35
There are snapshots test that might need to be updated.
36
36
Run the tests with ` UPDATE_SNAPSHOTS=true cargo test --workspace --all-features ` to update all of them.
37
+ If CI keeps complaining about snapshots (which could happen if you don't use macOS, snapshots in CI are currently
38
+ rendered with macOS), you can instead run ` ./scripts/update_snapshots_from_ci.sh ` to update your local snapshots from
39
+ the last CI run of your PR (which will download the ` test_results ` artefact).
37
40
For more info about the tests see [ egui_kittest] ( ./crates/egui_kittest/README.md ) .
38
- Snapshots and other big files are stored with git lfs. See [ Working with lfs] ( #working-with-lfs ) for more info.
41
+ Snapshots and other big files are stored with git lfs. See [ Working with git lfs] ( #working-with-git -lfs ) for more info.
39
42
If you see an ` InvalidSignature ` error when running snapshot tests, it's probably a problem related to git-lfs.
40
43
41
44
When you have something that works, open a draft PR. You may get some helpful feedback early!
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+ # This script searches for the last CI run with your branch name, downloads the test_results artefact
3
+ # and replaces your existing snapshots with the new ones.
4
+ # Make sure you have the gh cli installed and authenticated before running this script.
5
+
6
+ set -eu
7
+
8
+ BRANCH=$( git rev-parse --abbrev-ref HEAD)
9
+
10
+ RUN_ID=$( gh run list --branch " $BRANCH " --workflow " Rust" --json databaseId -q ' .[0].databaseId' )
11
+
12
+ ECHO " Downloading test results from run $RUN_ID from branch $BRANCH "
13
+
14
+ # remove any existing .new.png that might have been left behind
15
+ find . -type d -path " */tests/snapshots*" | while read dir; do
16
+ find " $dir " -type f -name " *.new.png" | while read file; do
17
+ rm " $file "
18
+ done
19
+ done
20
+
21
+
22
+ gh run download " $RUN_ID " --name " test-results" --dir tmp_artefacts
23
+
24
+ # move the snapshots to the correct location, overwriting the existing ones
25
+ rsync -a tmp_artefacts/ .
26
+
27
+ rm -r tmp_artefacts
28
+
29
+ # rename the .new.png files to .png
30
+ find . -type d -path " */tests/snapshots*" | while read dir; do
31
+ find " $dir " -type f -name " *.new.png" | while read file; do
32
+ mv -f " $file " " ${file% .new.png} .png"
33
+ done
34
+ done
35
+
36
+ echo " Done!"
You can’t perform that action at this time.
0 commit comments