Skip to content

Commit

Permalink
Use GH actions for CI (#86)
Browse files Browse the repository at this point in the history
* added GH action for static verification

* added GH action for unittests

* added pytest coverage as contrib requirement

* removed travis configuration

* changed badges ¯\_(ツ)_/¯

* updated version metadata to match tests
  • Loading branch information
maxfischer2781 authored Mar 23, 2021
1 parent 892bc51 commit e9828eb
Show file tree
Hide file tree
Showing 10 changed files with 68 additions and 42 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/unittests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Unit Tests

on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.6', '3.7', '3.8', '3.9', 'pypy-3.6', 'pypy-3.7']

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .[contrib]
- name: Test with pytest
run: |
pytest --cov=./
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
23 changes: 23 additions & 0 deletions .github/workflows/verification.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Static Checks

on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .[contrib]
- name: Lint with flake8
run: |
flake8 src cobald_tests
- name: Format with black
run: |
black src cobald_tests --diff --check
6 changes: 0 additions & 6 deletions .pep8speaks.yml

This file was deleted.

26 changes: 0 additions & 26 deletions .travis.yml

This file was deleted.

10 changes: 7 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,13 @@ COBalD -- the Opportunistic Balancing Daemon
:target: https://gitter.im/MatterMiners/community
:alt: Development and Help Chat

.. image:: https://travis-ci.org/MatterMiners/cobald.svg?branch=master
:target: https://travis-ci.org/MatterMiners/cobald
:alt: Test Status
.. image:: https://github.com/MatterMiners/cobald/actions/workflows/unittests.yml/badge.svg
:target: https://github.com/maxfischer2781/bootpeg/actions/workflows/unittests.yml
:alt: Unit Tests (master)

.. image:: https://github.com/MatterMiners/cobaldactions/workflows/verification.yml/badge.svg
:target: https://github.com/maxfischer2781/bootpeg/actions/workflows/verification.yml
:alt: Verification (master)

.. image:: https://codecov.io/gh/MatterMiners/cobald/branch/master/graph/badge.svg
:target: https://codecov.io/gh/MatterMiners/cobald
Expand Down
2 changes: 0 additions & 2 deletions setup.cfg

This file was deleted.

3 changes: 3 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
"flake8",
"flake8-bugbear",
"black; implementation_name=='cpython'",
"pytest-cov",
]
+ TESTS_REQUIRE,
},
Expand All @@ -84,6 +85,8 @@
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
],
keywords=package_about["__keywords__"],
# unit tests
Expand Down
7 changes: 4 additions & 3 deletions src/cobald/daemon/runners/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ class ServiceUnit(object):

def __init__(self, service, flavour):
assert hasattr(service, "run"), "service must implement a 'run' method"
assert any(flavour == runner.flavour for runner in MetaRunner.runner_types), (
"service flavour must be one of %s"
% ",".join(repr(runner.flavour) for runner in MetaRunner.runner_types)
assert any(
flavour == runner.flavour for runner in MetaRunner.runner_types
), "service flavour must be one of %s" % ",".join(
repr(runner.flavour) for runner in MetaRunner.runner_types
)
self.service = weakref.ref(service)
self.flavour = flavour
Expand Down
5 changes: 4 additions & 1 deletion src/cobald/interfaces/_pool.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import abc
from typing import TypeVar, Type
from typing import TypeVar, Type, TYPE_CHECKING

from ._partial import Partial

if TYPE_CHECKING:
from ._controller import Controller


C = TypeVar("C", bound="Controller")

Expand Down
2 changes: 1 addition & 1 deletion src/cobald/monitor/format_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class JsonFormatter(Formatter):
:param datefmt: format for timestamps
The ``datefmt`` parameter has almost the same meaning as
:py:class:`~.Formatter`.
:py:class:`~.Formatter`.
Setting it to ``None`` uses the default time format.
However, setting it to any other value that is boolean
false excludes the timestamp from reports.
Expand Down

0 comments on commit e9828eb

Please sign in to comment.