From a2eb20acf406a0e603ba37b562f1878c562e2c86 Mon Sep 17 00:00:00 2001 From: laughingman7743 Date: Sun, 27 Sep 2026 12:13:39 +0900 Subject: [PATCH 1/2] Run pull-request AWS tests on the newest Python version only The changes job now also selects the Python versions: pull requests test the newest supported version, and the weekly schedule and manual dispatch test every version. test-suite.yaml takes the versions as a required python-versions input instead of a fixed matrix. Closes #850 Co-Authored-By: Claude Opus 5.5 --- .github/workflows/test-suite.yaml | 6 +++++- .github/workflows/test.yaml | 24 ++++++++++++++++++------ docs/testing.md | 12 ++++++------ 3 files changed, 29 insertions(+), 13 deletions(-) diff --git a/.github/workflows/test-suite.yaml b/.github/workflows/test-suite.yaml index d71771f6..1c1c0702 100644 --- a/.github/workflows/test-suite.yaml +++ b/.github/workflows/test-suite.yaml @@ -13,6 +13,10 @@ on: test-type: required: true type: string + python-versions: + description: JSON array of the Python versions to test + required: true + type: string max-parallel: description: Maximum number of Python versions tested concurrently type: number @@ -55,7 +59,7 @@ jobs: fail-fast: false max-parallel: ${{ inputs.max-parallel }} matrix: - python-version: ['3.10', '3.11', '3.12', '3.13', '3.14'] + python-version: ${{ fromJSON(inputs.python-versions) }} steps: - name: Checkout diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 2a454c97..5289b2ec 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -56,11 +56,12 @@ jobs: tool: just - run: just lint - # Selects the AWS suites. Draft and external-fork pull requests run none. - # A ready pull request always runs the PyAthena suite; it runs the - # SQLAlchemy tests (the compliance suites and the PyAthena suite's + # Selects the AWS suites and Python versions. Draft and external-fork pull + # requests run none. A ready pull request always runs the PyAthena suite; it + # runs the SQLAlchemy tests (the compliance suites and the PyAthena suite's # SQLAlchemy tests) and the Spark tests only when their code, tests, - # dependencies, or this workflow change. + # dependencies, or this workflow change. Pull requests test the newest + # Python version only; the schedule and dispatch test every version. changes: if: >- github.event_name != 'pull_request' || @@ -72,6 +73,7 @@ jobs: outputs: sqla: ${{ steps.filter.outputs.sqla }} spark: ${{ steps.filter.outputs.spark }} + python-versions: ${{ steps.filter.outputs.python-versions }} steps: - id: filter env: @@ -79,12 +81,19 @@ jobs: EVENT_NAME: ${{ github.event_name }} REPO: ${{ github.repository }} PR_NUMBER: ${{ github.event.pull_request.number }} + # Every supported version, oldest first; keep in sync with the + # pyproject.toml classifiers, which the Release workflow checks. + PYTHON_VERSIONS: '["3.10", "3.11", "3.12", "3.13", "3.14"]' run: | if [[ "$EVENT_NAME" != "pull_request" ]]; then - echo "sqla=true" >> "$GITHUB_OUTPUT" - echo "spark=true" >> "$GITHUB_OUTPUT" + { + echo "python-versions=$(jq -c '.' <<< "$PYTHON_VERSIONS")" + echo "sqla=true" + echo "spark=true" + } >> "$GITHUB_OUTPUT" exit 0 fi + echo "python-versions=$(jq -c '[last]' <<< "$PYTHON_VERSIONS")" >> "$GITHUB_OUTPUT" files=$(gh api "repos/$REPO/pulls/$PR_NUMBER/files" --paginate --jq '.[].filename') printf 'Changed files:\n%s\n' "$files" shared='^(\.github/workflows/test(-suite)?\.yaml|justfile|pyproject\.toml|uv\.lock)$' @@ -108,6 +117,7 @@ jobs: uses: ./.github/workflows/test-suite.yaml with: test-type: pyathena + python-versions: ${{ needs.changes.outputs.python-versions }} skip-spark: ${{ needs.changes.outputs.spark != 'true' }} skip-sqla: ${{ needs.changes.outputs.sqla != 'true' }} @@ -117,6 +127,7 @@ jobs: uses: ./.github/workflows/test-suite.yaml with: test-type: sqla + python-versions: ${{ needs.changes.outputs.python-versions }} test-sqla-async: needs: changes @@ -124,3 +135,4 @@ jobs: uses: ./.github/workflows/test-suite.yaml with: test-type: sqla_async + python-versions: ${{ needs.changes.outputs.python-versions }} diff --git a/docs/testing.md b/docs/testing.md index f8205400..e7d5e404 100644 --- a/docs/testing.md +++ b/docs/testing.md @@ -151,11 +151,11 @@ Sanitize logs before sharing them. The Test workflow runs for pull requests that change files other than `docs/` and Markdown. It runs the offline checks (`just lint`) on each of them, including Drafts and external forks, and runs the AWS suites as follows: -| Trigger | PyAthena suite | SQLAlchemy tests | Spark tests | -| --- | --- | --- | --- | -| Draft pull request | No | No | No | -| Ready pull request from a branch of this repository | Yes | When related files change | When related files change | -| Weekly schedule and manual dispatch | Yes | Yes | Yes | +| Trigger | PyAthena suite | SQLAlchemy tests | Spark tests | Python versions | +| --- | --- | --- | --- | --- | +| Draft pull request | No | No | No | None | +| Ready pull request from a branch of this repository | Yes | When related files change | When related files change | Newest supported | +| Weekly schedule and manual dispatch | Yes | Yes | Yes | All supported | The SQLAlchemy tests are the compliance suites and the PyAthena suite's `tests/pyathena/sqlalchemy/` and `tests/pyathena/aio/sqlalchemy/`. The Spark tests are the PyAthena suite's `tests/pyathena/spark/` and `tests/pyathena/aio/spark/`. @@ -164,7 +164,7 @@ For the SQLAlchemy tests, the related files are `pyathena/sqlalchemy/`, `pyathen For the Spark tests, they are `pyathena/spark/`, `pyathena/aio/spark/`, and their PyAthena suite test directories. Changes to `pyproject.toml`, `uv.lock`, `justfile`, or the Test workflows run both. For a pull request from a branch of this repository that still changes files other than `docs/` and Markdown, marking the Draft ready for review starts the AWS jobs, and converting it back to Draft cancels AWS jobs still running. -To run every suite on a branch, dispatch the workflow: +To run every suite on every supported Python version on a branch, dispatch the workflow: ```bash gh workflow run test.yaml --ref From 738d64cf0939592ef4f395eb2a15c379689242de Mon Sep 17 00:00:00 2001 From: laughingman7743 Date: Sun, 27 Sep 2026 18:07:42 +0900 Subject: [PATCH 2/2] Drop the release-gate reference from the Python versions comment Co-Authored-By: Claude Opus 5.5 --- .github/workflows/test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 5289b2ec..22f3433b 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -82,7 +82,7 @@ jobs: REPO: ${{ github.repository }} PR_NUMBER: ${{ github.event.pull_request.number }} # Every supported version, oldest first; keep in sync with the - # pyproject.toml classifiers, which the Release workflow checks. + # pyproject.toml classifiers. PYTHON_VERSIONS: '["3.10", "3.11", "3.12", "3.13", "3.14"]' run: | if [[ "$EVENT_NAME" != "pull_request" ]]; then