From 55d40e1addb395fc5bf0c0d450a59c2e5b6c2692 Mon Sep 17 00:00:00 2001 From: Adam Dangoor Date: Sun, 6 Oct 2024 17:09:29 +0100 Subject: [PATCH 1/2] Use setup-uv GitHub Action --- .github/workflows/ci.yml | 21 +++++++-------------- .github/workflows/release.yml | 13 +++++-------- 2 files changed, 12 insertions(+), 22 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a61542d..2839be2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,26 +23,19 @@ jobs: steps: - uses: actions/checkout@v4 - - name: "Set up Python" - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - # We do not use the cache action as uv is faster than the cache action. - - name: "Install dependencies" - run: | - curl -LsSf https://astral.sh/uv/install.sh | sh - uv pip install --system --upgrade --editable .[dev] + - name: Install uv + uses: astral-sh/setup-uv@v3 - name: "Lint" - run: | - pre-commit run --all-files --hook-stage commit --verbose - pre-commit run --all-files --hook-stage push --verbose - pre-commit run --all-files --hook-stage manual --verbose + run: | + uv run --all-extras --python=${{ matrix.python-version }} pre-commit run --all-files --hook-stage commit --verbose + uv run --all-extras --python=${{ matrix.python-version }} pre-commit run --all-files --hook-stage push --verbose + uv run --all-extras --python=${{ matrix.python-version }} pre-commit run --all-files --hook-stage manual --verbose - name: "Run tests" run: | - pytest -s -vvv --cov-fail-under 100 --cov=src/ --cov=tests . --cov-report=xml + uv run --all-extras --python=${{ matrix.python-version }} pytest -s -vvv --cov-fail-under 100 --cov=src/ --cov=tests . --cov-report=xml - name: "Upload coverage to Codecov" uses: "codecov/codecov-action@v4" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a24d5da..c38a38a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -31,10 +31,8 @@ jobs: # https://github.com/stefanzweifel/git-auto-commit-action?tab=readme-ov-file#push-to-protected-branches token: ${{ secrets.RELEASE_PAT }} - - name: "Set up Python" - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} + - name: Install uv + uses: astral-sh/setup-uv@v3 - name: "Calver calculate version" uses: StephaneBour/actions-calver@master @@ -77,12 +75,11 @@ jobs: - name: Build a binary wheel and a source tarball run: | - # Checkout the latest tag - the one we just created. git fetch --tags git checkout ${{ steps.tag_version.outputs.new_tag }} - python -m pip install build check-wheel-contents - python -m build --sdist --wheel --outdir dist/ . - check-wheel-contents dist/*.whl + uv run pip install build check-wheel-contents + uv run python -m build --sdist --wheel --outdir dist/ . + uv run check-wheel-contents dist/*.whl # We use PyPI trusted publishing rather than a PyPI API token. # See https://github.com/pypa/gh-action-pypi-publish/tree/release/v1/?tab=readme-ov-file#trusted-publishing. From 4ca94e7085ffa8c8b075cd1ee2e45c1c74df4fb2 Mon Sep 17 00:00:00 2001 From: Adam Dangoor Date: Sun, 6 Oct 2024 17:12:05 +0100 Subject: [PATCH 2/2] Fix indentation --- .github/workflows/ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2839be2..dc99b7c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,10 +28,10 @@ jobs: uses: astral-sh/setup-uv@v3 - name: "Lint" - run: | - uv run --all-extras --python=${{ matrix.python-version }} pre-commit run --all-files --hook-stage commit --verbose - uv run --all-extras --python=${{ matrix.python-version }} pre-commit run --all-files --hook-stage push --verbose - uv run --all-extras --python=${{ matrix.python-version }} pre-commit run --all-files --hook-stage manual --verbose + run: | + uv run --all-extras --python=${{ matrix.python-version }} pre-commit run --all-files --hook-stage commit --verbose + uv run --all-extras --python=${{ matrix.python-version }} pre-commit run --all-files --hook-stage push --verbose + uv run --all-extras --python=${{ matrix.python-version }} pre-commit run --all-files --hook-stage manual --verbose - name: "Run tests" run: |