From ae75a9a51368b4765371d07fbcd26b45693f333c Mon Sep 17 00:00:00 2001 From: abhiabhi94 <13880786+abhiabhi94@users.noreply.github.com> Date: Fri, 20 Aug 2021 05:23:57 +0530 Subject: [PATCH] chore: Migrate to github actions for CI - add separate environment in tox for linters and docs. - switch to codecov for coverage since coveralls doesn't play well with github-actions. - add wheels and setuptools to the environment. Thanks travis for their service till now. --- .github/workflows/docs.yml | 45 ++++++++++++++++++++++++++++ .github/workflows/linters.yml | 35 ++++++++++++++++++++++ .github/workflows/release.yml | 39 +++++++++++++++++++++++++ .github/workflows/tests.yml | 55 +++++++++++++++++++++++++++++++++++ .travis.yml | 49 ------------------------------- README.rst | 12 ++++---- docs/source/introduction.rst | 12 ++++---- tox.ini | 36 +++++++++++++---------- 8 files changed, 206 insertions(+), 77 deletions(-) create mode 100644 .github/workflows/docs.yml create mode 100644 .github/workflows/linters.yml create mode 100644 .github/workflows/release.yml create mode 100644 .github/workflows/tests.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 0000000..9345902 --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,45 @@ +name: Docs + +on: + pull_request: + paths: + - 'docs/**' + push: + branches: + - develop + - master + paths: + - 'docs/**' + +jobs: + docs: + runs-on: ubuntu-latest + name: docs + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.9 + + - name: Cache dependencies + uses: actions/cache@v2 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ hashFiles('docs/source/requirements.txt') }} + restore-keys: | + ${{ runner.os }}-pip- + + - name: Ensure latest setuptools + run: | + python -m pip install --upgrade pip setuptools wheel + + - name: Install dependecies + run: | + python -m pip install --upgrade pip tox + + - name: Build docs + run: | + tox -e docs diff --git a/.github/workflows/linters.yml b/.github/workflows/linters.yml new file mode 100644 index 0000000..e969fa6 --- /dev/null +++ b/.github/workflows/linters.yml @@ -0,0 +1,35 @@ +name: Linters + +on: + pull_request: + push: + branches: + - develop + - master + +jobs: + flake8: + name: flake8 + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.9 + + - name: Ensure latest setuptools + run: | + python -m pip install --upgrade pip setuptools wheel + + - name: Install dependecies + run: | + python -m pip install flake8 + + - name: flake8 + uses: liskin/gh-problem-matcher-wrap@v1 + with: + linters: flake8 + run: flake8 comment diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..9db6503 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,39 @@ +name: Test Release + +on: + pull_request: + push: + branches: + - staging + +jobs: + build-n-publish: + name: Build and publish Python 🐍 distributions 📦 to TestPyPI + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@master + + - name: Set up Python 3.9 + uses: actions/setup-python@v1 + with: + python-version: 3.9 + + - name: Ensure latest setuptools + run: | + python -m pip install --upgrade pip setuptools wheel + + - name: Build wheel and source distribution + run: | + python setup.py sdist bdist_wheel + + - name: Publish distribution 📦 to Test PyPI + if: startsWith(github.ref, 'refs/tags') + uses: pypa/gh-action-pypi-publish@master + with: + user: __token__ + password: ${{ secrets.TEST_PYPI_API_TOKEN }} + repository_url: https://test.pypi.org/legacy/ + verbose: true # allows potentially easier debugging. + + diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..1b5a257 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,55 @@ +name: Tests + +on: + pull_request: + push: + branches: + - develop + - master + +jobs: + tests: + name: Python ${{ matrix.python-version }} + runs-on: ubuntu-latest + + strategy: + fail-fast: false + max-parallel: 5 + matrix: + python-version: + - 3.6 + - 3.7 + - 3.8 + - 3.9 + + 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: Cache dependencies + uses: actions/cache@v2 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ hashFiles('test/example/requirements.txt') }} + restore-keys: | + ${{ runner.os }}-pip- + + - name: Install dependencies + run: | + python -m pip install --upgrade pip setuptools wheel + python -m pip install --upgrade tox tox-py codecov + sudo apt-get install gettext + + - name: Run tox targets for ${{ matrix.python-version }} + run: | + tox --py current + + - name: Coverage reporting + run: | + coverage combine + codecov diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 63cf72e..0000000 --- a/.travis.yml +++ /dev/null @@ -1,49 +0,0 @@ -dist: bionic -os: linux -language: python -cache: pip - -python: - - 3.6 - - 3.7 - - 3.8 - - 3.9 -env: - - DJANGO=2.1 - - DJANGO=2.2 - - DJANGO=3.0 - - DJANGO=3.1 - - DJANGO=3.2 - - DJANGO=main - -install: pip install tox-travis coveralls -script: - - tox -after_success: - - coverage combine - - coveralls - -jobs: - allow_failures: - - if: branch = staging - include: - - stage: deploy - python: 3.7 - env: DJANGO=3.0 - deploy: - - provider: pypi - server: https://test.pypi.org/legacy/ - username: "radico" - password: - secure: l4o0G60jQ6vHoyO4xRWZ9xdNGHOyQxn9AuPXYsLHuDEFXn3CVukg4TPKNZhY6EHbIDKyMWEMqem2g8y6h8Z0oty5A2c54J1Lyf4gDly+qcxY2ToiXY0Cx2FXvIQQfNIKtfqsZdBJGczlPFLtWr9jUj/rNuGlyGK3G8GGDmzms775BgZzWHKVWn7wDaZRCp9qjzLY0IGaTyEJOfH22yWtK/4ZMqWDJmhEhsWOomUeqNM+56xGYW/AOetUyYyZ/x9qdhi1vmAT7Gcm8jJXOY3S69bANxNTJbZqr3HmLRHwro0twZSQ3OvyufTJHvvyvLJBPe5G6/HKqsc7ujSHL+LBmHgwQN71aPW7rkWmcLtfcNsq4eRa/ikRv27RHhejI+6h2trklVjP3BSqlWlY64f/9F7MWef20p4XKlQID6EC+bEY5ZxYAgJmmGSEVjMbtGu3nNwvMoW1J5iLk0QDtk2e4v4P5KZ53ezMtTN3DbbrxlY4VnfrxAAu+q+UvqhfThmuXhbP3LZs0vkEgMjUuRzMxehZ0E6s1F5iPbqGtD8SAQiNEh4Mbv2SIn39OzeXjvDVzCmCnYPKbd/gw54P8IIm0xK6ollWLtF1xABRohc6Zj/pRi60zsTMunmViSzVPH/fa9NsMyIpyO465EfIzZeaD+t+aBEMlJ6vAq/esXnL1cI= - distributions: "sdist bdist_wheel" - on: - branch: staging - - - provider: pypi - username: "radico" - password: - secure: UX5gnwcP6MpSgxfcoYCj7rBiZMHvVjc0NTKgc5pAUZhACJL/iJ074NgtsntDQRn5hm4/ppRMTQfO4a1LJHLA4OiUAQj2cY0ejDijPPPY9zkbtcJnzIIg+gdo45ASGVdJYQOFTzWU1O0HqBRWXMtEDS34nljiESFJ5numPb34ExY+jmU1ZrCUjy6FwSD/WLNpdGQD6l2jS5GlcH7Wog8vnqHj6+BbTaYX8TeODwh9DJRKdHyGk7+hWAAQIYlI5J/XSkw36jDYvxO0UHZbYBX5cW9RUtFlvjwqRBZp0AAFJ6m8Y6isDHWSS0fzkCcvQ2krhrZ7ttY11QyV8vTiP3j4Z+aH8BlEw+yRcnM0KPexllDeHcwrxNzDNOA3R1p6UhfE+lAtJCPhNT3mn6gvuSXCQZbcWHoRW4KJZE/aIu2FNh6vE1r8UfqsipUUwV2MWJEDeAPaUMtiPisUmBdlJjGZ+EPB4VGzeefyNzlWlF0gkYfxq0cO93N4q6JokQuJ3b7gx6uYeM4i9QGueiR4XiIGRP+WYQX4XRyQ5rm3sGQ9R8oaq7lj7c7Vm7/VBEkj9BEXIVao5LIFBBocOUkOoe727JQIgz/oHRJZz+4HvVifVtR0w26w4mkvZeh8Cv8LNLsuiWJ6dpqBJS1xk53PLxRu/pRslC3e6HTV8I8rPQIXPMg= - distributions: "sdist bdist_wheel" - on: - tags: true diff --git a/README.rst b/README.rst index b00d79b..b8b40f0 100644 --- a/README.rst +++ b/README.rst @@ -6,13 +6,13 @@ :target: https://pypi.python.org/pypi/django-comments-dab/ :alt: django -.. image:: https://coveralls.io/repos/github/Radi85/Comment/badge.svg - :target: https://coveralls.io/github/Radi85/Comment - :alt: coverage +.. image:: https://codecov.io/gh/radi85/Comment/branch/main/graph/badge.svg?token=JBorE9i0De + :target: https://codecov.io/gh/radi85/Comment + :alt: Coverage -.. image:: https://travis-ci.org/Radi85/Comment.svg?branch=develop - :target: https://travis-ci.org/Radi85/Comment - :alt: build +.. image:: https://github.com/radi85/Comment/actions/workflows/tests.yml/badge.svg?branch=main + :target: https://github.com/radi85/Comment/actions + :alt: Test .. image:: https://readthedocs.org/projects/django-comment-dab/badge/?version=latest :target: https://django-comment-dab.readthedocs.io/?badge=latest diff --git a/docs/source/introduction.rst b/docs/source/introduction.rst index 27ce82b..ab26156 100644 --- a/docs/source/introduction.rst +++ b/docs/source/introduction.rst @@ -9,13 +9,13 @@ django-comments-dab :target: https://github.com/Radi85/Comment/releases :alt: tag -.. image:: https://travis-ci.org/Radi85/Comment.svg?branch=master - :target: https://travis-ci.org/Radi85/Comment - :alt: build +.. image:: https://img.shields.io/pypi/djversions/django-comments-dab.svg + :target: https://pypi.python.org/pypi/django-comments-dab/ + :alt: django -.. image:: https://coveralls.io/repos/github/Radi85/Comment/badge.svg - :target: https://coveralls.io/github/Radi85/Comment - :alt: coverage +.. image:: https://codecov.io/gh/radi85/Comment/branch/main/graph/badge.svg?token=JBorE9i0De + :target: https://codecov.io/gh/radi85/Comment + :alt: Coverage .. image:: https://img.shields.io/pypi/pyversions/django-comments-dab.svg :target: https://pypi.python.org/pypi/django-comments-dab/ diff --git a/tox.ini b/tox.ini index 866b898..2b07895 100644 --- a/tox.ini +++ b/tox.ini @@ -4,25 +4,32 @@ envlist = py37-django{21, 22, 30, 31, 32} py38-django{21, 22, 30, 31, 32, main} py39-django{21, 22, 30, 31, 32, main} -[travis] + +[gh-actions] python = 3.6: py36 + 3.7: py37 3.8: py38 3.9: py39 -[travis:env] -DJANGO = - 2.1: django21 - 2.2: django22 - 3.0: django30 - 3.1: django31 - 3.2: django32 - main: djangomain +[testenv:docs] +allowlist_externals = + make +deps = + -rdocs/source/requirements.txt + Sphinx + sphinx_rtd_theme +changedir = docs +commands = + make html + +[testenv:flake8] +deps = flake8 +commands = flake8 comment [testenv] deps = coverage - flake8 pillow djangorestframework lxml @@ -36,14 +43,11 @@ deps = djangomain: https://github.com/django/django/archive/main.tar.gz usedevelop = True -ignore_outcome = - djangomain: True commands = - python -m pip install --upgrade pip - flake8 comment/ - python manage.py compilemessages -l test --settings=test.settings.test - python -m coverage run --parallel-mode manage.py test --settings=test.settings.test {posargs} + python manage.py compilemessages -l test + python -m coverage run --parallel-mode manage.py test {posargs} setenv = PYTHONDONTWRITEBYTECODE=1 + DJANGO_SETTINGS_MODULE=test.settings.test