Skip to content

Commit 2c5e4cc

Browse files
lucasmerlinemilk
andauthored
Add kittest snapshot tests (#71)
* [x] I have followed the instructions in the PR template --------- Co-authored-by: Emil Ernerfeldt <[email protected]>
1 parent 1990f2a commit 2c5e4cc

23 files changed

+335
-36
lines changed

.gitattributes

+2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
* text=auto eol=lf
22
Cargo.lock linguist-generated=false
3+
4+
*.png filter=lfs diff=lfs merge=lfs -text

.github/workflows/rust.yml

+33-19
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727

2828
- name: Install packages (Linux)
2929
if: runner.os == 'Linux'
30-
uses: awalsh128/[email protected].2
30+
uses: awalsh128/[email protected].3
3131
with:
3232
packages: libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libxkbcommon-dev libssl-dev libgtk-3-dev # libgtk-3-dev is used by rfd
3333
version: 1.0
@@ -63,12 +63,6 @@ jobs:
6363
command: check
6464
args: --no-default-features --lib --all-targets
6565

66-
- name: Test doc-tests
67-
uses: actions-rs/cargo@v1
68-
with:
69-
command: test
70-
args: --doc --all-features
71-
7266
- name: cargo doc --lib
7367
uses: actions-rs/cargo@v1
7468
with:
@@ -81,18 +75,6 @@ jobs:
8175
command: doc
8276
args: --document-private-items --no-deps --all-features
8377

84-
- name: Build tests
85-
uses: actions-rs/cargo@v1
86-
with:
87-
command: test
88-
args: --all-features --no-run
89-
90-
- name: Run test
91-
uses: actions-rs/cargo@v1
92-
with:
93-
command: test
94-
args: --all-features
95-
9678
- name: Clippy
9779
uses: actions-rs/cargo@v1
9880
with:
@@ -158,3 +140,35 @@ jobs:
158140
run: wget -qO- https://github.com/thedodd/trunk/releases/latest/download/trunk-x86_64-unknown-linux-gnu.tar.gz | tar -xzf-
159141
- name: Build
160142
run: cd demo && ../trunk build
143+
144+
# ---------------------------------------------------------------------------
145+
146+
tests:
147+
name: Run tests
148+
# We run the tests on macOS because it will run with an actual GPU,
149+
# which is needed by the egui_kittest snapshot tests.
150+
runs-on: macos-latest
151+
152+
steps:
153+
- uses: actions/checkout@v4
154+
with:
155+
lfs: true
156+
- uses: dtolnay/rust-toolchain@master
157+
with:
158+
toolchain: 1.81.0
159+
160+
- name: Set up cargo cache
161+
uses: Swatinem/rust-cache@v2
162+
163+
- name: Run tests
164+
run: cargo test --all-features
165+
166+
- name: Run doc-tests
167+
run: cargo test --all-features --doc
168+
169+
- name: Upload artifacts
170+
uses: actions/upload-artifact@v4
171+
if: always()
172+
with:
173+
name: test-results
174+
path: "**/tests/snapshots"

.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,9 @@ target_wasm
1111

1212
# https://github.com/lycheeverse/lychee
1313
.lycheecache
14+
15+
16+
# kittest
17+
**/tests/snapshots/**/*.diff.png
18+
**/tests/snapshots/**/*.new.png
19+
**/tests/snapshots/**/*.old.png

0 commit comments

Comments
 (0)