Repository: inveniosoftware/invenio-iiif (language: python)

Issue:
global: migration to github-actions from travis



Discussion / hints:

Fix patch:
diff --git a/.editorconfig b/.editorconfig
index 2860269..d183a3f 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -32,8 +32,8 @@ indent_size = 4
 [*.{css,html,js,json,yml}]
 indent_size = 2
 
-# Matches the exact files either package.json or .travis.yml
-[{package.json,.travis.yml}]
+# Matches the exact files either package.json or .github/workflows/*.yml
+[{package.json, .github/workflows/*.yml}]
 indent_size = 2
 
 # Dockerfile
diff --git a/.github/workflows/pypi-release.yml b/.github/workflows/pypi-release.yml
new file mode 100644
index 0000000..7acfdc8
--- /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.7
+
+      - name: Install dependencies
+        run: |
+          python -m pip install --upgrade pip
+          pip install setuptools wheel
+
+      - name: Build package
+        run: python setup.py 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 91755f5..0000000
--- a/.travis.yml
+++ /dev/null
@@ -1,67 +0,0 @@
-# -*- coding: utf-8 -*-
-#
-# This file is part of Invenio.
-# Copyright (C) 2018 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.
-
-notifications:
-  email: false
-
-language: python
-
-matrix:
-  fast_finish: true
-  allow_failures:
-    # To allow failures, you need to specify the full environment
-    - env: REQUIREMENTS=devel
-
-addons:
-  apt:
-    packages:
-    - libfreetype6-dev
-
-cache:
-  - pip
-
-env:
-  - REQUIREMENTS=lowest
-  - REQUIREMENTS=release DEPLOY=true
-  - REQUIREMENTS=devel
-
-python:
-  - "3.6"
-  - "3.7"
-
-before_install:
-  - "pip uninstall -y six"
-  - "nvm install 6; nvm use 6"
-  - "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: inveniosoftware
-  password:
-    secure: ZYK3NxUZoFMjNgcdNrlZYWizH9ndDhf2MtnJ/6qYxCNQt7sOWGV+eDfTORtFyS0X+TGODmFlD6et5NcAikyH03t3F9FlxwJKIvNDdE6mO6uoCe4/ZAjuqf/yy0jlmifcPbTBnhJ3h6P+li/oY8MzyOMA2vQkyfBupDksggS8uJjNV0aFKNq/82FrLYicakkl55qxh10h0wkgjBwcirkWDufbo1SPFFx5GdFQ59O2G55hnz/IP2HtvCGXW++OByi1AR/a54DhZASB3fdaXV9B6nJC+5cVnCKQF3KsySIwuqIFPzHj5WWlDX3xkgxyuv3JyVuFuiqARCGtAer0Wuhju/HOgk3Kp5wKsl0/38vJhFW9EKyFvrdFlk0IKFk0gH/0SVs/O4SjodeuXM+yGlxNveRBriVWgtCHLeY8HwZ1q6a1Vx667ebkvM7LDJPJp6Ax30oOJA3vhnU4V5OZp9GUyBwu3e8y8A6MxPX5jxRzw30JPBw1xIbER0z0WuwXmnyjBXkhGLitLXZ+noPv1vS/DoKd/nB33ntCOhrcCmw8JJEYrUrcHARiV+inZPfcav2XkXqJjoLmO5RWPP2Fbe7pbmfUItMXn5Y4f5lIn/il2+5cux54C0scRWv5ZF9mCudrfJmHoMZvd3VrGN8ZrBZnt4BJvrgDl/95yEhayi84jR8=
-  distributions: "sdist bdist_wheel"
-  skip_existing: true
-  on:
-    tags: true
-    python: "3.6"
-    repo: inveniosoftware/invenio-iiif
-    condition: $DEPLOY = true
diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst
index 9a67d1c..ef060e9 100644
--- a/CONTRIBUTING.rst
+++ b/CONTRIBUTING.rst
@@ -120,6 +120,6 @@ Before you submit a pull request, check that it meets these guidelines:
 1. The pull request should include tests and must not decrease test coverage.
 2. If the pull request adds functionality, the docs should be updated. Put
    your new functionality into a function with a docstring.
-3. The pull request should work for Python 2.7, 3.5 and 3.6. Check
-   https://travis-ci.org/inveniosoftware/invenio-iiif/pull_requests
+3. The pull request should work for Python 3.6, 3.7 and 3.8. Check
+   https://github.com/inveniosoftware/invenio-iiif/actions?query=event%3Apull_request
    and make sure that the tests pass for all supported Python versions.
diff --git a/MANIFEST.in b/MANIFEST.in
index f5d9316..0e3fa10 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -23,5 +23,6 @@ recursive-include docs *.rst
 recursive-include docs *.txt
 recursive-include docs Makefile
 recursive-include invenio_iiif *.html
+recursive-include .github/workflows *.yml
 recursive-include invenio_iiif *.po *.pot *.mo
 recursive-include tests *.py *.jpg
diff --git a/README.rst b/README.rst
index aafcf3c..25b2508 100644
--- a/README.rst
+++ b/README.rst
@@ -12,8 +12,8 @@
 .. image:: https://img.shields.io/github/license/inveniosoftware/invenio-iiif.svg
         :target: https://github.com/inveniosoftware/invenio-iiif/blob/master/LICENSE
 
-.. image:: https://img.shields.io/travis/inveniosoftware/invenio-iiif.svg
-        :target: https://travis-ci.org/inveniosoftware/invenio-iiif
+.. image:: https://github.com/inveniosoftware/invenio-iiif/workflows/CI/badge.svg
+        :target: https://github.com/inveniosoftware/invenio-iiif/actions
 
 .. image:: https://img.shields.io/coveralls/inveniosoftware/invenio-iiif.svg
         :target: https://coveralls.io/r/inveniosoftware/invenio-iiif
diff --git a/setup.py b/setup.py
index 2393ba9..52c5f85 100644
--- a/setup.py
+++ b/setup.py
@@ -16,20 +16,14 @@
 history = open('CHANGES.rst').read()
 
 tests_require = [
-    'check-manifest>=0.25',
-    'coverage>=4.0',
     'urllib3>=1.21.1,<1.25',
     'invenio-db>=1.0.0',
-    'isort>=4.3.4',
-    'pydocstyle>=1.0.0',
-    'pytest-invenio>=1.1.1',
-    'pytest-pep8>=1.0.6',
-    'pytest>=4.0.0,<5.0.0',
+    'pytest-invenio>=1.4.0',
 ]
 
 extras_require = {
     'docs': [
-        'Sphinx>=1.8.0',
+        'Sphinx>=3',
     ],
     'tests': tests_require,
 }


Test patch:
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
new file mode 100644
index 0000000..c07561f
--- /dev/null
+++ b/.github/workflows/tests.yml
@@ -0,0 +1,54 @@
+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 90cccbe..df1d9e4 100644
--- a/pytest.ini
+++ b/pytest.ini
@@ -7,6 +7,5 @@
 # under the terms of the MIT License; see LICENSE file for more details.
 
 [pytest]
-pep8ignore = docs/conf.py ALL
-addopts = --pep8 --doctest-glob="*.rst" --doctest-modules --cov=invenio_iiif --cov-report=term-missing
-testpaths = docs tests invenio_iiif
+addopts = --isort --pydocstyle --pycodestyle --doctest-glob="*.rst" --doctest-modules --cov=invenio_iiif --cov-report=term-missing
+testpaths = tests invenio_iiif
diff --git a/run-tests.sh b/run-tests.sh
index e560920..431dfff 100755
--- a/run-tests.sh
+++ b/run-tests.sh
@@ -1,14 +1,19 @@
-#!/usr/bin/env sh
+#!/usr/bin/env bash
 # -*- coding: utf-8 -*-
 #
 # This file is part of Invenio.
-# Copyright (C) 2018 CERN.
+# Copyright (C) 2015-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.
 
-pydocstyle invenio_iiif tests docs && \
-isort -rc -c -df && \
-check-manifest --ignore ".travis-*" && \
-sphinx-build -qnNW docs docs/_build/html && \
-python setup.py test
+# 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