feat: add SSH agent authentication #2
Workflow file for this run
This file contains hidden or 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: Publish to PyPI | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: pypi-publish | |
| cancel-in-progress: false | |
| jobs: | |
| build: | |
| name: Test and build distributions | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 60 | |
| steps: | |
| - name: Check out tagged source | |
| uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 | |
| - name: Set up Python 3.12 | |
| uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6 | |
| with: | |
| python-version: "3.12" | |
| - name: Install test, integration, and build dependencies | |
| run: python -m pip install --editable '.[dev]' 'pg-stand>=0.2.1,<1' | |
| - name: Verify tag matches package version | |
| shell: bash | |
| run: | | |
| package_version="$(python -c 'import tomllib; print(tomllib.load(open("pyproject.toml", "rb"))["project"]["version"])')" | |
| if [[ "${GITHUB_REF_NAME}" != "v${package_version}" ]]; then | |
| echo "Tag ${GITHUB_REF_NAME} does not match package version ${package_version}" >&2 | |
| exit 1 | |
| fi | |
| - name: Run quality gates | |
| run: | | |
| ruff check . | |
| ruff format --check . | |
| python -m pytest -q | |
| - name: Run PostgreSQL 18 pg_stand integration | |
| env: | |
| PG_PERF_BENCH_PG_STAND_INTEGRATION: "1" | |
| PG_STAND_BIN: pg-stand | |
| PYTHONDONTWRITEBYTECODE: "1" | |
| run: python -m pytest -q -m integration tests/integration/test_pg_stand_smoke.py | |
| - name: Build wheel and source distribution | |
| run: python -m build | |
| - name: Check distribution metadata and README rendering | |
| run: python -m twine check dist/* | |
| - name: Smoke-test built wheel | |
| shell: bash | |
| run: | | |
| python -m venv "${RUNNER_TEMP}/pg-perf-bench-wheel-smoke" | |
| "${RUNNER_TEMP}/pg-perf-bench-wheel-smoke/bin/python" -m pip install dist/*.whl | |
| "${RUNNER_TEMP}/pg-perf-bench-wheel-smoke/bin/pg-perf-bench" validate | |
| "${RUNNER_TEMP}/pg-perf-bench-wheel-smoke/bin/pg-perf-bench" \ | |
| --machine --component-capabilities | |
| - name: Upload distributions for publishing | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 | |
| with: | |
| name: python-distributions | |
| path: dist/ | |
| if-no-files-found: error | |
| retention-days: 7 | |
| publish: | |
| name: Publish distributions to PyPI | |
| needs: build | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 15 | |
| environment: | |
| name: pypi | |
| url: https://pypi.org/p/pg-perf-bench | |
| permissions: | |
| id-token: write | |
| steps: | |
| - name: Download distributions | |
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8 | |
| with: | |
| name: python-distributions | |
| path: dist/ | |
| - name: Publish distributions with trusted publishing | |
| uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # release/v1 |