2020-03-13 10:07:31 +00:00
|
|
|
---
|
|
|
|
name: CI
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
2022-08-18 08:36:49 +00:00
|
|
|
branches: [main]
|
2022-02-02 07:59:16 +00:00
|
|
|
tags: ["*"]
|
2020-03-13 10:07:31 +00:00
|
|
|
pull_request:
|
2022-08-18 08:36:49 +00:00
|
|
|
branches: [main]
|
2020-07-20 08:10:55 +00:00
|
|
|
workflow_dispatch:
|
2020-03-13 10:07:31 +00:00
|
|
|
|
2021-11-19 13:51:46 +00:00
|
|
|
env:
|
2022-08-19 07:22:35 +00:00
|
|
|
FORCE_COLOR: "1" # Make tools pretty.
|
2022-09-28 07:53:07 +00:00
|
|
|
PIP_DISABLE_PIP_VERSION_CHECK: "1"
|
|
|
|
PIP_NO_PYTHON_VERSION_WARNING: "1"
|
2023-04-10 09:41:10 +00:00
|
|
|
# Use oldest version used in doctests / examples.
|
|
|
|
SETUPTOOLS_SCM_PRETEND_VERSION: "19.2.0"
|
2021-11-19 13:51:46 +00:00
|
|
|
|
2022-09-29 09:00:18 +00:00
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
|
2020-03-13 10:07:31 +00:00
|
|
|
jobs:
|
|
|
|
tests:
|
2023-06-14 14:52:17 +00:00
|
|
|
name: Tests & Mypy on ${{ matrix.python-version }}
|
2023-01-11 15:50:27 +00:00
|
|
|
runs-on: ubuntu-latest
|
2020-03-13 10:07:31 +00:00
|
|
|
|
|
|
|
strategy:
|
2021-03-22 07:04:17 +00:00
|
|
|
fail-fast: false
|
2020-03-13 10:07:31 +00:00
|
|
|
matrix:
|
2022-08-19 07:22:35 +00:00
|
|
|
python-version:
|
2022-08-21 07:42:03 +00:00
|
|
|
- "3.7"
|
|
|
|
- "3.8"
|
|
|
|
- "3.9"
|
|
|
|
- "3.10"
|
2022-11-08 07:41:42 +00:00
|
|
|
- "3.11"
|
2023-06-04 05:33:48 +00:00
|
|
|
- "3.12"
|
2023-06-29 10:23:03 +00:00
|
|
|
# - "pypy-3.7"
|
2022-08-21 07:42:03 +00:00
|
|
|
- "pypy-3.8"
|
2023-06-04 05:33:48 +00:00
|
|
|
- "pypy-3.9"
|
2023-07-09 09:42:35 +00:00
|
|
|
- "pypy-3.10"
|
2020-03-13 10:07:31 +00:00
|
|
|
|
|
|
|
steps:
|
2022-03-17 13:08:32 +00:00
|
|
|
- uses: actions/checkout@v3
|
2022-08-15 07:21:23 +00:00
|
|
|
- uses: actions/setup-python@v4
|
2020-03-13 10:07:31 +00:00
|
|
|
with:
|
2021-12-27 16:47:14 +00:00
|
|
|
python-version: ${{ matrix.python-version }}
|
2023-06-04 05:33:48 +00:00
|
|
|
allow-prereleases: true
|
2023-06-12 05:48:55 +00:00
|
|
|
cache: pip
|
2023-06-04 05:33:48 +00:00
|
|
|
|
2023-06-14 14:52:17 +00:00
|
|
|
- name: Prepare tox & run tests
|
2020-03-13 10:07:31 +00:00
|
|
|
run: |
|
2023-02-03 08:08:09 +00:00
|
|
|
V=${{ matrix.python-version }}
|
2020-03-13 10:07:31 +00:00
|
|
|
|
2023-02-03 08:08:09 +00:00
|
|
|
if [[ "$V" = pypy-* ]]; then
|
|
|
|
V=pypy3
|
|
|
|
else
|
|
|
|
V=py$(echo $V | tr -d .)
|
|
|
|
fi
|
|
|
|
|
2023-06-13 07:40:14 +00:00
|
|
|
python -Im pip install tox
|
|
|
|
python -Im tox run -f $V
|
2023-06-14 14:52:17 +00:00
|
|
|
- run: python -Im tox run -e mypy
|
|
|
|
if: ${{ !startsWith(matrix.python-version, 'pypy-') }}
|
2020-03-13 10:07:31 +00:00
|
|
|
|
2021-11-19 13:51:46 +00:00
|
|
|
- name: Upload coverage data
|
2022-03-17 13:08:32 +00:00
|
|
|
uses: actions/upload-artifact@v3
|
2020-08-17 14:22:33 +00:00
|
|
|
with:
|
2021-11-19 13:51:46 +00:00
|
|
|
name: coverage-data
|
2022-08-18 08:36:49 +00:00
|
|
|
path: .coverage.*
|
2021-11-19 13:51:46 +00:00
|
|
|
if-no-files-found: ignore
|
2020-08-17 14:22:33 +00:00
|
|
|
|
2021-11-19 13:51:46 +00:00
|
|
|
coverage:
|
2023-06-14 15:11:06 +00:00
|
|
|
name: Combine & check coverage.
|
2021-12-27 16:47:14 +00:00
|
|
|
runs-on: ubuntu-latest
|
2021-11-19 13:51:46 +00:00
|
|
|
needs: tests
|
|
|
|
|
|
|
|
steps:
|
2022-03-17 13:08:32 +00:00
|
|
|
- uses: actions/checkout@v3
|
2022-08-15 07:21:23 +00:00
|
|
|
- uses: actions/setup-python@v4
|
2023-06-12 05:48:55 +00:00
|
|
|
with:
|
2023-06-13 07:40:14 +00:00
|
|
|
python-version-file: .python-version-default
|
2023-06-12 05:48:55 +00:00
|
|
|
cache: pip
|
2021-11-19 13:51:46 +00:00
|
|
|
|
2021-12-05 05:15:08 +00:00
|
|
|
- name: Download coverage data
|
2022-03-17 13:08:32 +00:00
|
|
|
uses: actions/download-artifact@v3
|
2021-11-19 13:51:46 +00:00
|
|
|
with:
|
|
|
|
name: coverage-data
|
|
|
|
|
2023-06-14 15:11:06 +00:00
|
|
|
- name: Combine coverage & fail if it's <100%.
|
2021-12-05 05:15:08 +00:00
|
|
|
run: |
|
2023-06-14 15:11:06 +00:00
|
|
|
python -Im pip install coverage[toml]
|
2023-06-14 14:52:17 +00:00
|
|
|
|
2023-02-03 08:08:09 +00:00
|
|
|
python -Im coverage combine
|
|
|
|
python -Im coverage html --skip-covered --skip-empty
|
2023-06-14 15:11:06 +00:00
|
|
|
|
|
|
|
# Report and write to summary.
|
|
|
|
python -Im coverage report | sed 's/^/ /' >> $GITHUB_STEP_SUMMARY
|
|
|
|
|
|
|
|
# Report again and fail if under 100%.
|
2023-02-03 08:08:09 +00:00
|
|
|
python -Im coverage report --fail-under=100
|
2021-11-19 13:51:46 +00:00
|
|
|
|
2021-12-27 16:47:14 +00:00
|
|
|
- name: Upload HTML report if check failed.
|
2022-03-17 13:08:32 +00:00
|
|
|
uses: actions/upload-artifact@v3
|
2020-03-13 10:07:31 +00:00
|
|
|
with:
|
2021-11-19 13:51:46 +00:00
|
|
|
name: html-report
|
|
|
|
path: htmlcov
|
2021-12-05 05:15:08 +00:00
|
|
|
if: ${{ failure() }}
|
2020-03-13 10:07:31 +00:00
|
|
|
|
2022-09-28 07:46:17 +00:00
|
|
|
docs:
|
|
|
|
name: Build docs & run doctests
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- uses: actions/setup-python@v4
|
|
|
|
with:
|
2023-01-29 10:37:16 +00:00
|
|
|
# Keep in sync with tox/docs and .readthedocs.yaml.
|
2023-02-12 13:55:48 +00:00
|
|
|
python-version: "3.11"
|
2023-06-12 05:48:55 +00:00
|
|
|
cache: pip
|
2022-09-28 07:46:17 +00:00
|
|
|
|
2023-06-14 14:52:17 +00:00
|
|
|
- name: Prepare & run tox
|
|
|
|
run: |
|
|
|
|
python -Im pip install tox
|
|
|
|
python -Im tox run -e docs,changelog
|
2022-09-28 07:46:17 +00:00
|
|
|
|
2022-09-29 07:36:19 +00:00
|
|
|
pyright:
|
|
|
|
name: Check types using pyright
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- uses: actions/setup-python@v4
|
2023-06-12 05:48:55 +00:00
|
|
|
with:
|
2023-06-13 07:40:14 +00:00
|
|
|
python-version-file: .python-version-default
|
2023-06-12 05:48:55 +00:00
|
|
|
cache: pip
|
2022-09-29 07:36:19 +00:00
|
|
|
|
2023-06-14 14:52:17 +00:00
|
|
|
- name: Prepare & run tox
|
|
|
|
run: |
|
|
|
|
python -Im pip install tox
|
|
|
|
python -Im tox run -e pyright
|
2022-09-29 07:36:19 +00:00
|
|
|
|
2020-03-13 10:07:31 +00:00
|
|
|
install-dev:
|
2021-12-27 16:47:14 +00:00
|
|
|
name: Verify dev env
|
|
|
|
runs-on: ${{ matrix.os }}
|
2020-03-13 10:07:31 +00:00
|
|
|
strategy:
|
|
|
|
matrix:
|
2022-08-18 08:36:49 +00:00
|
|
|
os: [ubuntu-latest, windows-latest]
|
2020-03-13 10:07:31 +00:00
|
|
|
|
|
|
|
steps:
|
2022-03-17 13:08:32 +00:00
|
|
|
- uses: actions/checkout@v3
|
2022-08-15 07:21:23 +00:00
|
|
|
- uses: actions/setup-python@v4
|
2023-06-12 05:48:55 +00:00
|
|
|
with:
|
2023-06-13 07:40:14 +00:00
|
|
|
python-version-file: .python-version-default
|
2023-06-12 05:48:55 +00:00
|
|
|
cache: pip
|
2023-06-04 05:33:48 +00:00
|
|
|
|
2023-06-14 14:52:17 +00:00
|
|
|
- name: Install in dev mode & import
|
|
|
|
run: |
|
|
|
|
python -Im pip install -e .[dev]
|
|
|
|
python -Ic 'import attr; print(attr.__version__)'
|
|
|
|
python -Ic 'import attrs; print(attrs.__version__)'
|
2022-09-26 14:50:45 +00:00
|
|
|
|
2022-09-29 09:01:58 +00:00
|
|
|
# Ensure everything required is passing for branch protection.
|
|
|
|
required-checks-pass:
|
2022-09-26 14:50:45 +00:00
|
|
|
if: always()
|
|
|
|
|
|
|
|
needs:
|
|
|
|
- coverage
|
2022-09-28 07:46:17 +00:00
|
|
|
- docs
|
2022-09-26 14:50:45 +00:00
|
|
|
- install-dev
|
2023-04-05 08:42:41 +00:00
|
|
|
# Pyright is currently flaky
|
|
|
|
# XXX: https://github.com/ekalinin/nodeenv/issues/324
|
|
|
|
# - pyright
|
2022-09-26 14:50:45 +00:00
|
|
|
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Decide whether the needed jobs succeeded or failed
|
|
|
|
uses: re-actors/alls-green@release/v1
|
|
|
|
with:
|
|
|
|
jobs: ${{ toJSON(needs) }}
|