diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 14244e4..d55ec84 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -29,12 +29,10 @@ jobs: - ["3.10", "py310"] - ["3.11.0-rc.2", "py311"] - ["3.9", "docs"] - - ["3.9", "coverage"] - ["3.9", "py39-datetime"] exclude: - { os: windows, config: ["3.9", "lint"] } - { os: windows, config: ["3.9", "docs"] } - - { os: windows, config: ["3.9", "coverage"] } runs-on: ${{ matrix.os }}-latest if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name @@ -59,10 +57,49 @@ jobs: pip install tox - name: Test run: tox -e ${{ matrix.config[1] }} - - name: Coverage - if: matrix.config[1] == 'coverage' - run: | - pip install coveralls - coveralls --service=github - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Upload coverage artifact + uses: actions/upload-artifact@v2 + if: matrix.os != 'windows' + with: + name: coverage-data + path: .coverage.${{ matrix.config[1] }} + if-no-files-found: ignore + + coverage: + name: Combined coverage + runs-on: ubuntu-latest + needs: build + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + with: + # Use latest, so it understands all syntax. + python-version: "3.10" + - run: python -m pip install --upgrade coveralls coverage[toml] + + - name: Download coverage data. + uses: actions/download-artifact@v2 + with: + name: coverage-data + + - name: Indicate completion to coveralls.io + run: | + python -m coverage combine + coveralls --service=github + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Coverage report and fail if it's <100%. + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + python -m coverage html --skip-covered --skip-empty + python -m coverage report --fail-under=100 + + - name: Upload HTML report if check failed. + uses: actions/upload-artifact@v2 + with: + name: html-report + path: htmlcov + if: ${{ failure() }} diff --git a/.meta.toml b/.meta.toml index bb6c073..5f54a5a 100644 --- a/.meta.toml +++ b/.meta.toml @@ -2,7 +2,7 @@ # https://github.com/zopefoundation/meta/tree/master/config/pure-python [meta] template = "pure-python" -commit-id = "b5df3766ff8923477f3d24729b19504f0c401a2e" +commit-id = "54e37f7de7149c0d4003e40bbe300d012a851ce7" [python] with-pypy = false @@ -16,7 +16,6 @@ with-future-python = true use-flake8 = true additional-envlist = [ "py39-datetime", - "combined-coverage", ] testenv-deps = [ "datetime: DateTime", @@ -31,33 +30,18 @@ testenv-commands = [ "pip list", "pytest --cov=src --cov=tests --cov-report= {posargs}", ] -testenv-additional = [ - "", - "[testenv:combined-coverage]", - "basepython = python3", - "allowlist_externals =", - " mkdir", - "deps =", - " coverage", - " -cconstraints.txt", - "setenv =", - " COVERAGE_FILE=.coverage", - "commands =", - " mkdir -p {toxinidir}/parts/htmlcov", - " coverage erase", - " coverage combine", - " coverage html", - " coverage report -m --fail-under=100", - "depends = py36,py37,py38,py39,py39-datetime,py310,py311,coverage", - ] -coverage-basepython = "python3.8" -coverage-command = "pytest --cov=src --cov=tests --cov-report= {posargs}" +coverage-basepython = "python3" +coverage-command = [ + "coverage erase", + "coverage combine" +] +coverage-depends = "py36,py37,py38,py39,py39-datetime,py310,py311" coverage-setenv = [ "COVERAGE_FILE=.coverage", ] [coverage] -fail-under = 98.8 +fail-under = 100.0 [isort] additional-sources = "{toxinidir}/tests" diff --git a/tox.ini b/tox.ini index 3226a98..ec3a21e 100644 --- a/tox.ini +++ b/tox.ini @@ -11,9 +11,8 @@ envlist = py310 py311 docs - coverage py39-datetime - combined-coverage + coverage [testenv] usedevelop = true @@ -34,23 +33,6 @@ extras = test docs -[testenv:combined-coverage] -basepython = python3 -allowlist_externals = - mkdir -deps = - coverage - -cconstraints.txt -setenv = - COVERAGE_FILE=.coverage -commands = - mkdir -p {toxinidir}/parts/htmlcov - coverage erase - coverage combine - coverage html - coverage report -m --fail-under=100 -depends = py36,py37,py38,py39,py39-datetime,py310,py311,coverage - [testenv:lint] basepython = python3 skip_install = true @@ -83,7 +65,7 @@ commands = sphinx-build -b doctest -d docs/_build/doctrees docs docs/_build/doctest [testenv:coverage] -basepython = python3.8 +basepython = python3 allowlist_externals = mkdir deps = @@ -96,10 +78,11 @@ setenv = COVERAGE_FILE=.coverage commands = mkdir -p {toxinidir}/parts/htmlcov - pytest --cov=src --cov=tests --cov-report= {posargs} + coverage erase + coverage combine coverage run -a -m sphinx -b doctest -d {envdir}/.cache/doctrees docs {envdir}/.cache/doctest coverage html - coverage report -m --fail-under=98.8 + coverage report -m --fail-under=100.0 [coverage:run] branch = True