Skip to content

2.7.3

2.7.3 #19

Workflow file for this run

name: CI and PyPI publication
on:
push:
branches: [main]
pull_request:
release:
types: [published]
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}
cancel-in-progress: false
jobs:
checks:
name: Python ${{ matrix.python }} and JavaScript
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
python: ["3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python }}
- uses: actions/setup-node@v7
with:
node-version: "24"
- name: Install test dependencies
run: python -m pip install ".[test,test-outputs]" mypy
- name: Check types
run: mypy
- name: Python tests
# Starlette 0.49.3 uses an AnyIO alias deprecated in newer AnyIO.
# Keep other warnings fatal, as required by pyproject.toml.
run: >-
python -m pytest tests/unit tests/integration -m "not package"
--ignore=tests/integration/test_js_suite.py
--ignore=tests/integration/test_docs_snippets.py
--deselect=tests/unit/test_public_api.py::test_public_signature_matches_the_one_written_in_the_docs
--deselect=tests/integration/test_source_hygiene.py::test_a_retired_promise_appears_nowhere_outside_its_history
--deselect=tests/integration/test_source_hygiene.py::test_every_allowed_historical_document_still_exists
-W "ignore:The anyio.abc.BlockingPortal alias is deprecated:DeprecationWarning"
- name: JavaScript tests
run: node --test "tests/js/*.test.mjs"
- name: Install browser
if: matrix.python == '3.13'
run: |
python -m pip install playwright
python -m playwright install --with-deps chromium
- name: Browser tests
if: matrix.python == '3.13'
run: >-
python -m pytest tests/e2e
-W "ignore:The anyio.abc.BlockingPortal alias is deprecated:DeprecationWarning"
build:
name: Build distributions
needs: checks
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: "3.13"
- name: Check release tag matches package version
if: github.event_name == 'release'
env:
RELEASE_TAG: ${{ github.event.release.tag_name }}
run: |
python - <<'PY'
import ast
import os
from pathlib import Path
tree = ast.parse(Path("src/func_to_web/config.py").read_text())
version = next(
ast.literal_eval(node.value)
for node in tree.body
if isinstance(node, ast.Assign)
and any(isinstance(target, ast.Name) and target.id == "__version__"
for target in node.targets)
)
expected = f"v{version}"
if os.environ["RELEASE_TAG"] != expected:
raise SystemExit(f"Release tag must be {expected}")
PY
- name: Build and validate metadata
run: |
python -m pip install build twine
python -m build
python -m twine check --strict dist/*
- uses: actions/upload-artifact@v7
with:
name: distributions
path: dist/*
if-no-files-found: error
publish:
name: Publish to PyPI
if: github.event_name == 'release'
needs: build
runs-on: ubuntu-latest
timeout-minutes: 10
environment:
name: pypi
url: https://pypi.org/project/func-to-web/
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v8
with:
name: distributions
path: dist/
- name: Publish with Trusted Publishing
uses: pypa/gh-action-pypi-publish@release/v1