Skip to content

Commit 7165f23

Browse files
Extract reusable test workflow and trigger on pull_request only
- Extract common test steps into test-suite.yaml reusable workflow - Change test trigger from push to pull_request to avoid unnecessary CI runs on branch pushes and tag pushes - Weekly schedule trigger retained for periodic master validation Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 8c3be28 commit 7165f23

File tree

2 files changed

+68
-128
lines changed

2 files changed

+68
-128
lines changed

.github/workflows/test-suite.yaml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Test Suite
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
test-type:
7+
required: true
8+
type: string
9+
10+
permissions:
11+
id-token: write
12+
contents: read
13+
14+
jobs:
15+
run:
16+
runs-on: ubuntu-latest
17+
18+
env:
19+
TEST_TYPE: ${{ inputs.test-type }}
20+
AWS_DEFAULT_REGION: us-west-2
21+
AWS_ATHENA_S3_STAGING_DIR: s3://laughingman7743-pyathena/github/
22+
AWS_ATHENA_WORKGROUP: pyathena
23+
AWS_ATHENA_SPARK_WORKGROUP: pyathena-spark
24+
AWS_ATHENA_MANAGED_WORKGROUP: pyathena-managed
25+
26+
strategy:
27+
fail-fast: false
28+
matrix:
29+
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14']
30+
31+
steps:
32+
- name: Checkout
33+
uses: actions/checkout@v4
34+
35+
- uses: astral-sh/setup-uv@v5
36+
with:
37+
python-version: ${{ matrix.python-version }}
38+
enable-cache: true
39+
# TODO: In the case of Python 3.13+, the following error occurs, so install Python using setup-python.
40+
# ../meson.build:44:2: ERROR: Problem encountered: Cannot compile
41+
# `Python.h`. Perhaps you need to install python-dev|python-devel
42+
- uses: actions/setup-python@v5
43+
with:
44+
python-version: ${{ matrix.python-version }}
45+
if: matrix.python-version == '3.13' || matrix.python-version == '3.14'
46+
- run: |
47+
make tool
48+
49+
- name: Configure AWS credentials
50+
uses: aws-actions/configure-aws-credentials@v4
51+
with:
52+
role-to-assume: arn:aws:iam::676287850544:role/github-actions-oidc-pyathena
53+
role-session-name: PyAthenaTestSession
54+
aws-region: ${{ env.AWS_DEFAULT_REGION }}
55+
56+
- name: Test
57+
run: |
58+
make tox

.github/workflows/test.yaml

Lines changed: 10 additions & 128 deletions
Original file line numberDiff line numberDiff line change
@@ -1,142 +1,24 @@
11
name: Test
22

33
on:
4-
push:
4+
pull_request:
55
schedule:
66
- cron: '0 0 * * 0'
77

8-
permissions:
9-
id-token: write
10-
contents: read
11-
128
jobs:
139
test:
14-
runs-on: ubuntu-latest
15-
16-
env:
17-
TEST_TYPE: pyathena
18-
AWS_DEFAULT_REGION: us-west-2
19-
AWS_ATHENA_S3_STAGING_DIR: s3://laughingman7743-pyathena/github/
20-
AWS_ATHENA_WORKGROUP: pyathena
21-
AWS_ATHENA_SPARK_WORKGROUP: pyathena-spark
22-
AWS_ATHENA_MANAGED_WORKGROUP: pyathena-managed
23-
24-
strategy:
25-
fail-fast: false
26-
matrix:
27-
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14']
28-
29-
steps:
30-
- name: Checkout
31-
uses: actions/checkout@v4
32-
33-
- uses: astral-sh/setup-uv@v5
34-
with:
35-
python-version: ${{ matrix.python-version }}
36-
enable-cache: true
37-
# TODO: In the case of Python 3.13+, the following error occurs, so install Python using setup-python.
38-
# ../meson.build:44:2: ERROR: Problem encountered: Cannot compile
39-
# `Python.h`. Perhaps you need to install python-dev|python-devel
40-
- uses: actions/setup-python@v5
41-
with:
42-
python-version: ${{ matrix.python-version }}
43-
if: matrix.python-version == '3.13' || matrix.python-version == '3.14'
44-
- run: |
45-
make tool
46-
47-
- name: Configure AWS credentials
48-
uses: aws-actions/configure-aws-credentials@v4
49-
with:
50-
role-to-assume: arn:aws:iam::676287850544:role/github-actions-oidc-pyathena
51-
role-session-name: PyAthenaTestSession
52-
aws-region: ${{ env.AWS_DEFAULT_REGION }}
53-
54-
- name: Test
55-
run: |
56-
make tox
10+
uses: ./.github/workflows/test-suite.yaml
11+
with:
12+
test-type: pyathena
5713

5814
test-sqla:
5915
needs: [test]
60-
runs-on: ubuntu-latest
61-
62-
env:
63-
TEST_TYPE: sqla
64-
AWS_DEFAULT_REGION: us-west-2
65-
AWS_ATHENA_S3_STAGING_DIR: s3://laughingman7743-pyathena/github/
66-
AWS_ATHENA_WORKGROUP: pyathena
67-
AWS_ATHENA_SPARK_WORKGROUP: pyathena-spark
68-
AWS_ATHENA_MANAGED_WORKGROUP: pyathena-managed
69-
70-
strategy:
71-
fail-fast: false
72-
matrix:
73-
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14']
74-
75-
steps:
76-
- name: Checkout
77-
uses: actions/checkout@v4
78-
79-
- uses: astral-sh/setup-uv@v5
80-
with:
81-
python-version: ${{ matrix.python-version }}
82-
enable-cache: true
83-
- uses: actions/setup-python@v5
84-
with:
85-
python-version: ${{ matrix.python-version }}
86-
if: matrix.python-version == '3.13' || matrix.python-version == '3.14'
87-
- run: |
88-
make tool
89-
90-
- name: Configure AWS credentials
91-
uses: aws-actions/configure-aws-credentials@v4
92-
with:
93-
role-to-assume: arn:aws:iam::676287850544:role/github-actions-oidc-pyathena
94-
role-session-name: PyAthenaTestSession
95-
aws-region: ${{ env.AWS_DEFAULT_REGION }}
96-
97-
- name: Test
98-
run: |
99-
make tox
16+
uses: ./.github/workflows/test-suite.yaml
17+
with:
18+
test-type: sqla
10019

10120
test-sqla-async:
10221
needs: [test-sqla]
103-
runs-on: ubuntu-latest
104-
105-
env:
106-
TEST_TYPE: sqla_async
107-
AWS_DEFAULT_REGION: us-west-2
108-
AWS_ATHENA_S3_STAGING_DIR: s3://laughingman7743-pyathena/github/
109-
AWS_ATHENA_WORKGROUP: pyathena
110-
AWS_ATHENA_SPARK_WORKGROUP: pyathena-spark
111-
AWS_ATHENA_MANAGED_WORKGROUP: pyathena-managed
112-
113-
strategy:
114-
fail-fast: false
115-
matrix:
116-
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14']
117-
118-
steps:
119-
- name: Checkout
120-
uses: actions/checkout@v4
121-
122-
- uses: astral-sh/setup-uv@v5
123-
with:
124-
python-version: ${{ matrix.python-version }}
125-
enable-cache: true
126-
- uses: actions/setup-python@v5
127-
with:
128-
python-version: ${{ matrix.python-version }}
129-
if: matrix.python-version == '3.13' || matrix.python-version == '3.14'
130-
- run: |
131-
make tool
132-
133-
- name: Configure AWS credentials
134-
uses: aws-actions/configure-aws-credentials@v4
135-
with:
136-
role-to-assume: arn:aws:iam::676287850544:role/github-actions-oidc-pyathena
137-
role-session-name: PyAthenaTestSession
138-
aws-region: ${{ env.AWS_DEFAULT_REGION }}
139-
140-
- name: Test
141-
run: |
142-
make tox
22+
uses: ./.github/workflows/test-suite.yaml
23+
with:
24+
test-type: sqla_async

0 commit comments

Comments
 (0)