REL: systematically test source distribution in isolation before publication #192
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CD | |
on: | |
push: | |
tags: v* | |
pull_request: | |
paths: | |
- .github/workflows/cd.yml | |
- README.md | |
- pyproject.toml | |
- lib/inifix/pyproject.toml | |
- conftest.py | |
- lib/inifix/tests/conftest.py | |
jobs: | |
pre-publish-checks: | |
runs-on: ubuntu-latest | |
name: pre-publication checks | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
fetch-depth: 0 | |
- uses: astral-sh/setup-uv@4db96194c378173c656ce18a155ffc14a9fc4355 # v5.2.2 | |
- run: uv run scripts/pre_publish_checks.py | |
build: | |
name: Build artifacts | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Source | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- uses: astral-sh/setup-uv@4db96194c378173c656ce18a155ffc14a9fc4355 # v5.2.2 | |
- name: Build distributions | |
shell: bash -l {0} | |
run: uv build --package inifix | |
- uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0 | |
with: | |
name: artifacts | |
path: dist | |
test-sdist: | |
name: Test source distribution | |
needs: [build] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Source | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- uses: astral-sh/setup-uv@4db96194c378173c656ce18a155ffc14a9fc4355 # v5.2.2 | |
- run: uv sync --only-group test | |
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 | |
with: | |
name: artifacts | |
path: dist | |
- name: test source distribution in isolation | |
run: | | |
tar xzf dist/*.tar.gz | |
cd inifix-* | |
uv pip install . | |
uv run --no-project pytest | |
pypi-publish: | |
name: Publish | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') | |
needs: [pre-publish-checks, test-sdist] | |
runs-on: ubuntu-latest | |
environment: | |
name: pypi | |
url: https://pypi.org/p/inifix | |
permissions: | |
id-token: write | |
steps: | |
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 | |
with: | |
pattern: dist | |
- name: Publish package distributions to PyPI | |
uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4 |