Skip to content

Commit

Permalink
Switch CI to GitHub Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
pquentin committed Dec 14, 2020
1 parent cdba19b commit af5b386
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 51 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: CI

on:
push:
branches-ignore:
- "dependabot/**"
pull_request:

jobs:
Ubuntu:
name: 'Ubuntu (${{ matrix.python }}${{ matrix.extra_name }})'
timeout-minutes: 10
runs-on: 'ubuntu-latest'
strategy:
fail-fast: false
matrix:
python: ['3.6', '3.7', '3.8', '3.9']
old_sphinx: ['']
extra_name: ['']
include:
- python: '3.9'
old_sphinx: 2.0
extra_name: ', Sphinx 2.0'
- python: '3.9'
old_sphinx: 2.1
extra_name: ', Sphinx 2.1'
- python: '3.9'
old_sphinx: 2.2
extra_name: ', Sphinx 2.2'
- python: '3.9'
old_sphinx: 2.3
extra_name: ', Sphinx 2.3'
- python: '3.9'
old_sphinx: 2.4
extra_name: ', Sphinx 2.4'
- python: '3.9'
old_sphinx: 3.0
extra_name: ', Sphinx 3.0'
- python: '3.9'
old_sphinx: 3.1
extra_name: ', Sphinx 3.1'
- python: '3.9'
old_sphinx: 3.2
extra_name: ', Sphinx 3.2'
- python: '3.9'
old_sphinx: 3.3
extra_name: ', Sphinx 3.3'
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup python
uses: actions/setup-python@v2
with:
python-version: '${{ matrix.python }}'
- name: Run tests
run: ./ci.sh
env:
OLD_SPHINX: '${{ matrix.old_sphinx}}'
# Should match 'name:' up above
JOB_NAME: 'Ubuntu (${{ matrix.python }}${{ matrix.extra_name }})'
24 changes: 0 additions & 24 deletions .travis.yml

This file was deleted.

4 changes: 2 additions & 2 deletions ci/travis.sh → ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ sphinx-build -nW -b html source build
popd

pip install -Ur test-requirements.txt
# https://stackoverflow.com/questions/3601515/how-to-check-if-a-variable-is-set-in-bash
if [ -n "${OLD_SPHINX+x}" ]; then
# https://serverfault.com/questions/7503/how-to-determine-if-a-bash-variable-is-empty
if [ -n "${OLD_SPHINX}" ]; then
pip install "sphinx == ${OLD_SPHINX}.*"
fi
mkdir empty
Expand Down
4 changes: 3 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@
"License :: OSI Approved :: MIT License",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Framework :: Sphinx :: Extension",
"Framework :: Trio",
"Framework :: AsyncIO",
Expand Down
26 changes: 3 additions & 23 deletions sphinxcontrib_trio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,9 @@

from docutils.parsers.rst import directives
from sphinx import addnodes
try:
from sphinx.domains.python import PyFunction
except ImportError:
from sphinx.domains.python import PyModulelevel as PyFunction
from sphinx.domains.python import PyFunction
from sphinx.domains.python import PyObject
try:
from sphinx.domains.python import PyMethod, PyClassMethod, PyStaticMethod
except ImportError:
from sphinx.domains.python import PyClassmember as PyMethod
from sphinx.domains.python import PyClassmember as PyClassMethod
from sphinx.domains.python import PyClassmember as PyStaticMethod
from sphinx.domains.python import PyMethod, PyClassMethod, PyStaticMethod
from sphinx.ext.autodoc import (
FunctionDocumenter, MethodDocumenter, ClassLevelDocumenter, Options, ModuleLevelDocumenter
)
Expand All @@ -80,12 +72,7 @@
try:
from async_generator import isasyncgenfunction
except ImportError:
try:
from inspect import isasyncgenfunction
except ImportError:
# This python install has no way to make async generators
def isasyncgenfunction(fn):
return False
from inspect import isasyncgenfunction

CM_CODES = set()
ACM_CODES = set()
Expand Down Expand Up @@ -410,11 +397,4 @@ def setup(app):
app.add_autodocumenter(ExtendedFunctionDocumenter)
app.add_autodocumenter(ExtendedMethodDocumenter)

# A monkey-patch to VariableCommentPicker to make autodoc_member_order = 'bysource' work.
from sphinx.pycode.parser import VariableCommentPicker
if not hasattr(VariableCommentPicker, "visit_AsyncFunctionDef"): # pragma: no branch
VariableCommentPicker.visit_AsyncFunctionDef = ( # type: ignore
VariableCommentPicker.visit_FunctionDef # type: ignore
)

return {'version': __version__, 'parallel_read_safe': True}
2 changes: 1 addition & 1 deletion tests/test_sphinxcontrib_trio.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ def do_html_test(node, *, expect_match):
assert re.search(check, test_content) is not None
else:
assert re.search(check, test_content) is None
except AssertionError:
except AssertionError: # pragma: nocover
print("failed check")
print()
print(repr(check))
Expand Down

0 comments on commit af5b386

Please sign in to comment.