Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Jan 29, 2024
2 parents c3b3aae + 8214e1c commit aa92d6a
Show file tree
Hide file tree
Showing 8 changed files with 85 additions and 67 deletions.
73 changes: 33 additions & 40 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,28 @@
name: tests

on: [push, pull_request]
on:
merge_group:
push:
branches-ignore:
# disabled for jaraco/skeleton#103
# - gh-readonly-queue/** # Temporary merge queue-related GH-made branches
pull_request:

permissions:
contents: read

env:
# Environment variables to support color support (jaraco/skeleton#66):
# Request colored output from CLI tools supporting it. Different tools
# interpret the value differently. For some, just being set is sufficient.
# For others, it must be a non-zero integer. For yet others, being set
# to a non-empty value is sufficient. For tox, it must be one of
# <blank>, 0, 1, false, no, off, on, true, yes. The only enabling value
# in common is "1".
# Environment variable to support color support (jaraco/skeleton#66)
FORCE_COLOR: 1
# MyPy's color enforcement (must be a non-zero number)
MYPY_FORCE_COLOR: -42
# Recognized by the `py` package, dependency of `pytest` (must be "1")
PY_COLORS: 1
# Make tox-wrapped tools see color requests
TOX_TESTENV_PASSENV: >-
FORCE_COLOR
MYPY_FORCE_COLOR
NO_COLOR
PY_COLORS
PYTEST_THEME
PYTEST_THEME_MODE

# Suppress noisy pip warnings
PIP_DISABLE_PIP_VERSION_CHECK: 'true'
PIP_NO_PYTHON_VERSION_WARNING: 'true'
PIP_NO_WARN_SCRIPT_LOCATION: 'true'

# Disable the spinner, noise in GHA; TODO(webknjaz): Fix this upstream
# Must be "1".
TOX_PARALLEL_NO_SPINNER: 1
# Ensure tests can sense settings about the environment
TOX_OVERRIDE: >-
testenv.pass_env+=GITHUB_*,FORCE_COLOR
jobs:
Expand All @@ -54,43 +42,49 @@ jobs:
platform: ubuntu-latest
- python: "3.10"
platform: ubuntu-latest
- python: pypy3.9
- python: pypy3.10
platform: ubuntu-latest
runs-on: ${{ matrix.platform }}
continue-on-error: ${{ matrix.python == '3.12' }}
continue-on-error: ${{ matrix.python == '3.13' }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
allow-prereleases: true
- name: Install tox
run: |
python -m pip install tox
run: python -m pip install tox
- name: Run
run: tox

docs:
collateral:
strategy:
fail-fast: false
matrix:
job:
- diffcov
- docs
runs-on: ubuntu-latest
env:
TOXENV: docs
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.x
- name: Install tox
run: |
python -m pip install tox
- name: Run
run: tox
run: python -m pip install tox
- name: Eval ${{ matrix.job }}
run: tox -e ${{ matrix.job }}

check: # This job does nothing and is only used for the branch protection
if: always()

needs:
- test
- docs
- collateral

runs-on: ubuntu-latest

Expand All @@ -109,14 +103,13 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.x
- name: Install tox
run: |
python -m pip install tox
run: python -m pip install tox
- name: Run
run: tox -e release
env:
Expand Down
7 changes: 4 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
repos:
- repo: https://github.com/psf/black
rev: 22.6.0
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.8
hooks:
- id: black
- id: ruff
- id: ruff-format
6 changes: 1 addition & 5 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,14 @@

.. image:: https://img.shields.io/pypi/pyversions/jaraco.fabric.svg

.. image:: https://github.com/jaraco/jaraco.fabric/workflows/tests/badge.svg
.. image:: https://github.com/jaraco/jaraco.fabric/actions/workflows/main.yml/badge.svg
:target: https://github.com/jaraco/jaraco.fabric/actions?query=workflow%3A%22tests%22
:alt: tests

.. image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json
:target: https://github.com/astral-sh/ruff
:alt: Ruff

.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
:target: https://github.com/psf/black
:alt: Code style: Black

.. .. image:: https://readthedocs.org/projects/PROJECT_RTD/badge/?version=latest
.. :target: https://PROJECT_RTD.readthedocs.io/en/latest/?badge=latest
Expand Down
3 changes: 0 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,4 @@
requires = ["setuptools>=56", "setuptools_scm[toml]>=3.4.1"]
build-backend = "setuptools.build_meta"

[tool.black]
skip-string-normalization = true

[tool.setuptools_scm]
11 changes: 3 additions & 8 deletions pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,6 @@ filterwarnings=
# Ensure ResourceWarnings are emitted
default::ResourceWarning

# shopkeep/pytest-black#55
ignore:<class 'pytest_black.BlackItem'> is not using a cooperative constructor:pytest.PytestDeprecationWarning
ignore:The \(fspath. py.path.local\) argument to BlackItem is deprecated.:pytest.PytestDeprecationWarning
ignore:BlackItem is an Item subclass and should not be a collector:pytest.PytestWarning

# shopkeep/pytest-black#67
ignore:'encoding' argument not specified::pytest_black

# realpython/pytest-mypy#152
ignore:'encoding' argument not specified::pytest_mypy

Expand All @@ -24,4 +16,7 @@ filterwarnings=
# pypa/build#615
ignore:'encoding' argument not specified::build.env

# dateutil/dateutil#1284
ignore:datetime.datetime.utcfromtimestamp:DeprecationWarning:dateutil.tz.tz

## end upstream
22 changes: 22 additions & 0 deletions ruff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[lint]
ignore = [
# https://docs.astral.sh/ruff/formatter/#conflicting-lint-rules
"W191",
"E111",
"E114",
"E117",
"D206",
"D300",
"Q000",
"Q001",
"Q002",
"Q003",
"COM812",
"COM819",
"ISC001",
"ISC002",
]

[format]
# https://docs.astral.sh/ruff/settings/#format-quote-style
quote-style = "preserve"
9 changes: 4 additions & 5 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,12 @@ testing =
# upstream
pytest >= 6
pytest-checkdocs >= 2.4
pytest-black >= 0.3.7; \
# workaround for jaraco/skeleton#22
python_implementation != "PyPy"
pytest-cov
pytest-mypy >= 0.9.1; \
pytest-mypy; \
# workaround for jaraco/skeleton#22
python_implementation != "PyPy"
pytest-enabler >= 2.2
pytest-ruff
pytest-ruff >= 0.2.1

# local
fabric
Expand All @@ -52,6 +49,8 @@ testing =
docs =
# upstream
sphinx >= 3.5
# workaround for sphinx/sphinx-doc#11662
sphinx < 7.2.5
jaraco.packaging >= 9.3
rst.linker >= 1.9
furo
Expand Down
21 changes: 18 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[testenv]
description = perform primary checks (tests, style, types, coverage)
deps =
setenv =
PYTHONWARNDEFAULTENCODING = 1
Expand All @@ -8,32 +9,46 @@ usedevelop = True
extras =
testing

[testenv:diffcov]
description = run tests and check that diff from main is covered
deps =
diff-cover
commands =
pytest {posargs} --cov-report xml
diff-cover coverage.xml --compare-branch=origin/main --html-report diffcov.html
diff-cover coverage.xml --compare-branch=origin/main --fail-under=100

[testenv:docs]
description = build the documentation
extras =
docs
testing
changedir = docs
commands =
python -m sphinx -W --keep-going . {toxinidir}/build/html
python -m sphinxlint
python -m sphinxlint \
# workaround for sphinx-contrib/sphinx-lint#83
--jobs 1

[testenv:finalize]
description = assemble changelog and tag a release
skip_install = True
deps =
towncrier
jaraco.develop >= 7.23
passenv = *
pass_env = *
commands =
python -m jaraco.develop.finalize


[testenv:release]
description = publish the package to PyPI and GitHub
skip_install = True
deps =
build
twine>=3
jaraco.develop>=7.1
passenv =
pass_env =
TWINE_PASSWORD
GITHUB_TOKEN
setenv =
Expand Down

0 comments on commit aa92d6a

Please sign in to comment.