2020-03-13 10:07:31 +00:00
|
|
|
---
|
|
|
|
name: CI
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
2021-02-25 07:46:28 +00:00
|
|
|
branches: ["main"]
|
2022-02-02 07:59:16 +00:00
|
|
|
tags: ["*"]
|
2020-03-13 10:07:31 +00:00
|
|
|
pull_request:
|
2021-02-25 07:46:28 +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:
|
|
|
|
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-05 07:48:00 +00:00
|
|
|
python-version: ["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
|
|
|
|
- uses: actions/setup-python@v3
|
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
|
|
|
|
2020-03-13 10:07:31 +00:00
|
|
|
- name: "Install dependencies"
|
|
|
|
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
|
|
|
|
2021-12-27 16:47:14 +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
|
|
|
|
path: ".coverage.*"
|
|
|
|
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
|
|
|
|
- uses: actions/setup-python@v3
|
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
|
|
|
|
2021-11-23 08:49:41 +00:00
|
|
|
|
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
|
|
|
|
- uses: actions/setup-python@v3
|
2020-03-13 10:07:31 +00:00
|
|
|
with:
|
2021-11-25 08:52:49 +00:00
|
|
|
python-version: ${{env.PYTHON_LATEST}}
|
2020-03-13 10:07:31 +00:00
|
|
|
|
2021-12-27 16:47:14 +00:00
|
|
|
- run: python -m pip install build twine check-wheel-contents
|
|
|
|
- run: python -m build --sdist --wheel .
|
|
|
|
- run: ls -l dist
|
|
|
|
- run: check-wheel-contents dist/*.whl
|
|
|
|
- name: Check long_description
|
|
|
|
run: python -m twine check dist/*
|
2020-03-13 10:07:31 +00:00
|
|
|
|
2021-11-23 08:49:41 +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:
|
2021-11-20 15:19:23 +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
|
|
|
|
- uses: actions/setup-python@v3
|
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__)'
|