Allow snapshots to be updated from failures in CI (#18424)

Persists snapshots as artifacts on test failure in CI and adds a script
to apply them locally

```
❯ ./scripts/apply-ci-snapshots.sh
Found pull request #18424 for branch 'zb/ci-snapshots'...
Found latest CI run 23022983761
Downloading pending snapshot artifacts...
Downloaded 3 artifacts
Applying 2 snapshot changes...
accepted:
  crates/uv/tests/it/pip_install.rs:13679 (transitive_dependency_config_settings_invalidation-2)
  crates/uv/tests/it/python_install.rs:1694 (python_install_default-5)
```

We infer the target run via the `gh` CLI. You may also provide the run
ID directly.

We'll merge snapshot artifacts from multiple platforms, so if there are
platform-specific failures on both Linux and Windows we'll apply both.
This commit is contained in:
Zanie Blue
2026-03-12 17:13:28 -05:00
committed by GitHub
parent dd0d76cd83
commit 273d29b8f2
4 changed files with 151 additions and 1 deletions
+39
View File
@@ -98,6 +98,9 @@ jobs:
UV_INTERNAL__TEST_NOCOW_FS: /tmpfs
UV_INTERNAL__TEST_ALT_FS: /tmpfs
UV_INTERNAL__TEST_LOWLINKS_FS: /minix
# Write pending snapshots to a separate directory for artifact upload
INSTA_UPDATE: new
INSTA_PENDING_DIR: ${{ github.workspace }}/pending-snapshots
run: |
cargo nextest run \
--cargo-profile fast-build \
@@ -105,6 +108,16 @@ jobs:
--workspace \
--profile ci-linux
- name: "Upload pending snapshots"
if: ${{ failure() }}
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: pending-snapshots-linux
path: pending-snapshots/
if-no-files-found: ignore
include-hidden-files: true
retention-days: 14
cargo-test-macos:
timeout-minutes: 20
# Only run macOS tests on main without opt-in
@@ -151,6 +164,9 @@ jobs:
# HFS+ RAM disk does not support copy-on-write and is on a different device
UV_INTERNAL__TEST_NOCOW_FS: ${{ env.HFS_MOUNT }}
UV_INTERNAL__TEST_ALT_FS: ${{ env.HFS_MOUNT }}
# Write pending snapshots to a separate directory for artifact upload
INSTA_UPDATE: new
INSTA_PENDING_DIR: ${{ github.workspace }}/pending-snapshots
run: |
cargo nextest run \
--cargo-profile fast-build \
@@ -159,6 +175,16 @@ jobs:
--workspace \
--profile ci-macos
- name: "Upload pending snapshots"
if: ${{ failure() }}
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: pending-snapshots-macos
path: pending-snapshots/
if-no-files-found: ignore
include-hidden-files: true
retention-days: 14
cargo-test-windows:
timeout-minutes: 15
runs-on: github-windows-2025-x86_64-16
@@ -216,6 +242,9 @@ jobs:
UV_LINK_MODE: copy
RUST_BACKTRACE: 1
UV_INTERNAL__TEST_LOWLINKS_FS: "C:\\uv"
# Write pending snapshots to a separate directory for artifact upload
INSTA_UPDATE: new
INSTA_PENDING_DIR: ${{ github.workspace }}/pending-snapshots
shell: bash
run: |
cargo nextest run \
@@ -225,3 +254,13 @@ jobs:
--workspace \
--profile ci-windows \
--partition hash:${{ matrix.partition }}/3
- name: "Upload pending snapshots"
if: ${{ failure() }}
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: pending-snapshots-windows-${{ matrix.partition }}
path: pending-snapshots/
if-no-files-found: ignore
include-hidden-files: true
retention-days: 14