Skip to content

Commit f7b2cab

Browse files
authored
use GitHub Actions instead of Travis CI
... as Travis does no longer support open source projects. Also: - add support for Python 3.9 - use pre-commit - use pyupgrade - use black
1 parent db6aa36 commit f7b2cab

File tree

13 files changed

+148
-71
lines changed

13 files changed

+148
-71
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"]
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: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
repos:
2+
- repo: https://github.com/psf/black
3+
rev: 20.8b1
4+
hooks:
5+
- id: black
6+
- repo: https://gitlab.com/pycqa/flake8
7+
rev: "3.8.4"
8+
hooks:
9+
- id: flake8
10+
- repo: https://github.com/asottile/pyupgrade
11+
rev: v2.7.4
12+
hooks:
13+
- id: pyupgrade
14+
args: [--py36-plus]

.travis.yml

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

CHANGES.rst

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,14 @@ CHANGES
44
0.2 (unreleased)
55
================
66

7-
- Make Python 3.8 the default testing environment
7+
- Make Python 3 the default testing environment
88
- Drop support for Python versions < 3.6
9+
- Add support for Python 3.9
10+
- Use GitHub Actions instead of Travis CI
11+
(Travis stopped supporting open source projects).
12+
- use pre-commit
13+
- use pyupgrade
14+
- use black
915

1016

1117
0.1 (2016-07-06)

README.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
.. image:: https://github.com/morepath/morepath_static/workflows/CI/badge.svg?branch=master
2+
:target: https://github.com/morepath/morepath_static/actions?workflow=CI
3+
:alt: CI Status
4+
5+
.. image:: https://coveralls.io/repos/github/morepath/morepath_static/badge.svg?branch=master
6+
:target: https://coveralls.io/github/morepath/morepath_static?branch=master
7+
8+
.. image:: https://img.shields.io/pypi/v/morepath_static.svg
9+
:target: https://pypi.org/project/morepath_static/
10+
11+
.. image:: https://img.shields.io/pypi/pyversions/morepath_static.svg
12+
:target: https://pypi.org/project/morepath_static/
13+
14+
115
Morepath_static
216
===============
317

morepath_static/__main__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ def run():
66
morepath.run(App())
77

88

9-
if __name__ == '__main__': # pragma: no cover
9+
if __name__ == "__main__": # pragma: no cover
1010
run()

morepath_static/model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
class Root(object):
1+
class Root:
22
pass

morepath_static/path.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
from .model import Root
33

44

5-
@App.path(model=Root, path='/')
5+
@App.path(model=Root, path="/")
66
def get_root():
77
return Root()

morepath_static/static.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88

99

1010
components = bower.components(
11-
'app', os.path.join(os.path.dirname(__file__), 'bower_components'))
11+
"app", os.path.join(os.path.dirname(__file__), "bower_components")
12+
)
1213

1314

14-
local = bower.local_components('local', components)
15+
local = bower.local_components("local", components)
1516

1617

17-
local.component(os.path.join(os.path.dirname(__file__), 'my_component'),
18-
version=None)
18+
local.component(os.path.join(os.path.dirname(__file__), "my_component"), version=None)
1919

2020

2121
@App.static_components()

morepath_static/tests/test_morepath_static.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,22 @@
66
def test_static_assets():
77
c = Client(App())
88

9-
r = c.get('/')
9+
r = c.get("/")
1010

11-
scripts = r.html.select('script')
11+
scripts = r.html.select("script")
1212
assert len(scripts) == 2
1313

1414
for s in scripts:
15-
c.get(s['src'])
15+
c.get(s["src"])
1616

1717

1818
def test_run(monkeypatch):
1919
import morepath
20+
2021
instances = []
21-
monkeypatch.setattr(morepath, 'run', lambda app: instances.append(app))
22+
monkeypatch.setattr(morepath, "run", lambda app: instances.append(app))
2223

2324
run()
2425

25-
app, = instances
26+
(app,) = instances
2627
assert isinstance(app, App)

0 commit comments

Comments
 (0)