Skip to content

Commit

Permalink
Add github actions, codecov, readthedocs (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
GianlucaFicarelli authored Nov 22, 2023
1 parent a33a598 commit 58fe05c
Show file tree
Hide file tree
Showing 6 changed files with 110 additions and 18 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/publish-sdist.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Publish sdist tarball to PyPI

on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'

jobs:
build-n-publish:
name: Build and publish on PyPI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.11

- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
python -m pip install build
- name: Build a source tarball
run:
python -m build

- name: Publish distribution package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_PASSWORD }}
39 changes: 39 additions & 0 deletions .github/workflows/run-tox.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Run all tox python3

on:
pull_request:
push:
branches:
- main

jobs:
tests:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11']

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
python -m pip install tox-gh-actions
- name: Run tox
run: |
tox
- name: Upload to codecov
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: false
files: ./coverage.xml
flags: pytest
env_vars: OS,PYTHON
verbose: true
21 changes: 21 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# .readthedocs.yml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

version: 2

sphinx:
configuration: doc/source/conf.py
fail_on_warning: true

python:
install:
- method: pip
path: .
extra_requirements:
- docs

build:
os: ubuntu-22.04
tools:
python: "3"
1 change: 0 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ Installation

``BlueETL-core`` can be installed independently from ``BlueETL`` with::

PIP_INDEX_URL=https://bbpteam.epfl.ch/repository/devpi/simple \
pip install -U blueetl-core


Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
url="https://bbpteam.epfl.ch/documentation/projects/blueetl-core",
project_urls={
"Tracker": "https://bbpteam.epfl.ch/project/issues/projects/NSETM/issues",
"Source": "[email protected]:nse/blueetl-core.git",
"Source": "https://github.com/BlueBrain/blueetl-core.git",
},
license="BBP-internal-confidential",
install_requires=[
Expand All @@ -45,6 +45,7 @@
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Topic :: Scientific/Engineering :: Bio-Informatics",
],
)
32 changes: 16 additions & 16 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ testdeps =

[tox]
envlist =
check-version
check-packaging
lint
py{39,310}
docs
py{39,310,311}

minversion = 3.1.0

Expand All @@ -19,11 +18,16 @@ ignore_basepython_conflict = true
[testenv]
basepython=python3.10
setenv =
PIP_INDEX_URL=https://bbpteam.epfl.ch/repository/devpi/simple
# Run serially
BLUEETL_JOBLIB_JOBS=1
deps = {[base]testdeps}
commands = python -m pytest -vs tests {posargs}
deps =
{[base]testdeps}
coverage[toml]
pytest-cov
commands =
python -m pytest -vs --cov={[base]name} tests/ {posargs}
coverage xml
coverage html

[testenv:check-version]
skip_install = true
Expand Down Expand Up @@ -75,16 +79,6 @@ commands =
black .
allowlist_externals = find

[testenv:coverage]
deps =
{[base]testdeps}
coverage[toml]
pytest-cov
commands =
python -m pytest --cov={[base]name} tests/ {posargs}
coverage xml
coverage html

[testenv:docs]
changedir = doc
extras = docs
Expand All @@ -104,3 +98,9 @@ ignore = E203,E731,W503,W504,E501
# D413: no blank line after last section
add-ignore = D413
convention = google

[gh-actions]
python =
3.9: py39
3.10: py310, lint, docs
3.11: py311

0 comments on commit 58fe05c

Please sign in to comment.