Repository: inveniosoftware/dictdiffer (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/.gitignore b/.gitignore
index 358c59f..25d3399 100644
--- a/.gitignore
+++ b/.gitignore
@@ -16,7 +16,6 @@
 .coverage
 .tox
 build/
-dictdiffer/version.py
 dist/
 docs/_build
 docs/db
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 9e76596..0000000
--- a/.travis.yml
+++ /dev/null
@@ -1,53 +0,0 @@
-# This file is part of Dictdiffer.
-#
-# Copyright (C) 2014, 2016 CERN.
-# Copyright (C) 2017 ETH Zurich, Swiss Data Science Center, Jiri Kuncar.
-#
-# Dictdiffer is free software; you can redistribute it and/or modify
-# it under the terms of the MIT License; see LICENSE file for more
-# details.
-
-sudo: false
-
-language: python
-
-cache:
-  - pip
-
-python:
-  - "2.7"
-  - "3.4"
-  - "3.5"
-  - "3.6"
-
-matrix:
-  include:
-    - python: "3.7"
-      os: linux
-      dist: xenial
-
-before_install:
-  - "travis_retry pip install --upgrade pip setuptools py"
-  - "travis_retry pip install twine wheel coveralls requirements-builder"
-
-install:
-  - "travis_retry pip install -e .[all]"
-
-script:
-  - "./run-tests.sh"
-
-after_success:
-  - coveralls
-
-notifications:
-  email: false
-
-deploy:
-  provider: pypi
-  user: jirikuncar
-  password:
-    secure: tntrBrJuE3sqJcLxxbzPGj6zltrP/7GgSOFt7q/wn20JWc1SHhutkFqzO2DMShT4YZBlCwwL4jCLsVdMtARCsBIh/p2glTDLFAKC7DfSqwzsnGk/6Q5uyB7NOn7/GPXItyGEJB8cb6QgsMlpMCqv7+mjrL8+HhWVCaZz4B9lzeY=
-  distributions: "sdist bdist_wheel"
-  on:
-    tags: true
-    repo: inveniosoftware/dictdiffer
diff --git a/CHANGES b/CHANGES
index 31e0f8d..5e4175c 100644
--- a/CHANGES
+++ b/CHANGES
@@ -84,7 +84,7 @@ Version 0.1.0 (released 2014-09-01)
 - Fix for issues with strings handled as iterables. (#6)
 - Fix for integer keys. (#12)
 - Regression test for complex dictionaries. (#4)
-- Better testing with Travis CI, tox, pytest, code coverage. (#10)
+- Better testing with Github actions, tox, pytest, code coverage. (#10)
 - Initial release of documentation on ReadTheDocs. (#21 #24)
 - Support for Python 3. (#15)
 
diff --git a/MANIFEST.in b/MANIFEST.in
index 1914f32..abed2b9 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -13,3 +13,4 @@ include .lgtm MAINTAINERS
 include docs/*.rst docs/*.py docs/Makefile docs/requirements.txt
 include *.py *.sh
 include tox.ini tests/*.py
+recursive-include .github/workflows *.yml
diff --git a/README.rst b/README.rst
index dc8f502..dd5a8de 100644
--- a/README.rst
+++ b/README.rst
@@ -2,8 +2,8 @@
  Dictdiffer
 ============
 
-.. image:: https://img.shields.io/travis/inveniosoftware/dictdiffer.svg
-        :target: https://travis-ci.org/inveniosoftware/dictdiffer
+.. image:: https://github.com/inveniosoftware/dictdiffer/workflows/CI/badge.svg
+        :target: https://github.com/inveniosoftware/dictdiffer/actions
 
 .. image:: https://img.shields.io/coveralls/inveniosoftware/dictdiffer.svg
         :target: https://coveralls.io/r/inveniosoftware/dictdiffer
diff --git a/dictdiffer/_compat.py b/dictdiffer/_compat.py
index e0d8173..30979ff 100644
--- a/dictdiffer/_compat.py
+++ b/dictdiffer/_compat.py
@@ -20,12 +20,12 @@
     num_types = int, float
 
 if PY2:
-    from collections import (
-        MutableMapping, MutableSet, MutableSequence, Iterable)
+    from collections import (Iterable, MutableMapping, MutableSequence,
+                             MutableSet)
     from itertools import izip_longest as _zip_longest
 else:
-    from collections.abc import (
-        MutableMapping, MutableSet, MutableSequence, Iterable)
+    from collections import (Iterable, MutableMapping, MutableSequence,
+                             MutableSet)
     from itertools import zip_longest as _zip_longest
 
 izip_longest = _zip_longest
diff --git a/dictdiffer/version.py b/dictdiffer/version.py
new file mode 100644
index 0000000..dfc7d8d
--- /dev/null
+++ b/dictdiffer/version.py
@@ -0,0 +1,6 @@
+# -*- coding: utf-8 -*-
+# Do not change the format of this next line. Doing so risks breaking
+# setup.py and docs/conf.py
+"""Version information for dictdiffer package."""
+
+__version__ = '0.8.2.dev2+dirty'
diff --git a/docs/index.rst b/docs/index.rst
index 0548329..b8d011e 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -3,8 +3,8 @@ Dictdiffer
 ==========
 .. currentmodule:: dictdiffer
 
-.. image:: https://img.shields.io/travis/inveniosoftware/dictdiffer.svg
-        :target: https://travis-ci.org/inveniosoftware/dictdiffer
+.. image:: https://github.com/inveniosoftware/dictdiffer/workflows/CI/badge.svg
+        :target: https://github.com/inveniosoftware/dictdiffer/actions
 
 .. image:: https://img.shields.io/coveralls/inveniosoftware/dictdiffer.svg
         :target: https://coveralls.io/r/inveniosoftware/dictdiffer
diff --git a/setup.py b/setup.py
index b2f4bb2..967e44a 100644
--- a/setup.py
+++ b/setup.py
@@ -20,21 +20,15 @@
 readme = open('README.rst').read()
 
 tests_require = [
-    'check-manifest>=0.25',
-    'coverage>=4.0',
-    'isort>=4.2.2',
+    'pytest-invenio>=1.4.0',
     'mock>=1.3.0',
-    'pydocstyle>=1.0.0',
-    'pytest-cov>=1.8.0',
-    'pytest-pep8>=1.0.6',
-    'pytest>=2.8.0',
     'tox>=3.7.0',
 ]
 
 extras_require = {
     'docs': [
-        'Sphinx>=1.4.4',
-        'sphinx-rtd-theme>=0.1.9',
+        'Sphinx>=3',
+        'sphinx-rtd-theme>=0.2',
     ],
     'numpy': [
         'numpy>=1.11.0',


Test patch:
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
new file mode 100644
index 0000000..9a59efc
--- /dev/null
+++ b/.github/workflows/tests.yml
@@ -0,0 +1,63 @@
+# -*- 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: |
+          sudo apt-get install libxml2-dev libxslt1-dev
+          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 b898f46..f9505b2 100644
--- a/pytest.ini
+++ b/pytest.ini
@@ -7,5 +7,6 @@
 # details.
 
 [pytest]
-pep8ignore = docs/conf.py ALL
-addopts = --pep8 --doctest-glob='*.rst' --doctest-modules --cov=dictdiffer --cov-report=term-missing docs tests dictdiffer
+addopts = --isort --pydocstyle --pycodestyle --doctest-glob="*.rst" --doctest-modules --cov=dictdiffer --cov-report=term-missing
+testpaths = tests dictdiffer
+filterwarnings = ignore::pytest.PytestDeprecationWarning
diff --git a/run-tests.sh b/run-tests.sh
index 378dcf4..6ee1d8c 100755
--- a/run-tests.sh
+++ b/run-tests.sh
@@ -1,4 +1,5 @@
-#!/bin/sh
+#!/usr/bin/env bash
+# -*- coding: utf-8 -*-
 #
 # This file is part of Dictdiffer.
 #
@@ -10,8 +11,13 @@
 # it under the terms of the MIT License; see LICENSE file for more
 # details.
 
-pydocstyle dictdiffer && \
-isort -rc -c -df **/*.py && \
-check-manifest --ignore ".travis-*,dictdiffer/version.py" && \
-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