Repository: inveniosoftware/flask-breadcrumbs (language: python)

Issue:
global: migration to github-actions from travis



Discussion / hints:

Fix patch:
diff --git a/.github/workflows/pypi-release.yml b/.github/workflows/pypi-release.yml
new file mode 100644
index 0000000..ae27d48
--- /dev/null
+++ b/.github/workflows/pypi-release.yml
@@ -0,0 +1,42 @@
+# -*- coding: utf-8 -*-
+#
+# This file is part of Invenio.
+# Copyright (C) 2020 CERN.
+#
+# Invenio 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: Publish
+
+on:
+  push:
+    tags:
+      - v*
+
+jobs:
+  Publish:
+    runs-on: ubuntu-20.04
+
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v2
+
+      - name: Set up Python
+        uses: actions/setup-python@v2
+        with:
+          python-version: 3.8
+
+      - name: Install dependencies
+        run: |
+          python -m pip install --upgrade pip
+          pip install setuptools wheel
+
+      - name: Build package
+        run: python setup.py compile_catalog sdist bdist_wheel
+
+      - name: Publish on PyPI
+        uses: pypa/gh-action-pypi-publish@v1.3.1
+        with:
+          user: __token__
+          # The token is provided by the inveniosoftware organization
+          password: ${{ secrets.pypi_token }}
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index b9fc05d..0000000
--- a/.travis.yml
+++ /dev/null
@@ -1,58 +0,0 @@
-# -*- coding: utf-8 -*-
-#
-# This file is part of Flask-Breadcrumbs
-# Copyright (C) 2013, 2014, 2016 CERN.
-#
-# Flask-Breadcrumbs is free software; you can redistribute it and/or
-# modify it under the terms of the Revised BSD License; see LICENSE
-# file for more details.
-
-notifications:
-  email: false
-
-language: python
-
-cache:
-  - pip
-
-env:
-  - REQUIREMENTS=lowest
-  - REQUIREMENTS=release
-  - REQUIREMENTS=devel
-
-python:
-  - "3.6"
-  - "3.7"
-  - "3.8"
-
-matrix:
-  allow_failures:
-    - env: REQUIREMENTS=devel
-    - python: 3.8
-
-before_install:
-  - "travis_retry pip install --upgrade pip setuptools py"
-  - "travis_retry pip install twine wheel coveralls requirements-builder"
-  - "requirements-builder -e all --level=min setup.py > .travis-lowest-requirements.txt"
-  - "requirements-builder -e all --level=pypi setup.py > .travis-release-requirements.txt"
-  - "requirements-builder -e all --level=dev --req requirements-devel.txt setup.py > .travis-devel-requirements.txt"
-
-install:
-  - "travis_retry pip install -r .travis-${REQUIREMENTS}-requirements.txt"
-  - "travis_retry pip install -e .[all]"
-
-script:
-  - "./run-tests.sh"
-
-after_success:
-  - coveralls
-
-deploy:
-  provider: pypi
-  user: jirikuncar
-  password:
-    secure: Xt9EigqRTy4q7pw1iP58a9k+YTC8WSaeSUJhsfCLvjKYvi5/eAQ/CJneQGliQm4yRIv69WwPsh7IuktmmcQpIdhkDZHN8BTa09B+C5aqx7LhulQGNQoX4oZ7sK0YPg/IRT0bFGLMbP6Hkri5Hr7e7zVFJg2Rkx9zWEtSC5qWTvM=
-  distributions: sdist bdist_wheel
-  skip_existing: true
-  on:
-    tags: true
diff --git a/MANIFEST.in b/MANIFEST.in
index f1a8b40..2777917 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -14,3 +14,4 @@ include docs/*.rst docs/*.py docs/Makefile docs/requirements.txt
 recursive-include docs/_templates *.html
 recursive-include docs/_themes *.py *.css *.css_t *.conf *.html LICENSE README
 recursive-include tests *.py
+recursive-include .github/workflows *.yml
diff --git a/README.rst b/README.rst
index 32fb407..cddb5f2 100644
--- a/README.rst
+++ b/README.rst
@@ -2,8 +2,8 @@
  Flask-Breadcrumbs
 ===================
 
-.. image:: https://travis-ci.org/inveniosoftware/flask-breadcrumbs.png?branch=master
-    :target: https://travis-ci.org/inveniosoftware/flask-breadcrumbs
+.. image:: https://github.com/inveniosoftware/flask-breadcrumbs/workflows/CI/badge.svg
+    :target: https://github.com/inveniosoftware/flask-breadcrumbs/actions
 .. image:: https://coveralls.io/repos/inveniosoftware/flask-breadcrumbs/badge.png?branch=master
     :target: https://coveralls.io/r/inveniosoftware/flask-breadcrumbs
 .. image:: https://pypip.in/v/Flask-Breadcrumbs/badge.png
diff --git a/docs/index.rst b/docs/index.rst
index 6d3472f..f4d5903 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -6,9 +6,9 @@
 .. raw:: html
 
     <p style="height:22px; margin:0 0 0 2em; float:right">
-        <a href="https://travis-ci.org/inveniosoftware/flask-breadcrumbs">
-            <img src="https://travis-ci.org/inveniosoftware/flask-breadcrumbs.png?branch=master"
-                 alt="travis-ci badge"/>
+        <a href="https://github.com/inveniosoftware/flask-breadcrumbs/actions">
+            <img src="https://github.com/inveniosoftware/flask-breadcrumbs/workflows/CI/badge.svg"
+                 alt="github-ci badge"/>
         </a>
         <a href="https://coveralls.io/r/inveniosoftware/flask-breadcrumbs">
             <img src="https://coveralls.io/repos/inveniosoftware/flask-breadcrumbs/badge.png?branch=master"
diff --git a/flask_breadcrumbs/__init__.py b/flask_breadcrumbs/__init__.py
index 2338f9c..d4f1656 100644
--- a/flask_breadcrumbs/__init__.py
+++ b/flask_breadcrumbs/__init__.py
@@ -185,6 +185,7 @@ def _lookup_breadcrumb_root_path():
 # Proxies
 # pylint: disable-msg=C0103
 
+
 #: A proxy for the current function.
 current_function = LocalProxy(_lookup_current_function)
 
diff --git a/setup.py b/setup.py
index c2a060e..7e53dbd 100644
--- a/setup.py
+++ b/setup.py
@@ -17,20 +17,13 @@
 history = open('CHANGES.rst').read()
 
 tests_require = [
-    'check-manifest>=0.25',
-    'coverage>=4.0',
-    'isort>=4.3.11',
     'mock>=1.0.0',
-    'pydocstyle>=1.0.0',
-    'pytest-cache>=1.0',
-    'pytest-cov>=1.8.0',
-    'pytest-pep8>=1.0.6',
-    'pytest>=3.8.0',
+    'pytest-invenio>=1.4.0',
 ]
 
 extras_require = {
     'docs': [
-        'Sphinx>=1.5.1',
+        'Sphinx>=3',
     ],
     'tests': tests_require,
 }
@@ -87,6 +80,7 @@
         'Programming Language :: Python :: 3',
         'Programming Language :: Python :: 3.6',
         'Programming Language :: Python :: 3.7',
+        'Programming Language :: Python :: 3.8',
         'Development Status :: 5 - Production/Stable'
     ],
 )


Test patch:
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
new file mode 100644
index 0000000..fbddaf6
--- /dev/null
+++ b/.github/workflows/tests.yml
@@ -0,0 +1,62 @@
+# -*- coding: utf-8 -*-
+#
+# This file is part of Invenio.
+# Copyright (C) 2020 CERN.
+#
+# Invenio 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:
+    branches: master
+  pull_request:
+    branches: master
+  schedule:
+    # * is a special character in YAML so you have to quote this string
+    - cron:  '0 3 * * 6'
+  workflow_dispatch:
+    inputs:
+      reason:
+        description: 'Reason'
+        required: false
+        default: 'Manual trigger'
+
+jobs:
+  Tests:
+    runs-on: ubuntu-20.04
+    strategy:
+      matrix:
+          python-version: [3.6, 3.7, 3.8]
+          requirements-level: [min, pypi]
+
+    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: Generate dependencies
+        run: |
+          python -m pip install --upgrade pip setuptools py wheel requirements-builder
+          requirements-builder -e all --level=${{ matrix.requirements-level }} setup.py > .${{ matrix.requirements-level }}-${{ matrix.python-version }}-requirements.txt
+
+      - name: Cache pip
+        uses: actions/cache@v2
+        with:
+          path: ~/.cache/pip
+          key: ${{ runner.os }}-pip-${{ hashFiles('.${{ matrix.requirements-level }}-${{ matrix.python-version }}-requirements.txt') }}
+
+      - name: Install dependencies
+        run: |
+          pip install -r .${{ matrix.requirements-level }}-${{ matrix.python-version }}-requirements.txt
+          pip install .[all]
+          pip freeze
+
+      - name: Run tests
+        run: |
+          ./run-tests.sh
diff --git a/pytest.ini b/pytest.ini
index 69ebe1d..294d364 100644
--- a/pytest.ini
+++ b/pytest.ini
@@ -9,4 +9,6 @@
 
 
 [pytest]
-addopts = --pep8 --ignore=docs --cov=flask_breadcrumbs --cov-report=term-missing tests flask_breadcrumbs
+addopts = --isort --pydocstyle --pycodestyle --doctest-glob="*.rst" --doctest-modules --cov=flask_breadcrumbs --cov-report=term-missing
+testpaths = tests flask_breadcrumbs
+filterwarnings = ignore::pytest.PytestDeprecationWarning
diff --git a/run-tests.sh b/run-tests.sh
index a17b93e..5e64e12 100755
--- a/run-tests.sh
+++ b/run-tests.sh
@@ -1,15 +1,20 @@
-#!/bin/sh
+#!/usr/bin/env bash
+# -*- coding: utf-8 -*-
 #
-# This file is part of Flask-Breadcrumbs
-# Copyright (C) 2013, 2014, 2016 CERN.
+# This file is part of Invenio.
+# Copyright (C) 2013-2020 CERN.
 #
 # Flask-Breadcrumbs is free software; you can redistribute it and/or modify
 # it under the terms of the Revised BSD License; see LICENSE file for
 # more details.
 
-pydocstyle flask_breadcrumbs && \
-isort -rc -c -df **/*.py && \
-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
+
+python -m check_manifest --ignore ".*-requirements.txt"
+python -m sphinx.cmd.build -qnNW docs docs/_build/html
+python -m pytest
+python -m sphinx.cmd.build -qnNW -b doctest docs docs/_build/doctest