Skip to content

Commit

Permalink
Merge pull request #75 from caktus/github-actions
Browse files Browse the repository at this point in the history
Set up GitHub actions
  • Loading branch information
Vinod Kurup authored Dec 16, 2020
2 parents 1e9de07 + 3cd0628 commit cc1f392
Show file tree
Hide file tree
Showing 38 changed files with 1,091 additions and 739 deletions.
9 changes: 9 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[run]
branch = true
source = bread
omit = */tests*

[report]
fail_under = 85
show_missing = true
skip_covered = true
28 changes: 28 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# This workflows will upload a Python Package using Twine when a release is created
# For more information see:
# https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

name: Upload Python Package

on:
release:
types: [created]

jobs:
deploy:
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
77 changes: 77 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: lint-test

on:
pull_request:
schedule:
# run once a week on early monday mornings
- cron: '22 2 * * 1'

jobs:
pre-commit:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: pre-commit/[email protected]

test:
runs-on: ubuntu-20.04
strategy:
matrix:
# tox-gh-actions will only run the tox environments which match the currently
# running python-version. See [gh-actions] in tox.ini for the mapping
python-version: [3.6, 3.7, 3.8, 3.9]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r dev-requirements.txt
- name: Test with tox
run: tox

coverage:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- name: Cache pip
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('dev-requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r dev-requirements.txt
- name: Run coverage report
run: |
coverage run runtests.py
coverage report
build-docs:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- name: Cache pip
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('dev-requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r dev-requirements.txt
- name: Build docs
run: sphinx-build docs docs/_build/html
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ dist
.tox
_build
*.egg-info/
.coverage
30 changes: 30 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.3.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
- id: check-json
- id: check-merge-conflict
- id: check-symlinks
- id: check-yaml
- id: debug-statements
- id: detect-private-key
- id: end-of-file-fixer
- id: mixed-line-ending
- id: trailing-whitespace

- repo: https://github.com/psf/black
rev: 20.8b1
hooks:
- id: black

- repo: https://github.com/pycqa/isort
rev: 5.6.4
hooks:
- id: isort

- repo: https://gitlab.com/pycqa/flake8
rev: master
hooks:
- id: flake8
4 changes: 4 additions & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
3.9.0
3.8.6
3.7.9
3.6.12
15 changes: 0 additions & 15 deletions .travis.yml

This file was deleted.

34 changes: 29 additions & 5 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,34 @@ Python: 3.7, 3.8, 3.9
For Python 2.7 and/or Django 1.11 support, the 0.5 release series is identical (features-wise)
to 0.6 and is available on PyPI: https://pypi.org/project/django-bread/#history

Testing
-------

To run the tests, install "tox" ("pip install tox") and just run it:
Maintainer Information
----------------------

$ tox
...
We use Github Actions to lint (using pre-commit, black, isort, and flake8),
test (using tox and tox-gh-actions), calculate coverage (using coverage), and build
documentation (using sphinx).

We have a local script to do these actions locally, named ``maintain.sh``::

$ ./maintain.sh

A Github Action workflow also builds and pushes a new package to PyPI whenever a new
Release is created in Github. This uses a project-specific PyPI token, as described in
the `PyPI documentation here <https://pypi.org/help/#apitoken>`_. That token has been
saved in the ``PYPI_PASSWORD`` settings for this repo, but has not been saved anywhere
else so if it is needed for any reason, the current one should be deleted and a new one
generated.

As always, be sure to bump the version in ``bread/__init__.py`` before creating a
Release, so that the proper version gets pushed to PyPI.


Questions or Issues?
--------------------

If you have questions, issues or requests for improvements please let us know on
`Github <https://github.com/caktus/django_bread/issues>`_.

Development sponsored by `Caktus Consulting Group, LLC
<https://www.caktusgroup.com/services>`_.
2 changes: 1 addition & 1 deletion bread/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VERSION = '1.0.1'
__version__ = "1.0.1"
Loading

0 comments on commit cc1f392

Please sign in to comment.