Skip to content

Commit

Permalink
ci: added github actions workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
audrium committed Oct 28, 2020
1 parent e0ff5da commit 80b4c2a
Show file tree
Hide file tree
Showing 7 changed files with 208 additions and 47 deletions.
20 changes: 20 additions & 0 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
codecov:
require_ci_to_pass: yes

coverage:
precision: 2
round: down
range: "80...100"

parsers:
gcov:
branch_detection:
conditional: yes
loop: yes
method: no
macro: no

comment:
layout: "reach,diff,flags,tree"
behavior: default
require_changes: no
125 changes: 125 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
# This file is part of REANA.
# Copyright (C) 2020 CERN.
#
# REANA is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.

name: CI

on: [push, pull_request]

jobs:
lint-shellcheck:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Runs shell script static analysis
run: |
sudo apt-get install shellcheck
./run-tests.sh --check-shellscript
lint-black:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Check Python code formatting
run: |
pip install black==19.10b0
./run-tests.sh --check-black
lint-pydocstyle:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Check compliance with Python docstring conventions
run: |
pip install pydocstyle
./run-tests.sh --check-pydocstyle
lint-check-manifest:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Check Python manifest completeness
run: |
pip install check-manifest
./run-tests.sh --check-manifest
docs-sphinx:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Install system dependencies
run: |
sudo apt-get update -y
sudo apt install libcurl4-openssl-dev libssl-dev
sudo apt-get install libgnutls28-dev
- name: Install Python dependencies
run: |
pip install --upgrade pip setuptools py
pip install -e .[all]
- name: Run Sphinx documentation with doctests
run: ./run-tests.sh --check-sphinx

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

steps:
- name: Checkout
uses: actions/checkout@v2

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

- name: Install Python dependencies
run: |
pip install --upgrade pip setuptools py
pip install twine wheel
pip install -e .[all]
- name: Run pytest
run: ./run-tests.sh --check-pytest

- name: Codecov Coverage
if: matrix.python-version == 3.8
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.xml
35 changes: 0 additions & 35 deletions .travis.yml

This file was deleted.

1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ include LICENSE
include *.rst
include *.sh
include *.yaml
include *.yml
include pytest.ini
prune docs/_build
recursive-include reana_commons *.py
Expand Down
8 changes: 4 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ REANA-Commons
.. image:: https://img.shields.io/pypi/pyversions/reana-commons.svg
:target: https://pypi.org/pypi/reana-commons

.. image:: https://img.shields.io/travis/reanahub/reana-commons.svg
:target: https://travis-ci.org/reanahub/reana-commons
.. image:: https://github.com/reanahub/reana-commons/workflows/CI/badge.svg
:target: https://github.com/reanahub/reana-commons/actions

.. image:: https://readthedocs.org/projects/reana-commons/badge/?version=latest
:target: https://reana-commons.readthedocs.io/en/latest/?badge=latest

.. image:: https://img.shields.io/coveralls/reanahub/reana-commons.svg
:target: https://coveralls.io/r/reanahub/reana-commons
.. image:: https://codecov.io/gh/reanahub/reana-commons/branch/master/graph/badge.svg
:target: https://codecov.io/gh/reanahub/reana-commons

.. image:: https://badges.gitter.im/Join%20Chat.svg
:target: https://gitter.im/reanahub/reana?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge
Expand Down
2 changes: 1 addition & 1 deletion pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
# under the terms of the MIT License; see LICENSE file for more details.

[pytest]
addopts = --ignore=docs --cov=reana_commons --cov-report=term-missing
addopts = --ignore=docs --cov=reana_commons --cov-report=term-missing --cov-report=xml
64 changes: 57 additions & 7 deletions run-tests.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,64 @@
#!/bin/sh
#
# This file is part of REANA.
# Copyright (C) 2018 CERN.
# Copyright (C) 2018, 2019, 2020 CERN.
#
# REANA is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.

pydocstyle reana_commons && \
black --check . && \
check-manifest --ignore ".travis-*" && \
sphinx-build -qnNW docs docs/_build/html && \
python setup.py test && \
sphinx-build -qnNW -b doctest docs docs/_build/doctest
# Quit on errors
set -o errexit

# Quit on unbound symbols
set -o nounset

check_script () {
shellcheck run-tests.sh
}

check_black () {
black --check .
}

check_pydocstyle () {
pydocstyle reana_commons
}

check_manifest () {
check-manifest
}

check_sphinx () {
sphinx-build -qnNW docs docs/_build/html
}

check_pytest () {
python setup.py test
}

check_all () {
check_script
check_black
check_pydocstyle
check_manifest
check_sphinx
check_pytest
}

if [ $# -eq 0 ]; then
check_all
exit 0
fi

for arg in "$@"
do
case $arg in
--check-shellscript) check_script;;
--check-black) check_black;;
--check-pydocstyle) check_pydocstyle;;
--check-manifest) check_manifest;;
--check-sphinx) check_sphinx;;
--check-pytest) check_pytest;;
*)
esac
done

0 comments on commit 80b4c2a

Please sign in to comment.