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 695ae81 commit 4f5d156
Show file tree
Hide file tree
Showing 14 changed files with 209 additions and 176 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/*
105 changes: 7 additions & 98 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,104 +1,13 @@
# Byte-compiled / optimized / DLL files
__pycache__/
.DS_Store
.cache
.pytest_cache
__pycache__
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
*.egg-info
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.idea
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
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
16 changes: 0 additions & 16 deletions README.md

This file was deleted.

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

This plugin provides a driver to connect to `BITalino <https://bitalino.com>`__ devices.

When connecting a BITalino device for the first time, the default pairing code is: `1234`.

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_bitalino
6 changes: 0 additions & 6 deletions environment.yml

This file was deleted.

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"
44 changes: 44 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
[metadata]
name = timeflux-bitalino
description = Timeflux BITalino plugin
long_description = file: README.rst
author = Pierre Clisson
author-email = contact@timeflux.io
license = MIT
home-page = https://timeflux.io
project_urls =
Documentation = http://doc.timeflux.io/projects/timeflux-bitalino/
Source Code = https://github.com/timeflux/timeflux_bitalino
Bug Tracker = https://github.com/timeflux/timeflux_bitalino/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, bitalino

[options]
packages = find:
install_requires =
pyserial>=3.4
bitalino>=1.2
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 BITalino
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_bitalino/__init__.py') as f:
VERSION = re.search('^__version__\s*=\s*\'(.*)\'', f.read(), re.M).group(1)

DEPENDENCIES = [
'pyserial',
'bitalino',
'timeflux @ git+https://github.com/timeflux/timeflux'
]

setup(
name='timeflux-bitalino',
packages=find_packages(),
version=VERSION,
description='Timeflux BITalino plugin',
long_description=DESCRIPTION,
author='Pierre Clisson',
author_email='contact@timeflux.io',
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_bitalino.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import pytest

def test_none():
assert True

2 changes: 1 addition & 1 deletion timeflux_bitalino/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.1.0'
__version__ = "0.1.0"

0 comments on commit 4f5d156

Please sign in to comment.