chore(deps): update pypa/gh-action-pypi-publish action to v1.11.0 #2482
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Run Checks | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
merge_group: | |
jobs: | |
test: | |
strategy: | |
matrix: | |
python: [ "3.8", "3.9", "3.10", "3.11", "3.12", "3.13" ] | |
os: [ ubuntu-latest, macos-latest, windows-latest ] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4.2.2 | |
- name: Set up Python | |
uses: actions/setup-python@v5.3.0 | |
with: | |
python-version: ${{ matrix.python }} | |
- name: Get Python Version | |
id: get_python_version | |
run: echo "python_version=$(python --version)" >> $GITHUB_OUTPUT | |
shell: bash | |
- name: Cache dependencies | |
uses: actions/cache@v4 | |
with: | |
path: .venv | |
key: ${{ runner.os }}-${{ steps.get_python_version.outputs.python_version }}-dependencies-${{ hashFiles('**/pdm.lock') }} | |
restore-keys: | | |
${{ runner.os }}-${{ steps.get_python_version.outputs.python_version }}-dependencies | |
- name: Install PDM | |
run: pip install pdm | |
- name: Install Dependencies | |
run: pdm install | |
- name: Check formatting | |
run: pdm run ruff format . --check | |
- name: Run mypy | |
run: pdm mypy --show-error-codes | |
- name: Lint | |
run: pdm run ruff check . | |
- name: Run pytest without coverage | |
if: matrix.os != 'ubuntu-latest' | |
run: pdm test | |
env: | |
TASKIPY: true | |
- name: Run pytest with coverage | |
if: matrix.os == 'ubuntu-latest' | |
run: pdm test_with_coverage | |
env: | |
TASKIPY: true | |
- run: mv .coverage .coverage.${{ matrix.python }} | |
if: matrix.os == 'ubuntu-latest' | |
- name: Store coverage report | |
uses: actions/upload-artifact@v4.4.3 | |
if: matrix.os == 'ubuntu-latest' | |
with: | |
name: coverage-${{ matrix.python }} | |
path: .coverage.${{ matrix.python }} | |
if-no-files-found: error | |
include-hidden-files: true | |
coverage: | |
name: Combine & check coverage | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4.2.2 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
- name: Download coverage reports | |
uses: actions/download-artifact@v4.1.8 | |
with: | |
merge-multiple: true | |
- name: Create Virtual Environment | |
run: python -m venv .venv | |
- name: Combine coverage & fail if it's <100%. | |
run: | | |
# Install coverage | |
.venv/bin/pip install --upgrade coverage[toml] | |
# Find all of the downloaded coverage reports and combine them | |
.venv/bin/python -m coverage combine | |
# Create html report | |
.venv/bin/python -m coverage html --skip-covered --skip-empty | |
# Report in Markdown and write to summary. | |
.venv/bin/python -m coverage report --format=markdown >> $GITHUB_STEP_SUMMARY | |
# Report again and fail if under 100%. | |
.venv/bin/python -m coverage report --fail-under=100 | |
- name: Upload HTML report if check failed. | |
uses: actions/upload-artifact@v4.4.3 | |
with: | |
name: html-report | |
path: htmlcov | |
if: ${{ failure() }} | |
integration: | |
name: Integration Tests | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
httpx_version: | |
- "0.20.0" | |
- "" | |
services: | |
openapi-test-server: | |
image: ghcr.io/openapi-generators/openapi-test-server:0.0.1 | |
ports: | |
- "3000:3000" | |
steps: | |
- uses: actions/checkout@v4.2.2 | |
- name: Set up Python | |
uses: actions/setup-python@v5.3.0 | |
with: | |
python-version: "3.8" | |
- name: Get Python Version | |
id: get_python_version | |
run: echo "python_version=$(python --version)" >> $GITHUB_OUTPUT | |
- name: Cache dependencies | |
uses: actions/cache@v4 | |
with: | |
path: .venv | |
key: ${{ runner.os }}-${{ steps.get_python_version.outputs.python_version }}-dependencies-${{ hashFiles('**/pdm.lock') }} | |
restore-keys: | | |
${{ runner.os }}-${{ steps.get_python_version.outputs.python_version }}-dependencies | |
- name: Install dependencies | |
run: | | |
pip install pdm | |
python -m venv .venv | |
pdm install | |
- name: Cache Generated Client Dependencies | |
uses: actions/cache@v4 | |
with: | |
path: integration-tests/.venv | |
key: ${{ runner.os }}-${{ steps.get_python_version.outputs.python_version }}-integration-dependencies-${{ hashFiles('**/pdm.lock') }} | |
restore-keys: | | |
${{ runner.os }}-${{ steps.get_python_version.outputs.python_version }}-integration-dependencies | |
- name: Set httpx version | |
if: matrix.httpx_version != '' | |
run: | | |
cd integration-tests | |
pdm add httpx==${{ matrix.httpx_version }} | |
- name: Install Integration Dependencies | |
run: | | |
cd integration-tests | |
pdm install | |
- name: Run Tests | |
run: | | |
cd integration-tests | |
pdm run pytest | |
pdm run mypy . --strict |