Skip to content

Commit

Permalink
Merge pull request #684 from jazzband/gha
Browse files Browse the repository at this point in the history
Migrate to GitHub Actions.
  • Loading branch information
jezdez authored Nov 26, 2020
2 parents e83a86b + 005313d commit 23ca162
Show file tree
Hide file tree
Showing 10 changed files with 128 additions and 66 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Release

on:
push:
tags:
- '*'

jobs:
build:
if: github.repository == 'jazzband/django-axes'
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Get pip cache dir
id: pip-cache
run: |
echo "::set-output name=dir::$(pip cache dir)"
- name: Cache
uses: actions/cache@v2
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: release-${{ hashFiles('**/setup.py') }}
restore-keys: |
release-
- name: Install dependencies
run: |
python -m pip install -U pip
python -m pip install -U setuptools twine wheel
- name: Build package
run: |
python setup.py --version
python setup.py sdist --format=gztar bdist_wheel
twine check dist/*
- name: Upload packages to Jazzband
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@master
with:
user: jazzband
password: ${{ secrets.JAZZBAND_RELEASE_KEY }}
repository_url: https://jazzband.co/projects/django-axes/upload
48 changes: 48 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Test

on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 5
matrix:
python-version: ['3.6', '3.7', '3.8', '3.9', 'pypy3']

steps:
- uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Get pip cache dir
id: pip-cache
run: |
echo "::set-output name=dir::$(pip cache dir)"
- name: Cache
uses: actions/cache@v2
with:
path: ${{ steps.pip-cache.outputs.dir }}
key:
${{ matrix.python-version }}-v1-${{ hashFiles('**/setup.py') }}
restore-keys: |
${{ matrix.python-version }}-v1-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade tox tox-gh-actions
- name: Tox tests
run: |
tox -v
- name: Upload coverage
uses: codecov/codecov-action@v1
with:
name: Python ${{ matrix.python-version }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
*.pyc
*.swp
.coverage
coverage.xml
.DS_Store
.idea
.mypy_cache/
Expand Down
41 changes: 0 additions & 41 deletions .travis.yml

This file was deleted.

6 changes: 6 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
Changes
=======

Unreleased
----------

- Move tests to GitHub Actions
[jezdez]


5.9.0 (2020-11-05)
------------------
Expand Down
8 changes: 4 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ django-axes
:target: https://django-axes.readthedocs.io/
:alt: Documentation

.. image:: https://secure.travis-ci.org/jazzband/django-axes.svg?branch=master
:target: http://travis-ci.org/jazzband/django-axes
:alt: Build Status
.. image:: https://github.com/jazzband/django-axes/workflows/Test/badge.svg
:target: https://github.com/jazzband/django-axes/actions
:alt: GitHub Actions

.. image:: https://codecov.io/gh/jazzband/django-axes/branch/master/graph/badge.svg
:target: https://codecov.io/gh/jazzband/django-axes
Expand Down Expand Up @@ -89,7 +89,7 @@ Merging contributions requires passing the checks configured
with the CI. This includes running tests and linters successfully
on the currently officially supported Python and Django versions.

The test automation is run automatically by Travis CI, but you can
The test automation is run automatically with GitHub Actions, but you can
run it locally with the ``tox`` command before pushing commits.

Please note that this is a `Jazzband <https://jazzband.co>`_ project.
Expand Down
4 changes: 2 additions & 2 deletions docs/1_requirements.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ Axes requires a supported Django version and runs on Python versions 3.6 and abo

Refer to the project source code repository in
`GitHub <https://github.com/jazzband/django-axes/>`_ and see the
`Travis CI configuration <https://github.com/jazzband/django-axes/blob/master/.travis.yml>`_ and
`Tox configuration <https://github.com/jazzband/django-axes/blob/master/tox.ini>`_ and
`Python package definition <https://github.com/jazzband/django-axes/blob/master/setup.py>`_
to check if your Django and Python version are supported.

The `Travis CI builds <https://travis-ci.org/jazzband/django-axes>`_
The `GitHub Actions builds <https://github.com/jazzband/django-axes/actions>`_
test Axes compatibility with the Django master branch for future compatibility as well.
2 changes: 1 addition & 1 deletion docs/9_development.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Before committing, you can run all the above tests against all supported Python

$ tox

Tox runs the same test set that is run by Travis, and your code should be good to go if it passes.
Tox runs the same test set that is run by GitHub Actions, and your code should be good to go if it passes.

If you wish to limit the testing to specific environment(s), you can parametrize the tox run::

Expand Down
2 changes: 1 addition & 1 deletion pytest.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[pytest]
testpaths = axes/tests
python_files = tests.py test_*.py tests_*.py *_tests.py *_test.py
addopts = --cov axes --cov-config .coveragerc --cov-append --cov-report term-missing
addopts = --cov axes --cov-config .coveragerc --cov-append --cov-report term-missing --cov-report=xml
DJANGO_SETTINGS_MODULE = axes.tests.settings
29 changes: 12 additions & 17 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,37 +1,32 @@
[tox]
envlist =
qa
py{36,37,38,39,py3}-django{22,30,31,master}
py38-qa
py{36,37,38,39,py3}-dj{22,30,31,master}

[travis]
[gh-actions]
python =
3.6: py36
3.7: py37
3.8: py38
3.9: py39
pypy3: pypy3

[travis:env]
DJANGO =
2.2: django22
3.0: django30
3.1: django31
master: djangomaster

[testenv]
deps =
-r requirements-test.txt
django22: django>=2.2,<2.3
django30: django>=3.0,<3.1
django31: django>=3.1,<3.2
djangomaster: https://github.com/django/django/archive/master.tar.gz
dj22: django>=2.2,<2.3
dj30: django>=3.0,<3.1
dj31: django>=3.1,<3.2
djmaster: https://github.com/django/django/archive/master.tar.gz
usedevelop = True
commands =
pytest
commands = pytest
setenv =
PYTHONDONTWRITEBYTECODE=1

[testenv:qa]
[testenv:py{36,37,38,39,py3}-djangomaster]
ignore_errors = True

[testenv:py38-qa]
basepython = python3.8
deps = -r requirements-qa.txt
commands =
Expand Down

0 comments on commit 23ca162

Please sign in to comment.