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.
|
2021-12-27 16:47:14 +00:00
|
|
|
TOX_TESTENV_PASSENV: FORCE_COLOR
|
2021-11-25 08:52:49 +00:00
|
|
|
PYTHON_LATEST: "3.10"
|
2021-11-19 13:51:46 +00:00
|
|
|
|
2020-03-13 10:07:31 +00:00
|
|
|
jobs:
|
|
|
|
tests:
|
2021-12-27 16:47:14 +00:00
|
|
|
name: tox on ${{ matrix.python-version }}
|
|
|
|
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.6"
|
|
|
|
- "3.7"
|
|
|
|
- "3.8"
|
|
|
|
- "3.9"
|
|
|
|
- "3.10"
|
|
|
|
- "3.11.0-beta - 3.11"
|
|
|
|
- "pypy-3.7"
|
|
|
|
- "pypy-3.8"
|
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 }}
|
2021-11-19 13:51:46 +00:00
|
|
|
|
2022-08-18 08:36:49 +00:00
|
|
|
- name: Install dependencies
|
2020-03-13 10:07:31 +00:00
|
|
|
run: |
|
|
|
|
python -VV
|
|
|
|
python -m site
|
|
|
|
python -m pip install --upgrade pip setuptools wheel
|
2021-12-05 05:15:08 +00:00
|
|
|
python -m pip install --upgrade virtualenv tox tox-gh-actions
|
2020-03-13 10:07:31 +00:00
|
|
|
|
2022-08-18 08:36:49 +00:00
|
|
|
- run: python -m tox
|
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:
|
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
|
2021-11-19 13:51:46 +00:00
|
|
|
with:
|
2021-12-05 05:15:08 +00:00
|
|
|
# Use latest Python, so it understands all syntax.
|
|
|
|
python-version: ${{env.PYTHON_LATEST}}
|
2021-11-19 13:51:46 +00:00
|
|
|
|
2021-12-27 16:47:14 +00:00
|
|
|
- run: python -m pip install --upgrade coverage[toml]
|
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
|
|
|
|
|
2021-12-27 16:47:14 +00:00
|
|
|
- name: Combine coverage and fail if it's <100%.
|
2021-12-05 05:15:08 +00:00
|
|
|
run: |
|
|
|
|
python -m coverage combine
|
|
|
|
python -m coverage html --skip-covered --skip-empty
|
|
|
|
python -m 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:
|
|
|
|
python-version: "3.10"
|
|
|
|
|
|
|
|
- run: tox -e docs
|
|
|
|
|
2020-03-13 10:07:31 +00:00
|
|
|
package:
|
2021-12-27 16:47:14 +00:00
|
|
|
name: Build & verify package
|
|
|
|
runs-on: ubuntu-latest
|
2020-03-13 10:07:31 +00:00
|
|
|
|
|
|
|
steps:
|
2022-03-17 13:08:32 +00:00
|
|
|
- uses: actions/checkout@v3
|
2022-08-21 07:42:03 +00:00
|
|
|
- uses: hynek/build-and-inspect-python-package@v1
|
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
|
2020-03-13 10:07:31 +00:00
|
|
|
with:
|
2021-11-25 08:52:49 +00:00
|
|
|
python-version: ${{env.PYTHON_LATEST}}
|
2021-12-27 16:47:14 +00:00
|
|
|
- run: python -m pip install -e .[dev]
|
|
|
|
- run: python -c 'import attr; print(attr.__version__)'
|
2022-09-26 14:50:45 +00:00
|
|
|
|
2022-09-28 07:46:17 +00:00
|
|
|
check: # This job does nothing and is only used for the branch protection
|
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
|
|
|
|
- package
|
|
|
|
|
|
|
|
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) }}
|