[pre-commit.ci] pre-commit autoupdate (#751) #922
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: test suite | |
on: | |
push: | |
branches: [master] | |
pull_request: | |
jobs: | |
changed-files: | |
runs-on: ubuntu-latest | |
outputs: | |
workflow-changed: ${{ steps.changed-files.outputs.workflow_any_changed }} | |
pyproject-changed: ${{ steps.changed-files.outputs.src_any_changed }} | |
src-changed: ${{ steps.changed-files.outputs.src_any_changed }} | |
tests-changed: ${{ steps.changed-files.outputs.tests_any_changed }} | |
docs-changed: ${{ steps.changed-files.outputs.doc_any_changed }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get changed files by category | |
id: changed-files | |
uses: tj-actions/changed-files@v41 | |
with: | |
files_yaml: | | |
workflow: | |
- .github/workflows/test.yml | |
pyproject: | |
- pyproject.toml | |
src: | |
- src/** | |
tests: | |
- tests/** | |
doc: | |
- README.rst | |
- docs/** | |
pyright: | |
runs-on: ubuntu-latest | |
needs: changed-files | |
if: | | |
${{ | |
(needs.changed-files.outputs.workflow-changed == 'true') | |
|| (needs.changed-files.outputs.src-changed == 'true') | |
}} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.x | |
- uses: actions/cache@v4 | |
with: | |
path: ~/.cache/pip | |
key: pip-pyright | |
- name: Install dependencies | |
run: pip install -e . pyright pytest | |
- name: Run pyright | |
run: pyright --verifytypes anyio | |
test: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest] | |
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", pypy-3.10] | |
include: | |
- os: macos-latest | |
python-version: "3.8" | |
- os: macos-latest | |
python-version: "3.12" | |
- os: windows-latest | |
python-version: "3.8" | |
- os: windows-latest | |
python-version: "3.12" | |
runs-on: ${{ matrix.os }} | |
needs: changed-files | |
if: | | |
${{ | |
(needs.changed-files.outputs.workflow-changed == 'true') | |
|| (needs.changed-files.outputs.pyproject-changed == 'true') | |
|| (needs.changed-files.outputs.src-changed == 'true') | |
|| (needs.changed-files.outputs.tests-changed == 'true') | |
}} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
allow-prereleases: true | |
cache: pip | |
cache-dependency-path: pyproject.toml | |
- name: Install dependencies | |
run: pip install -e .[test] | |
- name: Test with pytest | |
run: coverage run -m pytest -v | |
timeout-minutes: 5 | |
env: | |
PYTEST_DISABLE_PLUGIN_AUTOLOAD: 1 | |
- name: Generate coverage report | |
run: coverage xml | |
- name: Upload Coverage | |
uses: coverallsapp/github-action@v2 | |
with: | |
parallel: true | |
file: coverage.xml | |
docs: | |
runs-on: ubuntu-latest | |
needs: changed-files | |
if: | | |
${{ | |
(needs.changed-files.outputs.workflow-changed == 'true') | |
|| (needs.changed-files.outputs.pyproject-changed == 'true') | |
|| (needs.changed-files.outputs.src-changed == 'true') | |
|| (needs.changed-files.outputs.docs-changed == 'true') | |
}} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
cache: pip | |
cache-dependency-path: pyproject.toml | |
- name: Install dependencies | |
run: pip install -e .[doc] | |
- name: Build documentation | |
run: sphinx-build -W docs build/sphinx | |
coveralls: | |
name: Finish Coveralls | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Finished | |
uses: coverallsapp/github-action@v2 | |
with: | |
parallel-finished: true |