Skip to content

Commit

Permalink
chore: Migrate to github actions for CI
Browse files Browse the repository at this point in the history
- 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.
  • Loading branch information
abhiabhi94 authored and Radi85 committed Aug 29, 2021
1 parent a539232 commit ae75a9a
Show file tree
Hide file tree
Showing 8 changed files with 206 additions and 77 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -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
35 changes: 35 additions & 0 deletions .github/workflows/linters.yml
Original file line number Diff line number Diff line change
@@ -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
39 changes: 39 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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.


55 changes: 55 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -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
49 changes: 0 additions & 49 deletions .travis.yml

This file was deleted.

12 changes: 6 additions & 6 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions docs/source/introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down
36 changes: 20 additions & 16 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

0 comments on commit ae75a9a

Please sign in to comment.