Repository: inveniosoftware/pywebpack (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 b889c66..0000000
--- a/.travis.yml
+++ /dev/null
@@ -1,67 +0,0 @@
-# This file is part of PyWebpack
-# Copyright (C) 2017 CERN.
-#
-# PyWebpack 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
-
-sudo: false
-
-language: python
-
-jobs:
-  fast_finish: true
-  exclude:
-    - python: 2.7
-      env: REQUIREMENTS=lowest
-    - python: 2.7
-      env: REQUIREMENTS=devel
-
-
-cache:
-  - pip
-
-env:
-  - REQUIREMENTS=lowest
-  - REQUIREMENTS=release
-  - REQUIREMENTS=devel
-
-python:
-  - "2.7"
-  - "3.6"
-  - "3.7"
-  - "3.8"
-
-before_install:
-  - "nvm install 10; nvm use 10"
-  - "npm install -g webpack"
-  - "npm install -g webpack-cli"
-  - "travis_retry pip install --upgrade pip setuptools py"
-  - "travis_retry pip install twine wheel coveralls requirements-builder"
-  - "if [[ $TRAVIS_PYTHON_VERSION != 2.7 ]]; then requirements-builder --level=min setup.py > .travis-lowest-requirements.txt ;fi"
-  - "if [[ $TRAVIS_PYTHON_VERSION != 2.7 ]]; then requirements-builder --level=pypi setup.py > .travis-release-requirements.txt ;fi"
-  - "if [[ $TRAVIS_PYTHON_VERSION != 2.7 ]]; then requirements-builder --level=dev --req requirements-devel.txt setup.py > .travis-devel-requirements.txt ;fi"
-
-install:
-  - "if [[ $TRAVIS_PYTHON_VERSION != 2.7 ]]; then travis_retry pip install -r .travis-${REQUIREMENTS}-requirements.txt; fi"
-  - "travis_retry pip install -e .[all]"
-
-script:
-  - "./run-tests.sh"
-
-after_success:
-  - coveralls
-
-deploy:
-  provider: pypi
-  user: inveniosoftware
-  password:
-    secure: "fhG3SEM8EAsJ1x3fqk03J53GUpmqTKF5WaFmpv6ANsD6MGFth+TnObX4LAp6T9VHPhHZyQMweAjLXQwzOciCSyn53x6jJcyCetEFnGxXIuUCE8VlMUw4XtM5Jj5HknxjnawfCcIsz1ZH8E91D0tkyTTqKGb8IuLmtCCVKTPGmzFnUqIDdxTN0RL0XHrCJBUuar88gzoJ8iZueSyu88+EVMYd7W4JhTjRKcxI/naPnuaSvOzUeZpZw9QkMX6tojZUjfxbnYwD5dy5MTStGZHvRhn1Yet+w3bUKgag6Tu036jizDwH1xOm3Xqm2xHMRxvaZDlxNpZt3fknxmq5BR8veDNB3Z3uUZuPsYY81mg+V5zNcshxtQx25DhP75H00P0XR59aLo8z3Rs27LlzoUPCT+9+i0pIB13++q4UhsuDl31kZQyIL8e1y93iUhX8jXAu6cPqHxE2H8NIdSUvprghUi/emDueyexOm0i6tMEuJ3Y2UGYEU8jtj8/g23Ob+g7R8scAqLffahzd55hx8HThqR9qwx4fZmanPkbOn9EyUFQ8IeKFLxPlrdXclu/ad/HxVbVkghvv6AQSmK5aYwCbIoTlyQWOioS6cFHy1V5WTzPQGiOkmwTYm4Q4/uCP8gODhSCM3/Zo1j18dYtZJSQ44B9o3iGqX2nUF+aW2b8GIzs="
-  distributions: "sdist bdist_wheel"
-  on:
-    tags: true
-    repo: inveniosoftware/pywebpack
-  skip_existing: true
diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst
index 781dcbb..7d98360 100644
--- a/CONTRIBUTING.rst
+++ b/CONTRIBUTING.rst
@@ -114,5 +114,5 @@ Before you submit a pull request, check that it meets these guidelines:
 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.3, 3.4 and 3.5. Check
-   https://travis-ci.org/inveniosoftware/pywebpack/pull_requests
+   https://github.com/inveniosoftware/pywebpack/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 e1494cc..a4091e7 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -25,3 +25,4 @@ recursive-include pywebpack *.py
 recursive-include tests *.js
 recursive-include tests *.json
 recursive-include tests *.py
+recursive-include .github/workflows *.yml
\ No newline at end of file
diff --git a/README.rst b/README.rst
index 5eff597..711755c 100644
--- a/README.rst
+++ b/README.rst
@@ -2,8 +2,8 @@
  PyWebpack
 ===========
 
-.. image:: https://img.shields.io/travis/inveniosoftware/pywebpack.svg
-        :target: https://travis-ci.org/inveniosoftware/pywebpack
+.. image:: https://github.com/inveniosoftware/pywebpack/workflows/CI/badge.svg
+        :target: https://github.com/inveniosoftware/pywebpack/actions?query=workflow%3ACI
 
 .. image:: https://img.shields.io/coveralls/inveniosoftware/pywebpack.svg
         :target: https://coveralls.io/r/inveniosoftware/pywebpack
diff --git a/setup.py b/setup.py
index c121678..c77af15 100644
--- a/setup.py
+++ b/setup.py
@@ -17,19 +17,13 @@
 history = open('CHANGES.rst').read()
 
 tests_require = [
-    'check-manifest>=0.25',
-    'coverage>=4.0',
-    'isort>=4.3.21',
-    'pydocstyle>=1.0.0',
-    'pytest-cache>=1.0',
-    'pytest-cov>=1.8.0',
-    'pytest-pep8>=1.0.6',
-    'pytest>=2.8.0'
+    "pytest-cache>=1.0",
+    "pytest-invenio>=1.4.0"
 ]
 
 extras_require = {
     'docs': [
-        'Sphinx>=1.5.1',
+        '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 9c4e386..67698a5 100644
--- a/pytest.ini
+++ b/pytest.ini
@@ -8,5 +8,5 @@
 # more details.
 
 [pytest]
-pep8ignore = docs/conf.py ALL
-addopts = --pep8 --doctest-glob="*.rst" --doctest-modules --cov=pywebpack --cov-report=term-missing docs tests pywebpack
+addopts = --isort --pydocstyle --pycodestyle --doctest-glob="*.rst" --doctest-modules --cov=pywebpack --cov-report=term-missing
+testpaths = tests pywebpack
\ No newline at end of file
diff --git a/run-tests.sh b/run-tests.sh
index 473edc7..cc4ebe8 100755
--- a/run-tests.sh
+++ b/run-tests.sh
@@ -1,15 +1,19 @@
-#!/usr/bin/env sh
+#!/usr/bin/env bash
 # -*- coding: utf-8 -*-
 #
-# This file is part of PyWebpack
-# Copyright (C) 2017 CERN.
+# This file is part of Invenio.
+# Copyright (C) 2015-2020 CERN.
 #
-# PyWebpack 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.
+# 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 pywebpack 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
\ No newline at end of file