Skip to content

Commit

Permalink
Implement CI/CD pipelines
Browse files Browse the repository at this point in the history
  • Loading branch information
mesca committed May 17, 2020
1 parent 3dd05a9 commit d4c0f6e
Show file tree
Hide file tree
Showing 14 changed files with 174 additions and 49 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: build

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7, 3.8]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Set env
run: echo "::set-env name=PACKAGE::$(basename `git config --get remote.origin.url` | sed -e 's/\.git$//')"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"
- name: Test formatting
run: |
pip install black
black --check $PACKAGE
- name: Test documentation
run: |
cd doc
make html
cd ..
- name: Test code
run: |
pip install pytest pytest-cov
pytest --cov=$PACKAGE -k "not mne"
28 changes: 28 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: publish

on:
release:
types: [created]

jobs:
deploy:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine pep517
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python -m pep517.build .
twine upload dist/*
9 changes: 6 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
__pycache__
*.py[cod]
*$py.class
doc/api
doc/build
*.egg-info
.idea
build/
dist/
.idea
.coverage

doc/**
12 changes: 12 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: 2
formats:
- pdf
python:
version: 3.8
install:
- method: pip
path: .
extra_requirements:
- dev
sphinx:
fail_on_warning: true
14 changes: 0 additions & 14 deletions README.md

This file was deleted.

16 changes: 16 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Timeflux OpenBCI plugin
=======================

This plugin provides a unified interface for all `OpenBCI <https://openbci.com>`__ boards.

Installation
------------

First, make sure that `Timeflux <https://github.com/timeflux/timeflux>`__ is installed.

You can then install this plugin in the `timeflux` environment:

::

$ conda activate timeflux
$ pip install timeflux_openbci
11 changes: 11 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Enable version inference
[tool.setuptools_scm]
local_scheme = "no-local-version"

# Generate documentation shim
[tool.docinit]

# https://setuptools.readthedocs.io/en/latest/build_meta.html
[build-system]
requires = ["setuptools>=42", "wheel", "setuptools_scm[toml]>=3.4", "docinit"]
build-backend = "setuptools.build_meta"
2 changes: 0 additions & 2 deletions requirements.txt

This file was deleted.

43 changes: 43 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
[metadata]
name = timeflux-openbci
description = Timeflux OpenBCI plugin
long_description = file: README.rst
author = Pierre Clisson
author-email = [email protected]
license = MIT
home-page = https://timeflux.io
project_urls =
Documentation = http://doc.timeflux.io/projects/timeflux-openbci/
Source Code = https://github.com/timeflux/timeflux_openbci
Bug Tracker = https://github.com/timeflux/timeflux_openbci/issues
classifier =
Development Status :: 4 - Beta
Environment :: Console
Intended Audience :: Developers
Intended Audience :: Science/Research
License :: OSI Approved :: MIT License
Operating System :: OS Independent
Programming Language :: Python
keywords = timeflux, openbci

[options]
packages = find:
install_requires =
timeflux_brainflow>=0.1
timeflux>=0.5.3

[options.extras_require]
dev =
pytest>=5.3
sphinx>=2.2
sphinx_rtd_theme>=0.4
setuptools_scm
docinit

[docinit]
name = Timeflux OpenBCI
parent_url = https://doc.timeflux.io
logo_url = https://github.com/timeflux/timeflux/raw/master/doc/static/img/logo.png

[build_sphinx]
warning-is-error = 1
31 changes: 3 additions & 28 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,3 @@
""" Setup """

import re
from setuptools import setup, find_packages

with open('README.md', 'rb') as f:
DESCRIPTION = f.read().decode('utf-8')

with open('timeflux_openbci/__init__.py') as f:
VERSION = re.search('^__version__\s*=\s*\'(.*)\'', f.read(), re.M).group(1)

DEPENDENCIES = [
'brainflow',
'timeflux-brainflow @ git+https://github.com/timeflux/timeflux_brainflow',
'timeflux @ git+https://github.com/timeflux/timeflux'
]

setup(
name='timeflux-openbci',
packages=find_packages(),
version=VERSION,
description='Timeflux OpenBCI plugin',
long_description=DESCRIPTION,
author='Pierre Clisson',
author_email='[email protected]',
url='https://timeflux.io',
install_requires=DEPENDENCIES
)
# Required for editable installs
# https://discuss.python.org/t/specification-of-editable-installation/1564/
import setuptools; setuptools.setup()
7 changes: 7 additions & 0 deletions test/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
"""Test configuration"""

import os
import pytest

def pytest_configure(config):
pytest.path = os.path.dirname(os.path.abspath(__file__))
5 changes: 5 additions & 0 deletions test/test_openbci.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import pytest

def test_none():
assert True

1 change: 0 additions & 1 deletion timeflux_openbci/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
__version__ = '0.1.0'
3 changes: 2 additions & 1 deletion timeflux_openbci/nodes/driver.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from timeflux_brainflow.nodes.driver import BrainFlow


class OpenBCI(BrainFlow):

"""OpenBCI driver.
Expand All @@ -21,6 +22,6 @@ class OpenBCI(BrainFlow):
``ip_port``, ``ip_protocol``.
Example:
.. literalinclude:: /../../timeflux_openbci/examples/synthetic.yaml
.. literalinclude:: /../examples/synthetic.yaml
:language: yaml
"""

0 comments on commit d4c0f6e

Please sign in to comment.