Skip to content

Commit

Permalink
CI: Use 'uv tool run' for build and twine (#101)
Browse files Browse the repository at this point in the history
* Use the astral-sh/setup-uv GitHub Action to setup the latest uv.
   - This GitHub Action can be left unpinned as it should be updated
     regularly.
* Use 'uv tool run --from build pyproject-build' to run build as the PyPI
  project name is 'build' but the executable it provides is named
  'pyproject-build'.
* Use 'uv tool run twine' to run twine.
* c.f. https://docs.astral.sh/uv/reference/cli/#uv-tool-run
  • Loading branch information
matthewfeickert authored Sep 30, 2024
1 parent 9d888d2 commit 459d161
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,15 @@ jobs:
with:
python-version: '3.x'

- name: Install python-build and twine
run: |
python -m pip install --upgrade pip
python -m pip install build twine
python -m pip list
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v3

- name: Build v0.0.1 wheel and sdist
run: |
python -m build --outdir ./dist _action_path/tests/test_package
uv tool run --from build pyproject-build --installer=uv --outdir ./dist _action_path/tests/test_package
- name: Verify the distribution
run: twine check --strict dist/*
run: uv tool run twine check --strict dist/*

- name: List contents of sdist
run: python -m tarfile --list dist/test_package-*.tar.gz
Expand All @@ -67,7 +64,7 @@ jobs:
# Bump version to avoid wheel name conflicts
sed -i 's/0.0.1/0.0.2/g' _action_path/tests/test_package/pyproject.toml
rm ./dist/*
python -m build --outdir ./dist _action_path/tests/test_package
uv tool run --from build pyproject-build --installer=uv --outdir ./dist _action_path/tests/test_package
- name: Test upload with non-main label
uses: ./_action_path/
Expand All @@ -81,7 +78,7 @@ jobs:
# Bump version to avoid wheel name conflicts
sed -i 's/0.0.2/0.0.3/g' _action_path/tests/test_package/pyproject.toml
rm ./dist/*
python -m build --outdir ./dist _action_path/tests/test_package
uv tool run --from build pyproject-build --installer=uv --outdir ./dist _action_path/tests/test_package
- name: Test upload with multiple labels
uses: ./_action_path/
Expand Down

0 comments on commit 459d161

Please sign in to comment.