mirror of
https://github.com/astral-sh/ruff-action.git
synced 2026-08-08 02:07:02 +00:00
feat: support uv.lock as version-file (#379)
Adds `uv.lock` as a supported `version-file` format, alongside the existing `pyproject.toml` and `requirements.txt`. A `uv.lock` pins the exact resolved ruff version, so reading it gives a reproducible install that matches the project's lockfile — the single source of truth — instead of the lower-bound / range typically declared in `pyproject.toml`. The parser reads the `[[package]]` entry whose `name` is `ruff` and returns its `version`. If ruff is absent or the file cannot be parsed, the action warns and falls back to `latest` (same behaviour as the other formats). Validation: - `npm run all` — tsc typecheck clean, biome clean, dist rebuilt, jest 65/65 pass - Added unit tests (`__tests__/version/file-parser.test.ts`) + a `uv.lock` fixture - Added an integration job (`test-default-version-from-uv-lock`) that runs the action against the fixture and asserts ruff 0.9.5 is installed closes #375
This commit is contained in:
@@ -280,6 +280,25 @@ jobs:
|
||||
fi
|
||||
env:
|
||||
RUFF_VERSION: ${{ steps.ruff-action.outputs.ruff-version }}
|
||||
test-default-version-from-uv-lock:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Use default version from uv.lock
|
||||
id: ruff-action
|
||||
uses: ./
|
||||
with:
|
||||
src: __tests__/fixtures/python-project
|
||||
version-file: __tests__/fixtures/uv.lock
|
||||
- name: Correct version gets installed
|
||||
run: |
|
||||
if [ "$RUFF_VERSION" != "0.9.5" ]; then
|
||||
exit 1
|
||||
fi
|
||||
env:
|
||||
RUFF_VERSION: ${{ steps.ruff-action.outputs.ruff-version }}
|
||||
test-semver-range:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
@@ -501,6 +520,7 @@ jobs:
|
||||
- test-default-version-from-pyproject-optional-dependencies
|
||||
- test-default-version-from-requirements
|
||||
- test-default-version-from-requirements-with-hash
|
||||
- test-default-version-from-uv-lock
|
||||
- test-semver-range
|
||||
- test-pep440-version-specifier
|
||||
- test-checksum
|
||||
|
||||
Reference in New Issue
Block a user