Skip to content

feat: add deterministic orchestration lifecycle #1

feat: add deterministic orchestration lifecycle

feat: add deterministic orchestration lifecycle #1

Workflow file for this run

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-latest
timeout-minutes: 45
steps:
- name: Check out tagged source
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
- name: Set up Python 3.10
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6
with:
python-version: "3.10"
- name: Install test and build dependencies
run: python -m pip install --upgrade pip ".[dev]"
- name: Verify tag matches package version
shell: bash
run: |
package_version="$(
python - <<'PY'
try:
import tomllib
except ModuleNotFoundError:
import tomli as tomllib
with open("pyproject.toml", "rb") as stream:
print(tomllib.load(stream)["project"]["version"])
PY
)"
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 unit tests
run: |
ruff check .
ruff format --check .
python -m pytest -q -p no:cacheprovider
- name: Run PostgreSQL 18 integration
env:
WORKLOAD_DOCKER_INTEGRATION: "1"
PYTHONDONTWRITEBYTECODE: "1"
run: python -m pytest -q -p no:cacheprovider tests/test_docker_postgres18.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 the built wheel
shell: bash
run: |
python -m venv "${RUNNER_TEMP}/pg-workload-wheel-smoke"
"${RUNNER_TEMP}/pg-workload-wheel-smoke/bin/python" -m pip install dist/*.whl
"${RUNNER_TEMP}/pg-workload-wheel-smoke/bin/pg-workload" --version
"${RUNNER_TEMP}/pg-workload-wheel-smoke/bin/pg-workload" init \
--directory "${RUNNER_TEMP}/pg-workload-project"
"${RUNNER_TEMP}/pg-workload-wheel-smoke/bin/pg-workload" profiles \
--root "${RUNNER_TEMP}/pg-workload-project"
"${RUNNER_TEMP}/pg-workload-wheel-smoke/bin/pg-workload" validate \
--root "${RUNNER_TEMP}/pg-workload-project"
- 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-latest
timeout-minutes: 15
environment:
name: pypi
url: https://pypi.org/p/pg-workload
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