attrs/.github/workflows/main.yml

121 lines
2.8 KiB
YAML
Raw Normal View History

---
name: CI
on:
push:
branches: [main]
tags: ["*"]
pull_request:
branches: [main]
workflow_dispatch:
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
PYTHON_LATEST: "3.10"
jobs:
tests:
2021-12-27 16:47:14 +00:00
name: tox on ${{ matrix.python-version }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
2022-08-19 07:22:35 +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",
]
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
with:
2021-12-27 16:47:14 +00:00
python-version: ${{ matrix.python-version }}
- 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
- run: python -m tox
- name: Upload coverage data
2022-03-17 13:08:32 +00:00
uses: actions/upload-artifact@v3
with:
name: coverage-data
path: .coverage.*
if-no-files-found: ignore
coverage:
2021-12-27 16:47:14 +00:00
runs-on: ubuntu-latest
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
with:
2021-12-05 05:15:08 +00:00
# Use latest Python, so it understands all syntax.
python-version: ${{env.PYTHON_LATEST}}
2021-12-27 16:47:14 +00:00
- run: python -m pip install --upgrade coverage[toml]
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
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-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
with:
name: html-report
path: htmlcov
2021-12-05 05:15:08 +00:00
if: ${{ failure() }}
package:
2021-12-27 16:47:14 +00:00
name: Build & verify package
runs-on: ubuntu-latest
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
with:
python-version: ${{env.PYTHON_LATEST}}
2021-12-27 16:47:14 +00:00
- run: python -m pip install build twine check-wheel-contents
2022-08-19 04:56:30 +00:00
- run: python -m build
2021-12-27 16:47:14 +00:00
- run: ls -l dist
- run: check-wheel-contents dist/*.whl
- name: Check long_description
run: python -m twine check dist/*
install-dev:
2021-12-27 16:47:14 +00:00
name: Verify dev env
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
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
with:
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__)'