Move scenario sync script to top-level scripts (#2788)

Same idea as https://github.com/astral-sh/uv/pull/2787
This commit is contained in:
Zanie Blue 2024-04-02 18:27:05 -05:00 committed by GitHub
parent 4838c4da0a
commit 20d4762776
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 13 additions and 12 deletions

36
scripts/sync_scenarios.sh Executable file
View file

@ -0,0 +1,36 @@
#!/usr/bin/env bash
#
# Sync test scenarios with the pinned version of packse.
#
# Usage:
#
# Install the pinned packse version in a temporary virtual environment, fetch scenarios, and regenerate test cases and snapshots:
#
# $ ./scripts/scenarios/sync.sh
#
# Additional arguments are passed to `./scripts/scenarios/generate.py`, for example:
#
# $ ./scripts/scenarios/sync.sh --verbose --no-snapshot-update
#
# For development purposes, the `./scripts/scenarios/generate.py` script can be used directly to generate
# test cases from a local set of scenarios.
set -eu
script_root="$(realpath "$(dirname "$0")")"
cd "$script_root/scenarios"
echo "Setting up a temporary environment..."
uv venv
source ".venv/bin/activate"
uv pip install -r requirements.txt --refresh-package packse
echo "Fetching packse scenarios..."
packse fetch --dest "$script_root/scenarios/.downloads" --force
python "$script_root/scenarios/generate.py" "$script_root/scenarios/.downloads" "$@"
# Cleanup
rm -r "$script_root/scenarios/.downloads"