Skip to content

Commit ec777e7

Browse files
committed
feat: add reproducible benchmark orchestration
1 parent 92bbe48 commit ec777e7

88 files changed

Lines changed: 6623 additions & 362 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/publish.yml‎

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: Publish to PyPI
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
permissions:
9+
contents: read
10+
11+
concurrency:
12+
group: pypi-publish
13+
cancel-in-progress: false
14+
15+
jobs:
16+
build:
17+
name: Test and build distributions
18+
runs-on: ubuntu-24.04
19+
timeout-minutes: 60
20+
steps:
21+
- name: Check out tagged source
22+
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
23+
- name: Set up Python 3.12
24+
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6
25+
with:
26+
python-version: "3.12"
27+
- name: Install test, integration, and build dependencies
28+
run: python -m pip install --editable '.[dev]' 'pg-stand>=0.2.1,<1'
29+
- name: Verify tag matches package version
30+
shell: bash
31+
run: |
32+
package_version="$(python -c 'import tomllib; print(tomllib.load(open("pyproject.toml", "rb"))["project"]["version"])')"
33+
if [[ "${GITHUB_REF_NAME}" != "v${package_version}" ]]; then
34+
echo "Tag ${GITHUB_REF_NAME} does not match package version ${package_version}" >&2
35+
exit 1
36+
fi
37+
- name: Run quality gates
38+
run: |
39+
ruff check .
40+
ruff format --check .
41+
python -m pytest -q
42+
- name: Run PostgreSQL 18 pg_stand integration
43+
env:
44+
PG_PERF_BENCH_PG_STAND_INTEGRATION: "1"
45+
PG_STAND_BIN: pg-stand
46+
PYTHONDONTWRITEBYTECODE: "1"
47+
run: python -m pytest -q -m integration tests/integration/test_pg_stand_smoke.py
48+
- name: Build wheel and source distribution
49+
run: python -m build
50+
- name: Check distribution metadata and README rendering
51+
run: python -m twine check dist/*
52+
- name: Smoke-test built wheel
53+
shell: bash
54+
run: |
55+
python -m venv "${RUNNER_TEMP}/pg-perf-bench-wheel-smoke"
56+
"${RUNNER_TEMP}/pg-perf-bench-wheel-smoke/bin/python" -m pip install dist/*.whl
57+
"${RUNNER_TEMP}/pg-perf-bench-wheel-smoke/bin/pg-perf-bench" validate
58+
"${RUNNER_TEMP}/pg-perf-bench-wheel-smoke/bin/pg-perf-bench" \
59+
--machine --component-capabilities
60+
- name: Upload distributions for publishing
61+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
62+
with:
63+
name: python-distributions
64+
path: dist/
65+
if-no-files-found: error
66+
retention-days: 7
67+
68+
publish:
69+
name: Publish distributions to PyPI
70+
needs: build
71+
runs-on: ubuntu-24.04
72+
timeout-minutes: 15
73+
environment:
74+
name: pypi
75+
url: https://pypi.org/p/pg-perf-bench
76+
permissions:
77+
id-token: write
78+
steps:
79+
- name: Download distributions
80+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
81+
with:
82+
name: python-distributions
83+
path: dist/
84+
- name: Publish distributions with trusted publishing
85+
uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # release/v1

‎.github/workflows/tests.yml‎

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
name: tests
2+
3+
on:
4+
push:
5+
branches:
6+
- "**"
7+
pull_request:
8+
workflow_dispatch:
9+
10+
permissions:
11+
contents: read
12+
13+
concurrency:
14+
group: tests-${{ github.workflow }}-${{ github.ref }}
15+
cancel-in-progress: true
16+
17+
jobs:
18+
unit:
19+
runs-on: ubuntu-24.04
20+
strategy:
21+
matrix:
22+
python-version: ["3.10", "3.12"]
23+
steps:
24+
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
25+
- name: Check out the compatible pg_diag source
26+
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
27+
with:
28+
repository: O2eg/pg_diag
29+
path: .ci-components/pg_diag
30+
- uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6
31+
with:
32+
python-version: ${{ matrix.python-version }}
33+
- run: python -m pip install --editable .ci-components/pg_diag --editable '.[dev]'
34+
- run: ruff check --exclude .ci-components .
35+
- run: ruff format --check --exclude .ci-components .
36+
- run: python -m pytest -q
37+
38+
distribution:
39+
runs-on: ubuntu-24.04
40+
needs: unit
41+
steps:
42+
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
43+
- name: Check out the compatible pg_diag source
44+
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
45+
with:
46+
repository: O2eg/pg_diag
47+
path: .ci-components/pg_diag
48+
- uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6
49+
with:
50+
python-version: "3.12"
51+
- run: python -m pip install 'build>=1.2,<2' 'twine>=6,<7'
52+
- run: python -m build
53+
- run: python -m twine check dist/*
54+
- name: Smoke-test built wheel
55+
shell: bash
56+
run: |
57+
python -m venv "${RUNNER_TEMP}/pg-perf-bench-wheel-smoke"
58+
"${RUNNER_TEMP}/pg-perf-bench-wheel-smoke/bin/python" -m pip install \
59+
--editable .ci-components/pg_diag
60+
"${RUNNER_TEMP}/pg-perf-bench-wheel-smoke/bin/python" -m pip install dist/*.whl
61+
"${RUNNER_TEMP}/pg-perf-bench-wheel-smoke/bin/pg-perf-bench" --version
62+
"${RUNNER_TEMP}/pg-perf-bench-wheel-smoke/bin/pg-perf-bench" validate
63+
"${RUNNER_TEMP}/pg-perf-bench-wheel-smoke/bin/pg-perf-bench" \
64+
--machine --component-capabilities
65+
66+
postgres-18:
67+
if: github.event_name == 'workflow_dispatch'
68+
runs-on: ubuntu-24.04
69+
needs: unit
70+
timeout-minutes: 120
71+
steps:
72+
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
73+
- name: Check out the compatible pg_diag source
74+
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
75+
with:
76+
repository: O2eg/pg_diag
77+
path: .ci-components/pg_diag
78+
- name: Check out the compatible pg_stand source
79+
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
80+
with:
81+
repository: O2eg/pg_stand
82+
path: .ci-components/pg_stand
83+
- uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6
84+
with:
85+
python-version: "3.12"
86+
- run: |
87+
python -m pip install \
88+
--editable .ci-components/pg_diag \
89+
--editable .ci-components/pg_stand \
90+
--editable '.[dev]'
91+
- name: Run PostgreSQL 18 pg_stand integration
92+
env:
93+
PG_PERF_BENCH_PG_STAND_INTEGRATION: "1"
94+
PG_STAND_BIN: pg-stand
95+
PYTHONDONTWRITEBYTECODE: "1"
96+
run: python -m pytest -q -m integration tests/integration/test_pg_stand_smoke.py

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
/log/
33
/report/
44
/db_logs/
5+
/.ci-components/
56

67
# Python environments and caches
78
/venv/

0 commit comments

Comments
 (0)