Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure with meta/config. #243

Merged
merged 10 commits into from
Jun 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 19 additions & 4 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -1,14 +1,29 @@
# Generated from:
# https://github.com/zopefoundation/meta/tree/master/config/c-code
[run]
branch = True
source = zope.interface
# New in 5.0; required for the GHA coveralls submission.
relative_files = True
branch = true

[paths]
source =
src/
.tox/*/lib/python*/site-packages/
.tox/pypy*/site-packages/

[report]
show_missing = true
precision = 2
exclude_lines =
except ImportError:
if __name__ == '__main__':
pragma: no cover
class I[A-Z]\w+\((Interface|I[A-Z].*)\):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How much coverage are we losing by dropping this from exclude_lines?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hopefully fixed all the places where this line ignored methods by changing pass to a docstring.

There is still https://coveralls.io/builds/39516428/source?filename=src%2Fzope%2Finterface%2Fcommon%2Fcollections.py#L221 which I do not understand as I thought we have coverage for all Python versions. (There are some other cases which look the same.)

raise NotImplementedError
pragma: nocover
raise AssertionError
self\.fail
raise NotImplementedError
raise unittest.Skip
self.fail\(

[html]
directory = parts/htmlcov
39 changes: 39 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Generated from:
# https://github.com/zopefoundation/meta/tree/master/config/c-code
#
# EditorConfig Configuration file, for more details see:
# http://EditorConfig.org
# EditorConfig is a convention description, that could be interpreted
# by multiple editors to enforce common coding conventions for specific
# file types

# top-most EditorConfig file:
# Will ignore other EditorConfig files in Home directory or upper tree level.
root = true


[*] # For All Files
# Unix-style newlines with a newline ending every file
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
# Set default charset
charset = utf-8
# Indent style default
indent_style = space
# Max Line Length - a hard line wrap, should be disabled
max_line_length = off

[*.{py,cfg,ini}]
# 4 space indentation
indent_size = 4

[*.{yml,zpt,pt,dtml}]
# 2 space indentation
indent_size = 2

[{Makefile,.gitmodules}]
# Tab indentation (no size specified, but view as 4 spaces)
indent_style = tab
indent_size = unset
tab_width = unset
94 changes: 61 additions & 33 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# Generated from:
# https://github.com/zopefoundation/meta/tree/master/config/c-code
###
# Initially copied from
# https://github.com/actions/starter-workflows/blob/main/ci/python-package.yml
# And later based on the version I (jamadden) updated at
# And later based on the version jamadden updated at
# gevent/gevent, and then at zodb/relstorage and zodb/perfmetrics
#
# Original comment follows.
Expand Down Expand Up @@ -35,14 +37,14 @@
name: tests


# Triggers the workflow on push or pull request events
on: [push, pull_request]
# Limiting to particular branches might be helpful to conserve minutes.
#on:
# push:
# branches: [ $default-branch ]
# pull_request:
# branches: [ $default-branch ]
# Triggers the workflow on push or pull request events and periodically
on:
push:
pull_request:
schedule:
- cron: '0 12 * * 0' # run once a week on Sunday
# Allow to run this workflow manually from the Actions tab
workflow_dispatch:

env:
# Weirdly, this has to be a top-level key, not ``defaults.env``
Expand Down Expand Up @@ -72,7 +74,6 @@ env:
###



jobs:
# Because sharing code/steps is so hard, and because it can be
# extremely valuable to be able to get binary wheels without
Expand All @@ -86,13 +87,21 @@ jobs:
# This division is time-saving for projects that take awhile to
# build, but somewhat less of a clear-cut win given how quick this
# is to compile (at least at this writing).
build-zope_interface:
build-package:
# Sigh. Note that the matrix must be kept in sync
# with `test`, and `docs` must use a subset.
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: [2.7, pypy-2.7, pypy-3.6, 3.5, 3.6, 3.7, 3.8, 3.9]
python-version:
- 2.7
- 3.5
- pypy-2.7
- pypy-3.6
- 3.6
- 3.7
- 3.8
- 3.9
os: [ubuntu-20.04, macos-latest]
exclude:
- os: macos-latest
Expand Down Expand Up @@ -131,7 +140,7 @@ jobs:
- name: Install Build Dependencies
run: |
pip install -U pip
pip install -U setuptools wheel twine
pip install -U setuptools wheel twine cffi
pip install -U coveralls coverage

- name: Build zope.interface
Expand Down Expand Up @@ -165,11 +174,19 @@ jobs:
twine upload --skip-existing dist/*

test:
needs: build-zope_interface
needs: build-package
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: [2.7, pypy-2.7, pypy-3.6, 3.5, 3.6, 3.7, 3.8, 3.9]
python-version:
- 2.7
- 3.5
- pypy-2.7
- pypy-3.6
- 3.6
- 3.7
- 3.8
- 3.9
os: [ubuntu-20.04, macos-latest]
exclude:
- os: macos-latest
Expand All @@ -186,6 +203,12 @@ jobs:
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
###
# Caching.
# This actually *restores* a cache and schedules a cleanup action
# to save the cache. So it must come before the thing we want to use
# the cache.
###
- name: Get pip cache dir
id: pip-cache
run: |
Expand Down Expand Up @@ -225,7 +248,7 @@ jobs:
coverage run -p -m unittest discover -s src
PURE_PYTHON=1 coverage run -p -m unittest discover -s src
coverage combine
coverage report -i
coverage report --ignore-errors --show-missing
icemac marked this conversation as resolved.
Show resolved Hide resolved
- name: Submit to Coveralls
# This is a container action, which only runs on Linux.
if: ${{ startsWith(runner.os, 'Linux') }}
Expand All @@ -243,7 +266,7 @@ jobs:
parallel-finished: true

docs:
needs: build-zope_interface
needs: build-package
runs-on: ${{ matrix.os }}
strategy:
matrix:
Expand All @@ -257,6 +280,12 @@ jobs:
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
###
# Caching.
# This actually *restores* a cache and schedules a cleanup action
# to save the cache. So it must come before the thing we want to use
# the cache.
###
- name: Get pip cache dir
id: pip-cache
run: |
Expand All @@ -279,8 +308,9 @@ jobs:
run: |
pip install -U wheel
pip install -U coverage
pip install -U 'faulthandler; python_version == "2.7" and platform_python_implementation == "CPython"'
pip install -U "`ls dist/zope.interface-*.whl`[docs]"
# Until repoze.sphinx.autointerface supports Sphinx 4.x we cannot use it:
pip install -U "Sphinx < 4"
- name: Build docs
env:
ZOPE_INTERFACE_STRICT_IRO: 1
Expand All @@ -290,7 +320,7 @@ jobs:


lint:
needs: build-zope_interface
needs: build-package
runs-on: ${{ matrix.os }}
strategy:
matrix:
Expand All @@ -304,7 +334,12 @@ jobs:
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

###
# Caching.
# This actually *restores* a cache and schedules a cleanup action
# to save the cache. So it must come before the thing we want to use
# the cache.
###
- name: Get pip cache dir
id: pip-cache
run: |
Expand Down Expand Up @@ -351,6 +386,12 @@ jobs:
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
###
# Caching.
# This actually *restores* a cache and schedules a cleanup action
# to save the cache. So it must come before the thing we want to use
# the cache.
###
- name: Get pip cache dir
id: pip-cache
run: |
Expand Down Expand Up @@ -408,16 +449,3 @@ jobs:
password: ${{ secrets.TWINE_PASSWORD }}
skip_existing: true
packages_dir: wheelhouse/

# TODO:
# * Use YAML syntax to share snippets, like the old .travis.yml did
# Sadly, as of 2021-02-01, Github Actions does not support anchors at
# all. Just having an anchor results in an error:
#
# The workflow is not valid. .github/workflows/tests.yml: Anchors
# are not currently supported. Remove the anchor 'an-strategy'
#
# The alternative of using composite actions doesn't work either,
# because composite actions are limited to running shell scripts.
# Steps in them can't call other actions with `uses:`, and nor can
# they be conditional with `if:`.
29 changes: 17 additions & 12 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,24 +1,29 @@
*.egg-info
# Generated from:
# https://github.com/zopefoundation/meta/tree/master/config/c-code
*.egg-info/
*.profraw
*.pyc
*.pyo
*.so
*.swp
__pycache__
.coverage
.coverage.*
.installed.cfg
default.profraw
nosetests.xml
coverage.xml
pyvenv.cfg
.eggs/
.installed.cfg
.mr.developer.cfg
.tox/
.vscode/
__pycache__/
bin/
build/
eggs/
coverage.xml
develop-eggs/
docs/_build/
develop/
dist/
docs/_build
eggs/
etc/
lib/
lib64
log/
parts/
htmlcov/
pyvenv.cfg
var/
Loading