Skip to content

Update astral-sh/setup-uv action to v7 #509

Update astral-sh/setup-uv action to v7

Update astral-sh/setup-uv action to v7 #509

Workflow file for this run

name: Build
env:
PYTHON_VERSION: "3.12"
on:
push:
branches:
- main
pull_request:
types:
- opened
- reopened
- synchronize
- labeled
branches:
- main
permissions: {}
jobs:
build-and-publish:
name: Publish test release
runs-on: ubuntu-latest
outputs:
build-version: ${{ steps.build.outputs.version }}
if: github.ref == 'refs/heads/main' || contains(github.event.pull_request.labels.*.name, 'test-build')
steps:
- uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
with:
persist-credentials: false
fetch-depth: 0
- uses: astral-sh/setup-uv@803947b9bd8e9f986429fa0c5a41c367cd732b41 # v7.2.1
- name: Publish to Test PyPI
id: build
env:
UV_PUBLISH_TOKEN: ${{ secrets.TEST_PYPI_API_TOKEN }}
run: | # zizmor: ignore[use-trusted-publishing]
version=$(./scripts/version dev)
echo "version=$version" >> $GITHUB_OUTPUT
sed -i -e "s/0.0.0/$version/" pyproject.toml
uv build
uv publish --publish-url https://test.pypi.org/legacy/
test-install:
# We test the install on a clean machine to avoid poetry behavior attempting to
# install the project root when it is checked out
name: Test install
runs-on: ubuntu-latest
needs: build-and-publish
timeout-minutes: 5
steps:
- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
with:
python-version: "${{ env.PYTHON_VERSION }}"
- uses: astral-sh/setup-uv@803947b9bd8e9f986429fa0c5a41c367cd732b41 # v7.2.1
- name: Wait for package to be available
run: >
until
curl --silent "https://test.pypi.org/simple/packse/"
| grep --quiet "${BUILD_VERSION}";
do sleep 10;
done
&&
sleep 180
env:
BUILD_VERSION: ${{ needs.build-and-publish.outputs.build-version }}
# We sleep for an additional 180 seconds as it seems to take a bit longer for
# the package to be consistently available
# Note: The above will not sleep forever due to the job level timeout
- name: Install release from Test PyPI
run: |
uv pip install \
--system \
--extra-index-url https://test.pypi.org/simple/ \
--index-strategy unsafe-best-match \
packse==${BUILD_VERSION}
env:
BUILD_VERSION: ${{ needs.build-and-publish.outputs.build-version }}
- name: Check release version
run: |
installed=$(python3 -c "from importlib.metadata import version; print(version('packse'))")
test $installed = ${BUILD_VERSION}
env:
BUILD_VERSION: ${{ needs.build-and-publish.outputs.build-version }}
- name: Check CLI help
run: |
packse --help