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

Migrate to GitHub Actions #270

Merged
merged 5 commits into from
Nov 27, 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/django-configurations'
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-configurations/upload
49 changes: 49 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Test

on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 5
matrix:
python-version: ['2.7', '3.5', '3.6', '3.7', '3.8', '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 }}
Copy link
Member

Choose a reason for hiding this comment

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

The original command for Travis has a bunch of options which aren't used now:

codecov --required -X gcov fix pycov -f coverage.xml --flags ${TOXENV//-/ }

I've not looked those up, but it doesn't seem to have affected coverage? In fact, it's gone up a bit.

I don't think there's analogues for all those options with the action, but at least flags can be added in the with: section:

https://github.com/codecov/codecov-action

Copy link
Member Author

Choose a reason for hiding this comment

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

Right, I looked at them, I only see --required easy to reply, with fail_ci_if_error = true.

-X to disable a feature seems to be not supported by the action.
coverage.xml is automatically found already.
--flags with the tox environment isn't useful anymore since in the new GHA test workflow the test matrix doesn't use TOXENV anymore, so couldn't be used. Unless I'm misunderstanding the notation of ${TOXENV//-/ }? Does this make sense to you?

Copy link
Member

Choose a reason for hiding this comment

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

I'm also not sure what ${TOXENV//-/ } means, but I don't see any $TOXENV actually used in the old Travis CI file, so probably fine to skip 👍

fail_ci_if_error: true
37 changes: 0 additions & 37 deletions .travis.yml

This file was deleted.

1 change: 0 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
include README.rst
include CONTRIBUTING.md
include AUTHORS
include .travis.yml
jezdez marked this conversation as resolved.
Show resolved Hide resolved
include tox.ini
recursive-include tests *
recursive-include docs *
Expand Down
6 changes: 3 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ Check out the `documentation`_ for more complete examples.
.. |latest-version| image:: https://img.shields.io/pypi/v/django-configurations.svg
:alt: Latest version on PyPI
:target: https://pypi.python.org/pypi/django-configurations
.. |build-status| image:: https://img.shields.io/travis/jazzband/django-configurations/master.svg
:alt: Build status
:target: https://travis-ci.org/jazzband/django-configurations
.. |build-status| image:: https://github.com/jazzband/django-configurations/workflows/Test/badge.svg
:target: https://github.com/jazzband/django-configurations/actions
:alt: GitHub Actions
.. |codecov| image:: https://codecov.io/github/jazzband/django-configurations/coverage.svg?branch=master
:alt: Codecov
:target: https://codecov.io/github/jazzband/django-configurations?branch=master
Expand Down
3 changes: 2 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ envlist =
py{35,36,37,38,py3}-dj22
py{36,37,38,py3}-dj{30,master}

[travis]
[gh-actions]
python =
2.7: py27
3.5: py35
Expand All @@ -28,6 +28,7 @@ setenv =
COVERAGE_PROCESS_START = {toxinidir}/setup.cfg
deps =
dj111: django>=1.11,<2.0
dj111: dj-email-url<1.0.0
dj20: django>=2.0a1,<2.1
dj21: django>=2.1a1,<2.2
dj22: django>=2.2a1,<3.0
Expand Down