Skip to content

Commit

Permalink
chore: Check uv version
Browse files Browse the repository at this point in the history
  • Loading branch information
aborgna-q committed Nov 21, 2024
1 parent b2d569b commit a99ec91
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .github/check_uv.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash
# Ensure that the `uv` command is available and meets the minimum version requirement.

# Desired minimum version
MIN_VERSION="0.4.27"

# Get the version of `uv`
UV_VERSION=$(uv --version | awk '{print $2}')

# Function to compare versions
version_ge() {
# Returns 0 (true) if $1 >= $2
[ "$(printf '%s\n' "$1" "$2" | sort -V | head -n 1)" == "$2" ]
}

# Compare versions
if version_ge "$UV_VERSION" "$MIN_VERSION"; then
echo "uv version $UV_VERSION meets the minimum requirement ($MIN_VERSION)."
else
echo "uv version $UV_VERSION does not meet the minimum requirement ($MIN_VERSION)."
echo "Please upgrade uv by running `uv self update`, or by following the instructions in your package manager."
exit 1
fi
1 change: 1 addition & 0 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ To setup the environment manually you will need:

- Just: [just.systems](https://just.systems/)
- uv `>=0.4.27`: [docs.astral.sh](https://docs.astral.sh/uv/getting-started/installation/)
* If you have an older manually installed `uv` version, you can upgrade it with `uv self update`.

The extended test suite has additional requirements. These are **optional**; tests that require them will be skipped if they are not installed.

Expand Down
2 changes: 2 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ setup-extras:

# Run the pre-commit checks.
check:
# Ensure that the uv version is supported
./.github/check_uv.sh
uv run pre-commit run --all-files

# Compile integration test binaries.
Expand Down

0 comments on commit a99ec91

Please sign in to comment.