Skip to content

Commit 53c7a8c

Browse files
authored
Use GitHub Actions for CI
1 parent bc623de commit 53c7a8c

File tree

11 files changed

+126
-78
lines changed

11 files changed

+126
-78
lines changed

.github/workflows/main.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: CI
2+
3+
# Controls when the action will run.
4+
on:
5+
# Triggers the workflow on push or pull request events
6+
push:
7+
pull_request:
8+
schedule:
9+
- cron: '0 12 * * 0' # run once a week on Sunday
10+
11+
# Allows you to run this workflow manually from the Actions tab
12+
workflow_dispatch:
13+
14+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
15+
jobs:
16+
tests:
17+
name: "Python ${{ matrix.python-version }}"
18+
runs-on: "ubuntu-latest"
19+
20+
strategy:
21+
matrix:
22+
python-version: ["3.6", "3.7", "3.8", "3.9", "pypy3"]
23+
24+
# Steps represent a sequence of tasks that will be executed as part of the job
25+
steps:
26+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
27+
- uses: "actions/checkout@v2"
28+
- uses: "actions/setup-python@v2"
29+
with:
30+
python-version: "${{ matrix.python-version }}"
31+
- name: "Install dependencies"
32+
run: |
33+
set -xe
34+
python -VV
35+
python -m site
36+
python -m pip install --upgrade pip setuptools wheel
37+
python -m pip install --upgrade virtualenv tox tox-gh-actions
38+
- name: "Run tox targets for ${{ matrix.python-version }}"
39+
run: "python -m tox"
40+
41+
- name: "Report to coveralls"
42+
# coverage is only created in the py39 environment
43+
# --service=github is a workaround for bug
44+
# https://github.com/coveralls-clients/coveralls-python/issues/251
45+
if: "matrix.python-version == '3.9'"
46+
run: |
47+
pip install coveralls
48+
coveralls --service=github
49+
env:
50+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.pre-commit-config.yaml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
repos:
22
- repo: https://github.com/psf/black
3-
rev: stable
3+
rev: 20.8b1
44
hooks:
55
- id: black
6+
args: [--line-length=80]
7+
- repo: https://gitlab.com/pycqa/flake8
8+
rev: "3.8.4"
9+
hooks:
10+
- id: flake8
11+
- repo: https://github.com/asottile/pyupgrade
12+
rev: v2.7.4
13+
hooks:
14+
- id: pyupgrade
15+
args: [--py36-plus]

.travis.yml

Lines changed: 0 additions & 27 deletions
This file was deleted.

CHANGES.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ CHANGES
66

77
- Make Python 3.6 the default testing environment.
88

9+
- Add support for Python 3.9.
10+
11+
- Use GitHub Actios for CI.
12+
913

1014
0.1 (2016-06-09)
1115
================

README.rst

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
.. image:: https://github.com/morepath/morepath_wiki/workflows/CI/badge.svg?branch=master
2+
:target: https://github.com/morepath/morepath_wiki/actions?workflow=CI
3+
:alt: CI Status
4+
5+
.. image:: https://coveralls.io/repos/github/morepath/morepath_wiki/badge.svg?branch=master
6+
:target: https://coveralls.io/github/morepath/morepath_wiki?branch=master
7+
8+
.. image:: https://img.shields.io/pypi/v/morepath_wiki.svg
9+
:target: https://pypi.org/project/morepath_wiki/
10+
11+
.. image:: https://img.shields.io/pypi/pyversions/morepath_wiki.svg
12+
:target: https://pypi.org/project/morepath_wiki/
13+
14+
15+
116
Morepath Wiki
217
=============
318

@@ -60,4 +75,4 @@ And to run the test suite::
6075

6176
.. _GitHub: https://github.com/morepath/morepath_wiki
6277

63-
.. _virtual environment: http://www.virtualenv.org/
78+
.. _virtual environment: https://virtualenv.pypa.io/en/latest/

morepath_wiki/html.py

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- encoding: utf8 -*-
21
#
32
# $Id: html.py 5409 2011-06-29 07:07:25Z rjones $
43
# $HeadURL: svn+ssh://svn/svn/trunk/api/eklib/html.py $
@@ -223,7 +222,6 @@
223222
See the end of the source file for the license of use.
224223
XHTML support was contributed by Michael Haubenwallner.
225224
"""
226-
from __future__ import with_statement
227225

228226
__version__ = "1.16"
229227

@@ -232,7 +230,7 @@
232230
import unittest
233231

234232

235-
class HTML(object):
233+
class HTML:
236234
"""Easily generate HTML.
237235
238236
>>> print HTML('html', 'some text')
@@ -254,7 +252,9 @@ class HTML(object):
254252

255253
newline_default_on = set("table ol ul dl".split())
256254

257-
def __init__(self, name=None, text=None, stack=None, newlines=True, escape=True):
255+
def __init__(
256+
self, name=None, text=None, stack=None, newlines=True, escape=True
257+
):
258258
self._name = name
259259
self._content = []
260260
self._attrs = {}
@@ -311,10 +311,13 @@ def __call__(self, *content, **kw):
311311
if self._name == "read":
312312
if len(content) == 1 and isinstance(content[0], int):
313313
raise TypeError(
314-
"you appear to be calling read(%d) on " "a HTML instance" % content
314+
"you appear to be calling read(%d) on "
315+
"a HTML instance" % content
315316
)
316317
elif len(content) == 0:
317-
raise TypeError("you appear to be calling read() on a " "HTML instance")
318+
raise TypeError(
319+
"you appear to be calling read() on a " "HTML instance"
320+
)
318321

319322
# customising a tag with content or attributes
320323
escape = kw.pop("escape", True)
@@ -343,7 +346,7 @@ def __exit__(self, exc_type, exc_value, exc_tb):
343346
self._stack.pop()
344347

345348
def __repr__(self):
346-
return "<HTML %s 0x%x>" % (self._name, id(self))
349+
return "<HTML {} 0x{:x}>".format(self._name, id(self))
347350

348351
def _stringify(self, str_type):
349352
# turn me and my content into text
@@ -352,7 +355,7 @@ def _stringify(self, str_type):
352355
return join.join(map(str_type, self._content))
353356
a = ['%s="%s"' % i for i in self._attrs.items()]
354357
l = [self._name] + a
355-
s = "<%s>%s" % (" ".join(l), join)
358+
s = "<{}>{}".format(" ".join(l), join)
356359
if self._content:
357360
s += join.join(map(str_type, self._content))
358361
s += join + "</%s>" % self._name
@@ -384,12 +387,12 @@ def _stringify(self, str_type):
384387
return join.join(map(str_type, self._content))
385388
a = ['%s="%s"' % i for i in self._attrs.items()]
386389
l = [self._name] + a
387-
s = "<%s>%s" % (" ".join(l), join)
390+
s = "<{}>{}".format(" ".join(l), join)
388391
if self._content or not (self._name.lower() in self.empty_elements):
389392
s += join.join(map(str_type, self._content))
390393
s += join + "</%s>" % self._name
391394
else:
392-
s = "<%s />%s" % (" ".join(l), join)
395+
s = "<{} />{}".format(" ".join(l), join)
393396
return s
394397

395398

@@ -409,12 +412,12 @@ def _stringify(self, str_type):
409412
return join.join(map(str_type, self._content))
410413
a = ['%s="%s"' % i for i in self._attrs.items()]
411414
l = [self._name] + a
412-
s = "<%s>%s" % (" ".join(l), join)
415+
s = "<{}>{}".format(" ".join(l), join)
413416
if self._content:
414417
s += join.join(map(str_type, self._content))
415418
s += join + "</%s>" % self._name
416419
else:
417-
s = "<%s />%s" % (" ".join(l), join)
420+
s = "<{} />{}".format(" ".join(l), join)
418421
return s
419422

420423

@@ -443,7 +446,8 @@ def test_iadd_tag(self):
443446
h += XML("some-tag", "spam", newlines=False)
444447
h += XML("text", "spam", newlines=False)
445448
self.assertEquals(
446-
str(h), "<xml>\n<some-tag>spam</some-tag>\n<text>spam</text>\n</xml>"
449+
str(h),
450+
"<xml>\n<some-tag>spam</some-tag>\n<text>spam</text>\n</xml>",
447451
)
448452

449453
def test_iadd_text(self):
@@ -523,15 +527,19 @@ def test_subtag_direct(self):
523527
l = h.ol
524528
l.li("foo")
525529
l.li.b("bar")
526-
self.assertEquals(str(h), "<ol>\n<li>foo</li>\n<li><b>bar</b></li>\n</ol>")
530+
self.assertEquals(
531+
str(h), "<ol>\n<li>foo</li>\n<li><b>bar</b></li>\n</ol>"
532+
)
527533

528534
def test_subtag_direct_context(self):
529535
'generation of sub-tags directly on the parent tag in "with" context'
530536
h = HTML()
531537
with h.ol as l:
532538
l.li("foo")
533539
l.li.b("bar")
534-
self.assertEquals(str(h), "<ol>\n<li>foo</li>\n<li><b>bar</b></li>\n</ol>")
540+
self.assertEquals(
541+
str(h), "<ol>\n<li>foo</li>\n<li><b>bar</b></li>\n</ol>"
542+
)
535543

536544
def test_subtag_no_newlines(self):
537545
"prevent generation of newlines against default"

morepath_wiki/model.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
class Root(object):
1+
class Root:
22
pass
33

44

5-
class Page(object):
5+
class Page:
66
def __init__(self, name):
77
self.name = name

morepath_wiki/storage.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def wikify(text):
1515
return wikiname_re.sub(r'<a href="/\1">\1</a>', py_html.escape(text))
1616

1717

18-
class Storage(object):
18+
class Storage:
1919
def __init__(self, directory):
2020
self.directory = directory
2121

pyproject.toml

Lines changed: 0 additions & 16 deletions
This file was deleted.

setup.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# -*- coding: utf-8 -*-
2-
3-
import io
41
from setuptools import setup, find_packages
52

63

@@ -12,9 +9,9 @@
129
"web micro-framework battle by Richard Jones"
1310
),
1411
long_description=(
15-
io.open("README.rst", encoding="utf-8").read()
12+
open("README.rst", encoding="utf-8").read()
1613
+ "\n\n"
17-
+ io.open("CHANGES.rst", encoding="utf-8").read()
14+
+ open("CHANGES.rst", encoding="utf-8").read()
1815
),
1916
author="Morepath developers",
2017
author_email="morepath@googlegroups.com",
@@ -30,7 +27,6 @@
3027
],
3128
extras_require=dict(
3229
test=["pytest >= 2.9.0", "webtest", "pytest-remove-stale-bytecode"],
33-
pep8=["flake8", "black"],
3430
coverage=["pytest-cov"],
3531
),
3632
entry_points={
@@ -44,5 +40,6 @@
4440
"Programming Language :: Python :: 3.6",
4541
"Programming Language :: Python :: 3.7",
4642
"Programming Language :: Python :: 3.8",
43+
"Programming Language :: Python :: 3.9",
4744
],
4845
)

0 commit comments

Comments
 (0)