Repository: inveniosoftware/idutils (language: python)

Issue:
global: migration to github-actions from travis



Discussion / hints:

Fix patch:
diff --git a/.github/workflows/pypi-publish.yml b/.github/workflows/pypi-publish.yml
new file mode 100644
index 0000000..556367a
--- /dev/null
+++ b/.github/workflows/pypi-publish.yml
@@ -0,0 +1,35 @@
+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
+        # Remove `compile_catalog` if the package has no translations.
+        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 06b6f05..0000000
--- a/.travis.yml
+++ /dev/null
@@ -1,58 +0,0 @@
-# -*- coding: utf-8 -*-
-#
-# This file is part of IDUtils
-# Copyright (C) 2015, 2016 CERN.
-#
-# IDUtils 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.
-#
-# In applying this license, CERN does not waive the privileges and immunities
-# granted to it by virtue of its status as an Intergovernmental Organization
-# or submit itself to any jurisdiction.
-
-notifications:
-  email: false
-
-sudo: false
-
-language: python
-
-python:
-  - "3.6"
-  - "3.7"
-  - "3.8"
-
-matrix:
-  allow_failures:
-    - python: 3.8
-
-env:
-  - REQUIREMENTS=lowest
-  - REQUIREMENTS=release
-
-before_install:
-  - "travis_retry pip install --upgrade pip setuptools py"
-  - "travis_retry pip install twine wheel coveralls requirements-builder"
-  - "requirements-builder --level=min setup.py > .travis-lowest-requirements.txt"
-  - "requirements-builder --level=pypi setup.py > .travis-release-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: lnielsen
-  password:
-    secure: sX/eAcV9W9vCW4fa7rL+mQ0RP9zbhM3LQzQf/A+VW56gdctBA4Ew4FxHYH0QabdZF6Bzq/TQpAQSeSqzZAu3bTBGycMhWBis5z7tIpsUthmab2UDFGKtrlnF5M0u8ZoRlccQ1RNI0FNWF8puB/siCAIZ8/Krl/cwZwFbULAbem3OHAq0Ci3yLnm0STDvjFVo1QfWI40S/JH6uSrZUfTQZnfiDoO7h4nadf9EhKqqVhC5t4QZ5FYLO+iKtfq9IaNLD9iIscDtNCJ1kWqcW33vs84swDe0P0QqDk5WtAhE/MZvfqroeCzUVvX5rkfvUuzxauc8v9GnoLfmgWvCSZZthJ3A58bMKsYFPqviUkyWj9IzRcWa/saFHnZbabaCDXhO59dF/bmxEdNnZnch7hUjWG/IZ7aYUhj1zkkbVnzLoNn0ByBJdFl0q84/ue92x3VUuiR9jy2q//HZN3INr0jsMNikmqg6JwFRH0SGWzVLFUWoLwYe0pr8eXYRh+gL/ShZZ97t8AWcIRiQoJu8K1wFaq0BK1sOQbl637//cq95s4GSauwBhSwxQcFPNhzsp+6Ac70pIYiakeY2Ri/t8hjEFAVW/Z7DTbJ5GCv8Gr8IyhHat6/H3XS58Fw5kPDJrezglOwrxcO+lJecGB7q5WKDC6zxtvw2Ze20HCH/EbaZVtM=
-  distributions: "sdist bdist_wheel"
-  skip_existing: true
-  on:
-    tags: true
diff --git a/MANIFEST.in b/MANIFEST.in
index f748dee..1079cc4 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -26,3 +26,4 @@ include run-tests.sh
 recursive-include *.py *.css *.css_t *.conf *.html
 recursive-include docs *.py
 recursive-include tests *.py
+recursive-include .github/workflows *.yml
\ No newline at end of file
diff --git a/README.rst b/README.rst
index 0ac4dbb..8d0c32d 100644
--- a/README.rst
+++ b/README.rst
@@ -15,8 +15,8 @@
 IDUtils
 =======
 
-.. image:: https://img.shields.io/travis/inveniosoftware/idutils.svg
-        :target: https://travis-ci.org/inveniosoftware/idutils
+.. image:: https://github.com/inveniosoftware/idutils/workflows/CI/badge.svg
+        :target: https://github.com/inveniosoftware/idutils/actions?query=workflow%3ACI
 
 .. image:: https://img.shields.io/coveralls/inveniosoftware/idutils.svg
         :target: https://coveralls.io/r/inveniosoftware/idutils
diff --git a/idutils/__init__.py b/idutils/__init__.py
index 5a23a6a..7b5d8a3 100644
--- a/idutils/__init__.py
+++ b/idutils/__init__.py
@@ -334,14 +334,14 @@
 See https://www.ncbi.nlm.nih.gov/geo/info/overview.html#org
 """
 
-arrayexpress_array_regexp = re.compile("A-({codes})-\d+$".format(
+arrayexpress_array_regexp = re.compile(r"A-({codes})-\d+$".format(
     codes="|".join(ARRAYEXPRESS_CODES)))
 """ArrayExpress array accession.
 
 See https://www.ebi.ac.uk/arrayexpress/help/accession_codes.html
 """
 
-arrayexpress_experiment_regexp = re.compile("E-({codes})-\d+$".format(
+arrayexpress_experiment_regexp = re.compile(r"E-({codes})-\d+$".format(
     codes="|".join(ARRAYEXPRESS_CODES)))
 """ArrayExpress array accession.
 
diff --git a/setup.py b/setup.py
index d2b4bcd..8794a48 100644
--- a/setup.py
+++ b/setup.py
@@ -27,20 +27,14 @@
 ]
 
 tests_require = [
-    'check-manifest>=0.25',
-    'coverage>=4.0',
-    'isort>=4.2.2',
-    'pydocstyle>=1.0',
-    'pytest-cache>=1.0',
-    'pytest-cov>=1.8.0',
-    'pytest-pep8>=1.0.6',
-    'pytest-runner>=2.6.2',
-    'pytest>=3.6.0',
+    "pytest-cache>=1.0",
+    "pytest-runner>=2.6.2",
+    "pytest-invenio>=1.4.0"
 ]
 
 extras_require = {
     'docs': [
-        'Sphinx>=1.4.2',
+        '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..5eb2cba
--- /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
\ No newline at end of file
diff --git a/pytest.ini b/pytest.ini
index 7bd0c5c..67d0f25 100644
--- a/pytest.ini
+++ b/pytest.ini
@@ -23,4 +23,5 @@
 # as an Intergovernmental Organization or submit itself to any jurisdiction.
 
 [pytest]
-addopts = --pep8 --ignore=docs --cov=idutils --cov-report=term-missing
+addopts = --isort --pydocstyle --pycodestyle --doctest-glob="*.rst" --doctest-modules --cov=idutils --cov-report=term-missing
+testpaths = tests idutils
\ No newline at end of file
diff --git a/run-tests.sh b/run-tests.sh
index 5aee240..cc4ebe8 100755
--- a/run-tests.sh
+++ b/run-tests.sh
@@ -1,19 +1,19 @@
-#!/bin/sh
+#!/usr/bin/env bash
+# -*- coding: utf-8 -*-
 #
-# This file is part of IDUtils
-# Copyright (C) 2015, 2016 CERN.
+# This file is part of Invenio.
+# Copyright (C) 2015-2020 CERN.
 #
-# IDUtils 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.
-#
-# In applying this license, CERN does not waive the privileges and immunities
-# granted to it by virtue of its status as an Intergovernmental Organization
-# or submit itself to any jurisdiction.
+# 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.
+
+# Quit on errors
+set -o errexit
+
+# Quit on unbound symbols
+set -o nounset
 
-pydocstyle idutils tests && \
-isort --check-only --diff **/*.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
+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
\ No newline at end of file