Skip to content
This repository has been archived by the owner on Jun 4, 2021. It is now read-only.

Commit

Permalink
Replace Travis with GitHub Actions and update linting configuration f…
Browse files Browse the repository at this point in the history
…or isort v5 (#257)

* Integrate frontend & backend into 'ci' workflow

* Fix lint errors due to using isort 5.0

* Prior to version 5.0.0, isort wouldn't automatically traverse directories. The --recursive option was necessary to tell it to do so. In 5.0.0 directories are automatically traversed for all Python files, and as such this option is no longer necessary and should simply be removed.

https://timothycrosley.github.io/isort/docs/upgrade_guides/5.0.0/

* Add python_requires to setup.py
  • Loading branch information
cwdavies authored Jul 13, 2020
1 parent 8692d54 commit 0a0302d
Show file tree
Hide file tree
Showing 10 changed files with 98 additions and 27 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: ci

on: pull_request

jobs:

frontend:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Set up Node
uses: actions/setup-node@v1
with:
node-version: 10.x

- name: Install Node dependencies
run: |
npm config set package-lock false
npm install
- name: Lint front-end code
run: npx gulp lint

backend:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Fetch tags and commits needed for setuptools-git-version
run: |
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
git fetch origin ${{ github.head_ref }} && git checkout ${{ github.head_ref }}
git describe --tags --long --dirty
# If the above git describe command doesn't work,
# then setuptools-git-version will also fail.

- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: 3.6

- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install tox
- name: Run back-end tests
run: |
tox
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: Publish

on:
release:
types: [published]

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1

- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: 3.6

- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install wheel
- name: Build the packages
id: build
run: |
python setup.py bdist_wheel
# Get the name of the .whl file and set them as
# "outputs" of this step so we can upload them
echo "::set-output name=bdist_wheel::$(cd dist && ls *.whl)"
- name: Upload the wheel
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: dist/${{ steps.build.outputs.bdist_wheel }}
asset_name: ${{ steps.build.outputs.bdist_wheel }}
asset_content_type: application/zip
23 changes: 0 additions & 23 deletions .travis.yml

This file was deleted.

1 change: 1 addition & 0 deletions retirement_api/tests/test_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from django.core.management import call_command

import mock

from retirement_api.utils.check_api import collector


Expand Down
3 changes: 1 addition & 2 deletions retirement_api/tests/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
try:
from django.urls import include, re_path
except ImportError:
from django.conf.urls import include
from django.conf.urls import url as re_path
from django.conf.urls import include, url as re_path


urlpatterns = [
Expand Down
1 change: 1 addition & 0 deletions retirement_api/utils/tests/test_ss_update_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

import mock
from bs4 import BeautifulSoup as bs

from retirement_api import utils
from retirement_api.utils.ss_update_stats import (
make_soup,
Expand Down
1 change: 1 addition & 0 deletions retirement_api/utils/tests/test_ss_utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import requests
from dateutil.relativedelta import relativedelta
from freezegun import freeze_time

from retirement_api import utils
from retirement_api.models import Calibration
from retirement_api.utils.ss_calculator import (
Expand Down
1 change: 1 addition & 0 deletions retirement_api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from django.utils.translation import activate, deactivate_all, ugettext as _

from dateutil import parser

from retirement_api.models import AgeChoice, Page, Question, Step, Tooltip

from .utils.ss_calculator import get_retire_data
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ def read_file(filename):
],
long_description=read_file("README.md"),
zip_safe=False,
python_requires=">=3.6",
install_requires=install_requires,
setup_requires=setup_requires,
extras_require={"testing": testing_extras,},
Expand Down
3 changes: 1 addition & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ deps=
commands=
black --check retirement_api setup.py
flake8 retirement_api
isort --check-only --diff --recursive retirement_api
isort --check-only --diff retirement_api

[flake8]
ignore=E731,W503,W504
Expand All @@ -45,7 +45,6 @@ lines_after_imports=2
include_trailing_comma=1
multi_line_output=3
skip=.tox,migrations
not_skip=__init__.py
use_parentheses=1
known_django=django
known_future_library=future
Expand Down

0 comments on commit 0a0302d

Please sign in to comment.