File tree 3 files changed +27
-3
lines changed
3 files changed +27
-3
lines changed Original file line number Diff line number Diff line change
1
+ name : Snapshot tests
2
+ on :
3
+ pull_request
4
+
5
+ env :
6
+ # renovate: datasource=github-tags depName=rust lookupName=rust-lang/rust
7
+ RUST_VERSION : 1.85.1
8
+
9
+ jobs :
10
+ snapshot-tests :
11
+ runs-on : ubuntu-latest
12
+ if : contains(github.event.pull_request.body, 'RUN_SNAPSHOT_TESTS')
13
+ steps :
14
+ - uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
15
+ - run : rustup override set ${{ env.RUST_VERSION }}
16
+ - uses : Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6 # v2.7.8
17
+
18
+ - run : git fetch --depth 2
19
+ - run : git checkout origin/master
20
+ - name : Generate good snapshots
21
+ run : INSTA_OUTPUT=none INSTA_UPDATE=always cargo test -- --include-ignored
22
+ - run : git checkout $GITHUB_SHA # merge of master+branch
23
+ - run : cargo test -- --include-ignored
Original file line number Diff line number Diff line change @@ -60,8 +60,9 @@ release = true # (to be only used for official posts about Rust releases announc
60
60
61
61
If you're making changes to how the site is generated, you may want to check the impact your changes have on the output.
62
62
For this purpose, there is a setup to do snapshot testing over the entire output directory.
63
- It's not run in CI, because the number of snapshots is too large.
64
- But you can run these tests locally as needed.
63
+
64
+ To run these tests in CI, add the string ` RUN_SNAPSHOT_TESTS ` to the PR description.
65
+ You can also run these tests locally for a faster feedback cycle:
65
66
66
67
- Make sure you have [ cargo-insta] ( https://insta.rs/docs/quickstart/ ) installed.
67
68
Original file line number Diff line number Diff line change @@ -305,7 +305,7 @@ pub fn main() -> eyre::Result<()> {
305
305
306
306
#[ test]
307
307
fn snapshot ( ) {
308
- std:: fs:: remove_dir_all ( concat ! ( env!( "CARGO_MANIFEST_DIR" ) , "/site" ) ) . unwrap ( ) ;
308
+ let _ = std:: fs:: remove_dir_all ( concat ! ( env!( "CARGO_MANIFEST_DIR" ) , "/site" ) ) ;
309
309
main ( ) . unwrap ( ) ;
310
310
let timestamped_files = [ "releases.json" , "feed.xml" ] ;
311
311
let inexplicably_non_deterministic_files = [ "images/2023-08-rust-survey-2022/experiences.png" ] ;
You can’t perform that action at this time.
0 commit comments