Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace Travis CI with GitHub Actions #137

Merged
merged 5 commits into from
Nov 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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/jsonmodels'
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/jsonmodels/upload
53 changes: 53 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Test

on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest
strategy:
max-parallel: 5
matrix:
python-version: ['2.7', '3.5', '3.6', '3.7', '3.8', '3.9', 'pypy2', '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.os }}-${{ matrix.python-version }}-v1-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ matrix.os }}-${{ matrix.python-version }}-v1-


- name: Install enchant
run: |
sudo apt-get -qq update
sudo apt-get -y install enchant

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements.txt

- name: Tests
run: |
python setup.py test

- name: Upload coverage
uses: codecov/codecov-action@v1
with:
name: Python ${{ matrix.python-version }}
35 changes: 0 additions & 35 deletions .travis.yml

This file was deleted.

4 changes: 2 additions & 2 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ 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, and add the
feature to the list in README.rst.
3. The pull request should work for Python 2.7, 3.4, 3.5, 3.6, 3.7, 3.8 and for
PyPy. Check https://travis-ci.org/jazzband/jsonmodels/pull_requests and make
3. The pull request should work for Python 2.7 and 3.5+, and for
PyPy. Check https://github.com/jazzband/jsonmodels/actions and make
sure that the tests pass for all supported Python versions.

Tips
Expand Down
18 changes: 12 additions & 6 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,23 @@
JSON models
===========

.. image:: https://badge.fury.io/py/jsonmodels.png
.. image:: https://jazzband.co/static/img/badge.svg
:target: https://jazzband.co/
:alt: Jazzband

.. image:: https://badge.fury.io/py/jsonmodels.svg
:target: http://badge.fury.io/py/jsonmodels

.. image:: https://travis-ci.org/jazzband/jsonmodels.png?branch=master
:target: https://travis-ci.org/jazzband/jsonmodels
.. image:: https://github.com/jazzband/jsonmodels/workflows/Test/badge.svg
:target: https://github.com/jazzband/jsonmodels/actions
:alt: Tests

.. image:: https://img.shields.io/pypi/dm/jsonmodels.svg
:target: https://pypi.python.org/pypi/jsonmodels

.. image:: https://coveralls.io/repos/jazzband/jsonmodels/badge.png
:target: https://coveralls.io/r/jazzband/jsonmodels
.. image:: https://codecov.io/gh/jazzband/jsonmodels/branch/master/graph/badge.svg
:target: https://codecov.io/gh/jazzband/jsonmodels
:alt: Coverage

.. image:: https://jazzband.co/static/img/badge.svg
:target: https://jazzband.co/
Expand All @@ -29,7 +35,7 @@ are converted to, or read from JSON.
Features
--------

* Fully tested with Python 2.7, 3.4, 3.5, 3.6, 3.7, 3.8.
* Fully tested with Python 2.7, 3.5, 3.6, 3.7, 3.8.

* Support for PyPy (see implementation notes in docs for more details).

Expand Down
5 changes: 3 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Pygments
Sphinx
coverage
docutils
flake8; python_version == '2.7' or python_version >= '3.4'
flake8
invoke
mccabe
mock
Expand All @@ -14,7 +14,8 @@ py
pyflakes
pytest
pytest-cov
sphinxcontrib-spelling
sphinxcontrib-spelling<5.0.0; python_version == '2.7'
sphinxcontrib-spelling; python_version > '2.7'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

tox
virtualenv
wheel
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,18 +73,19 @@ def run_tests(self):
license="BSD",
zip_safe=False,
keywords=PROJECT_NAME,
python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*",
classifiers=[
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Natural Language :: English',
"Programming Language :: Python :: 2",
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
],
cmdclass={
'test': PyTest,
Expand Down
2 changes: 1 addition & 1 deletion tests/test_data_initialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ class Counter(models.Base):
counter2 = Counter(value='2')
assert isinstance(counter2.value, int)
assert counter2.value == 2
if not six.PY3:
if six.PY2:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😬

counter3 = Counter(value=long(3)) # noqa
assert isinstance(counter3.value, int)
assert counter3.value == 3
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py27, py34, py35, py36, py37
envlist = py27, py35, py36, py37, py38, py39

[testenv]
commands = python setup.py test
Expand Down