Skip to content

Commit e32cde6

Browse files
authored
Merge pull request #1100 from python-openapi/feature/integrations-separate-ci-workflows
Integrations separate CI workflows
2 parents 0dd125f + 66973df commit e32cde6

File tree

6 files changed

+164
-25
lines changed

6 files changed

+164
-25
lines changed

.github/workflows/build-docs.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
name: Build documentation
1+
name: CI / Docs
22

33
on:
44
push:
55
pull_request:
66
types: [opened, synchronize]
77

88
jobs:
9-
build:
9+
docs_build:
10+
name: "Build"
1011
runs-on: ubuntu-latest
1112
steps:
1213
- uses: actions/checkout@v6
@@ -18,7 +19,7 @@ jobs:
1819

1920
- name: Get full Python version
2021
id: full-python-version
21-
run: echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))")
22+
run: python -c "import sys; print(f\"version={'-'.join(str(v) for v in sys.version_info)}\")" >> "$GITHUB_OUTPUT"
2223

2324
- name: Set up poetry
2425
uses: Gr1N/setup-poetry@v9
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
name: CI / Integrations / Tests
2+
3+
on:
4+
push:
5+
pull_request:
6+
types: [opened, synchronize]
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref }}
10+
cancel-in-progress: true
11+
12+
permissions:
13+
contents: read
14+
id-token: write
15+
16+
jobs:
17+
integration_matrix:
18+
name: "${{ matrix.target.label }} / py${{ matrix.python-version }}"
19+
runs-on: ubuntu-latest
20+
strategy:
21+
matrix:
22+
target:
23+
- integration: aiohttp
24+
spec: ">=3.8,<4.0"
25+
label: "aiohttp-3.x"
26+
- integration: aiohttp
27+
spec: ">=3.11,<4.0"
28+
label: "aiohttp-3.11+"
29+
- integration: django
30+
spec: ">=4.0,<5.0"
31+
label: "django-4.x"
32+
- integration: django
33+
spec: ">=5.0,<6.0"
34+
label: "django-5.x"
35+
- integration: falcon
36+
spec: ">=4.0,<5.0"
37+
label: "falcon-4.x"
38+
- integration: fastapi
39+
spec: ">=0.111,<0.120"
40+
label: "fastapi-0.11x"
41+
- integration: fastapi
42+
spec: ">=0.120,<0.129"
43+
label: "fastapi-0.12x"
44+
- integration: flask
45+
spec: ">=2.0,<3.0"
46+
label: "flask-2.x"
47+
- integration: flask
48+
spec: ">=3.0,<4.0"
49+
label: "flask-3.x"
50+
- integration: requests
51+
spec: ""
52+
label: "requests-default"
53+
- integration: starlette
54+
spec: ">=0.40.0,<0.50.0"
55+
label: "starlette-0.4x"
56+
- integration: starlette
57+
spec: ">=0.50.0,<0.60.0"
58+
label: "starlette-0.5x"
59+
- integration: werkzeug
60+
spec: ""
61+
label: "werkzeug-default"
62+
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
63+
fail-fast: false
64+
steps:
65+
- uses: actions/checkout@v6
66+
67+
- name: Set up Python ${{ matrix.python-version }}
68+
uses: actions/setup-python@v6
69+
with:
70+
python-version: ${{ matrix.python-version }}
71+
72+
- name: Get full Python version
73+
id: full-python-version
74+
run: python -c "import sys; print(f\"version={'-'.join(str(v) for v in sys.version_info)}\")" >> "$GITHUB_OUTPUT"
75+
76+
- name: Set up poetry
77+
uses: Gr1N/setup-poetry@v9
78+
with:
79+
poetry-version: "2.3.1"
80+
81+
- name: Configure poetry
82+
run: poetry config virtualenvs.in-project true
83+
84+
- name: Set up cache
85+
uses: actions/cache@v5
86+
id: cache
87+
with:
88+
path: .venv
89+
key: venv-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }}
90+
91+
- name: Ensure cache is healthy
92+
if: steps.cache.outputs.cache-hit == 'true'
93+
run: timeout 10s poetry run pip --version || rm -rf .venv
94+
95+
- name: Install dependencies
96+
run: poetry install --all-extras
97+
98+
- name: Install framework variant
99+
if: matrix.target.spec != ''
100+
run: poetry run pip install "${{ matrix.target.integration }}${{ matrix.target.spec }}"
101+
102+
- name: Test
103+
env:
104+
PYTEST_ADDOPTS: "--color=yes"
105+
run: poetry run pytest tests/integration/contrib/${{ matrix.target.integration }}
106+
107+
- name: Upload coverage
108+
uses: codecov/codecov-action@v5
109+
with:
110+
flags: integration,${{ matrix.target.integration }},${{ matrix.target.label }},py${{ matrix.python-version }}
111+
name: integration-${{ matrix.target.integration }}-${{ matrix.target.label }}-py${{ matrix.python-version }}

.github/workflows/python-publish.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# This workflow will upload a Python Package using Twine when a release is created
22
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
33

4-
name: Publish python packages
4+
name: CI / Publish
55

66
on:
77
workflow_dispatch:
@@ -10,7 +10,8 @@ on:
1010
- published
1111

1212
jobs:
13-
publish:
13+
publish_pypi:
14+
name: "PyPI"
1415
runs-on: ubuntu-latest
1516
permissions:
1617
id-token: write

.github/workflows/python-test.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
22
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
33

4-
name: Test python code
4+
name: CI / Core / Tests
55

66
on:
77
push:
88
pull_request:
99
types: [opened, synchronize]
1010

1111
jobs:
12-
test:
13-
name: "Tests"
12+
core_tests:
13+
name: "py${{ matrix.python-version }}"
1414
runs-on: ubuntu-latest
1515
strategy:
1616
matrix:
@@ -26,7 +26,7 @@ jobs:
2626

2727
- name: Get full Python version
2828
id: full-python-version
29-
run: echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))")
29+
run: python -c "import sys; print(f\"version={'-'.join(str(v) for v in sys.version_info)}\")" >> "$GITHUB_OUTPUT"
3030

3131
- name: Set up poetry
3232
uses: Gr1N/setup-poetry@v9
@@ -53,7 +53,7 @@ jobs:
5353
- name: Test
5454
env:
5555
PYTEST_ADDOPTS: "--color=yes"
56-
run: poetry run pytest
56+
run: poetry run pytest --ignore=tests/integration/contrib
5757

5858
- name: Static type check
5959
run: poetry run mypy
@@ -64,8 +64,8 @@ jobs:
6464
- name: Upload coverage
6565
uses: codecov/codecov-action@v5
6666

67-
static-checks:
68-
name: "Static checks"
67+
static_checks:
68+
name: "Core / Static Checks"
6969
runs-on: ubuntu-latest
7070
steps:
7171
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
@@ -78,7 +78,7 @@ jobs:
7878

7979
- name: Get full Python version
8080
id: full-python-version
81-
run: echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))")
81+
run: python -c "import sys; print(f\"version={'-'.join(str(v) for v in sys.version_info)}\")" >> "$GITHUB_OUTPUT"
8282

8383
- name: Set up poetry
8484
uses: Gr1N/setup-poetry@v9

0 commit comments

Comments
 (0)