-
Notifications
You must be signed in to change notification settings - Fork 113
Run AWS test suites only on ready pull requests and related changes #837
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
99948ec
44fab01
7787388
1ec4635
46d3c52
2c3588b
87aacab
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,14 +9,21 @@ name: Test | |
|
|
||
| on: | ||
| pull_request: | ||
| # ready_for_review starts the AWS jobs for a pull request leaving Draft; | ||
| # converted_to_draft starts a run without them, which cancels an | ||
| # in-progress run through the concurrency group. paths-ignore applies to | ||
| # both, so a pull request that now changes only docs starts neither. | ||
| types: [opened, synchronize, reopened, ready_for_review, converted_to_draft] | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Independent review (relayed): Codex, via the Claude Code
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Repair self-review, both perspectives, for 7787388 (range
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Independent follow-up (relayed): Codex, via the Claude Code
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Independent follow-up 2 (relayed): Codex, via the Claude Code
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Independent follow-up 3 (relayed): Codex, via the Claude Code
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Independent follow-up 4 (relayed): Codex, via the Claude Code |
||
| paths-ignore: | ||
| - 'docs/**' | ||
| - '**.md' | ||
| # The scheduled run executes every suite, including the ones that pull | ||
| # requests only run when related files change. | ||
| schedule: | ||
| - cron: '0 0 * * 0' | ||
| # Allows refreshing the README status badge on demand: the badge reflects | ||
| # the latest run on the default branch, which is otherwise only the weekly | ||
| # scheduled run and stays red for up to a week after a transient failure. | ||
| # Runs every suite on the selected branch: before a release, on demand for | ||
| # a pull request, and to refresh the README status badge after a transient | ||
| # failure on the default branch. | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
|
|
@@ -29,20 +36,91 @@ concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| # The three suites create their own schemas and tables, so they run in | ||
| # parallel; each is still a separate job for "Re-run failed jobs". | ||
| jobs: | ||
| # Offline checks run for every event, including Draft and fork pull requests. | ||
| lint: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
| with: | ||
| persist-credentials: false | ||
| - uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7.6.0 | ||
| with: | ||
| python-version: '3.12' | ||
| enable-cache: true | ||
| - uses: taiki-e/install-action@7a79fe8c3a13344501c80d99cae481c1c9085912 # v2.81.10 | ||
| with: | ||
| 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 | ||
| # SQLAlchemy tests) and the Spark tests only when their code, tests, | ||
| # dependencies, or this workflow change. | ||
| changes: | ||
| if: >- | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Self-review round one (implementation behavior): FINDINGS, repaired
|
||
| github.event_name != 'pull_request' || | ||
| (!github.event.pull_request.draft && | ||
| github.event.pull_request.head.repo.full_name == github.repository) | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| pull-requests: read | ||
| outputs: | ||
| sqla: ${{ steps.filter.outputs.sqla }} | ||
| spark: ${{ steps.filter.outputs.spark }} | ||
| steps: | ||
| - id: filter | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| EVENT_NAME: ${{ github.event_name }} | ||
| REPO: ${{ github.repository }} | ||
| PR_NUMBER: ${{ github.event.pull_request.number }} | ||
| run: | | ||
| if [[ "$EVENT_NAME" != "pull_request" ]]; then | ||
| echo "sqla=true" >> "$GITHUB_OUTPUT" | ||
| echo "spark=true" >> "$GITHUB_OUTPUT" | ||
| exit 0 | ||
| fi | ||
| 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)$' | ||
| sqla="$shared|^pyathena/(aio/)?sqlalchemy/|^tests/sqlalchemy/|^tests/pyathena/(aio/)?sqlalchemy/|^setup\.cfg$" | ||
| spark="$shared|^pyathena/(aio/)?spark/|^tests/pyathena/(aio/)?spark/" | ||
| if grep -qE "$sqla" <<< "$files"; then | ||
| echo "sqla=true" >> "$GITHUB_OUTPUT" | ||
| else | ||
| echo "sqla=false" >> "$GITHUB_OUTPUT" | ||
| fi | ||
| if grep -qE "$spark" <<< "$files"; then | ||
| echo "spark=true" >> "$GITHUB_OUTPUT" | ||
| else | ||
| echo "spark=false" >> "$GITHUB_OUTPUT" | ||
| fi | ||
|
|
||
| # The three suites create their own schemas and tables, so they run in | ||
| # parallel; each is still a separate job for "Re-run failed jobs". | ||
| test: | ||
| needs: changes | ||
| uses: ./.github/workflows/test-suite.yaml | ||
| with: | ||
| test-type: pyathena | ||
| skip-spark: ${{ needs.changes.outputs.spark != 'true' }} | ||
| skip-sqla: ${{ needs.changes.outputs.sqla != 'true' }} | ||
|
|
||
| test-sqla: | ||
| needs: changes | ||
| if: needs.changes.outputs.sqla == 'true' | ||
| uses: ./.github/workflows/test-suite.yaml | ||
| with: | ||
| test-type: sqla | ||
|
|
||
| test-sqla-async: | ||
| needs: changes | ||
| if: needs.changes.outputs.sqla == 'true' | ||
| uses: ./.github/workflows/test-suite.yaml | ||
| with: | ||
| test-type: sqla_async | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -148,6 +148,28 @@ Sanitize logs before sharing them. | |
|
|
||
| ## GitHub Actions | ||
|
|
||
| The Test workflow runs for pull requests that change files other than `docs/` and Markdown. | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Self-review round two (claims and operational behavior): FINDINGS, repaired
|
||
| 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 | | ||
|
|
||
| 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/`. | ||
| When the SQLAlchemy or Spark tests do not run, the PyAthena suite runs without them. | ||
| For the SQLAlchemy tests, the related files are `pyathena/sqlalchemy/`, `pyathena/aio/sqlalchemy/`, `tests/sqlalchemy/`, their PyAthena suite test directories, and `setup.cfg`. | ||
| 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: | ||
|
|
||
| ```bash | ||
| gh workflow run test.yaml --ref <branch> | ||
| ``` | ||
|
|
||
| Project policy excludes external-fork pull requests from AWS integration CI. | ||
| Maintainers do not approve those jobs as a substitute for contributor testing. | ||
| Checks without AWS access may still run on a fork pull request. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -236,6 +236,7 @@ commands = | |
| sqla_async: just test sqla-async | ||
| passenv = | ||
| TOXENV | ||
| PYTEST_ADDOPTS | ||
| AWS_* | ||
| GITHUB_* | ||
| """ | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Self-review, both rounds, of the
skip-sqlachange requested by the maintainer (2c3588ba2ceacd15737a4f60af4a508ee66c246e..87aacabba94436acb6d30a39a2aae044ae5ac879): CLEANPYTEST_ADDOPTSis a folded scalar that joins the two conditional ignore groups. With both inputs false it is whitespace only, which pytest treats as no options (checked withPYTEST_ADDOPTS=' ': 1,889 tests collected).tests/pyathena/(aio/)spark/ortests/pyathena/(aio/)sqlalchemy/. Neither directory has aconftest.py, so ignoring them removes no shared fixtures.skip-sqlareuses thesqlaoutput, which now also matchestests/pyathena/(aio/)sqlalchemy/: editing those tests runs them, and also runs the compliance suites. This keeps a single SQLAlchemy trigger, as for Spark.test(pyathena) job receivesskip-sqla; the compliance jobs keep their job-levelif. actionlint andjust scriptspass.docs/testing.mdnow names the "SQLAlchemy tests" column and lists both parts and all trigger paths. It states that the PyAthena suite runs without the skipped directories.just docs lintpasses.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Independent follow-up (relayed): Codex, via the Claude Code
codex:codex-rescueagent (Codex thread01a0dc58-a3ed-7892-ad0b-91b3546dc52a), static review of2c3588b..87aacab: CLEAN.The reviewer checked:
PYTEST_ADDOPTSpropagation through the toxpassenvinto the pytest command;docs/testing.mdmatches the workflow.No builds or tests were run. Independent review is complete for head
87aacabba94436acb6d30a39a2aae044ae5ac879.