Skip to content

Test

Test #835

Workflow file for this run

name: Test
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
schedule:
- cron: "0 9 * * *"
concurrency:
group: test-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
lint-and-type:
name: Lint and type check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
with:
persist-credentials: false
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
with:
python-version: "3.10"
- uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
with:
enable-cache: true
- name: Install tox
run: uv tool install tox --with tox-uv
- name: Run fix checks
run: tox -e fix
- name: Run type checks
run: tox -e type
cli-docs:
name: CLI docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
with:
persist-credentials: false
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
with:
python-version: "3.14"
allow-prereleases: true
- uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
with:
enable-cache: true
- name: Install tox
run: uv tool install tox --with tox-uv
- name: Check CLI docs
run: tox -e cli-docs -- --check
- name: Rename coverage file
run: |
import os
import pathlib
target = pathlib.Path(".tox") / ".coverage.cli-docs-ubuntu-latest"
os.replace(pathlib.Path(".tox") / ".coverage.cli-docs", target)
shell: python
- name: Upload coverage artifact
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
include-hidden-files: true
name: coverage-cli-docs-ubuntu-latest
path: .tox/.coverage.*
retention-days: 3
readme:
name: README
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
with:
persist-credentials: false
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
with:
python-version: "3.14"
allow-prereleases: true
- uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
with:
enable-cache: true
- name: Install tox
run: uv tool install tox --with tox-uv
- name: Check README help snapshots
run: tox run -vv --skip-missing-interpreters false -e readme
env:
UV_PYTHON_PREFERENCE: "only-managed"
llms-txt:
name: llms.txt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
with:
persist-credentials: false
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
with:
python-version: "3.14"
allow-prereleases: true
- uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
with:
enable-cache: true
- name: Install tox
run: uv tool install tox --with tox-uv
- name: Check llms.txt artifacts
run: tox -e llms-txt -- --check
schema-docs:
name: Schema docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
with:
persist-credentials: false
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
with:
python-version: "3.14"
allow-prereleases: true
- uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
with:
enable-cache: true
- name: Install tox
run: uv tool install tox --with tox-uv
- name: Check supported formats docs
run: tox -e schema-docs -- --check
config-types:
name: Config types
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
with:
persist-credentials: false
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
with:
python-version: "3.14"
allow-prereleases: true
- uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
with:
enable-cache: true
- name: Install tox
run: uv tool install tox --with tox-uv
- name: Build generated config types
run: tox -e config-types
docs:
name: Docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
with:
persist-credentials: false
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
with:
python-version: "3.14"
allow-prereleases: true
- uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
with:
enable-cache: true
- name: Install tox
run: uv tool install tox --with tox-uv
- name: Build docs
run: tox -e docs
test:
name: Test on Python ${{ matrix.python-version }} and ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
python-version: "3.10"
tox-env: py310-parallel
- os: ubuntu-latest
python-version: "3.11"
tox-env: py311-parallel
- os: ubuntu-latest
python-version: "3.12"
tox-env: py312-parallel
- os: ubuntu-latest
python-version: "3.13"
tox-env: py313-parallel
- os: ubuntu-latest
python-version: "3.14"
tox-env: py314-parallel
- os: windows-latest
python-version: "3.10"
tox-env: py310-parallel
- os: windows-latest
python-version: "3.11"
tox-env: py311-parallel
- os: windows-latest
python-version: "3.12"
tox-env: py312-parallel
- os: windows-latest
python-version: "3.13"
tox-env: py313-parallel
- os: windows-latest
python-version: "3.14"
tox-env: py314-parallel
- os: macos-latest
python-version: "3.10"
tox-env: py310-parallel
- os: macos-latest
python-version: "3.11"
tox-env: py311-parallel
- os: macos-latest
python-version: "3.12"
tox-env: py312-parallel
- os: macos-latest
python-version: "3.13"
tox-env: py313-parallel
- os: macos-latest
python-version: "3.14"
tox-env: py314-parallel
steps:
- uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
with:
persist-credentials: false
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
with:
enable-cache: true
- name: Install tox
run: uv tool install tox --with tox-uv
- name: Run tests
run: tox -e ${{ matrix.tox-env }}
- name: Rename coverage file
run: |
import os
import pathlib
env_name = "${{ matrix.tox-env }}"
target = pathlib.Path(".tox") / f".coverage.{env_name}-${{ matrix.os }}"
os.replace(pathlib.Path(".tox") / f".coverage.{env_name}", target)
shell: python
- name: Upload coverage artifact
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
include-hidden-files: true
name: coverage-${{ matrix.tox-env }}-${{ matrix.os }}
path: .tox/.coverage.*
retention-days: 3
coverage:
name: Coverage
runs-on: ubuntu-latest
needs:
- test
- cli-docs
- readme
- llms-txt
- schema-docs
- config-types
steps:
- uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
with:
fetch-depth: 0
persist-credentials: false
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
with:
python-version: "3.14"
allow-prereleases: true
- uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
with:
enable-cache: true
- name: Install tox
run: uv tool install tox --with tox-uv
- name: Setup coverage environment
run: tox -e coverage --notest
- name: Download coverage artifacts
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
path: .tox
pattern: coverage-*
merge-multiple: true
- name: Combine and report coverage
id: coverage
run: tox -e coverage --skip-pkg-install
continue-on-error: true
- name: Upload HTML coverage report
if: always()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: htmlcov
path: .tox/htmlcov
- name: Upload coverage to Codecov
if: steps.coverage.outcome == 'success'
uses: codecov/codecov-action@75cd11691c0faa626561e295848008c8a7dddffe # v5
with:
files: .tox/coverage.xml
flags: unittests
fail_ci_if_error: true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Fail if coverage check failed
if: steps.coverage.outcome == 'failure'
run: exit 1
package:
name: Package metadata
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
with:
persist-credentials: false
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
with:
python-version: "3.14"
allow-prereleases: true
- uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
with:
enable-cache: true
- name: Install tox
run: uv tool install tox --with tox-uv
- name: Validate package artifacts
run: tox -e pkg_meta
check:
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
needs:
- lint-and-type
- cli-docs
- readme
- llms-txt
- schema-docs
- config-types
- docs
- test
- coverage
- package
runs-on: ubuntu-latest
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe # release/v1
with:
jobs: ${{ toJSON(needs) }}