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

Revamp development workflow #622

Merged
merged 9 commits into from
Mar 10, 2020
Merged
Show file tree
Hide file tree
Changes from 8 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
File renamed without changes.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.cache
.pytest_cache/
Expand Down
73 changes: 48 additions & 25 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,63 @@
language: python
sudo: false
python:
- '2.7'
- '3.4'
- '3.5'
# System information
os: linux
addons:
postgresql: "9.3"
services:
- redis

cache:
directories:
- $HOME/.pip-cache/
language: python
python: 3.5
Copy link
Member

Choose a reason for hiding this comment

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

Is there any reason for choosing 3.5?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It works -- every other version seems to have some issue with the outdated-and-pinned dependencies.

Copy link
Member

Choose a reason for hiding this comment

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

Ah. Okay. Will keep a note to update this in future if needed.

cache: pip

# Use a two-stage approach, to minimize CI time on failures.
stages:
- primary
- secondary

env: DJANGO_SETTINGS_MODULE="settings.test_settings"

jobs:
include:
# Basic Checks
- stage: primary
env: NOXSESSION=lint-3.5
- env: NOXSESSION=test-3.5
# - env: NOXSESSION=docs

- stage: secondary
env: NOXSESSION=test-3.6
python: 3.6
## Commented out, due to: Pinned psycopg2 not being compatible.
# - env: NOXSESSION=test-3.7
# python: 3.7
## Commented out, due to:
## 1. Pinned celery version not being compatible.
## 2. Pinned Django version not being compatible with newer celery.
## 3. Current codebase needing quite a few changes to be compatible
## with newer Django.
# - env: NOXSESSION=test-3.7
# python: 3.7

install:
- pip install pip==9.0.1
- pip install -r requirements-dev.txt --allow-all-external
- pip install coveralls
- pip install --upgrade pytest
# Get the latest pip
- python -m pip install --upgrade pip
# Reinstall pip, using the latest pip
- python -m pip install --force-reinstall pip

env:
- DJANGO_SETTINGS_MODULE="settings.test_settings"
# Install the CI dependencies
- python -m pip install celery==3.1.20 # pin from requirements.txt
- python -m pip install nox
- python -m pip install coveralls

before_script:
- celery -A junction worker -l info &
pradyunsg marked this conversation as resolved.
Show resolved Hide resolved
script:
- flake8
- pytest --cov -v --tb=native
- coverage report -m

- nox
after_success:
coveralls
- coveralls

notifications:
email:
on_success: change # [always|never|change]
on_failure: always # [always|never|change]

services:
- redis-server

before_script:
- celery -A junction worker -l info &
11 changes: 0 additions & 11 deletions Dockerfile

This file was deleted.

30 changes: 0 additions & 30 deletions docker-compose.yml

This file was deleted.

3 changes: 1 addition & 2 deletions junction/proposals/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ def detail_proposal(request, conference_slug, slug, hashid=None):
proposal = get_object_or_404(Proposal, slug=slug, conference=conference)
return HttpResponseRedirect(proposal.get_absolute_url())

if proposal.deleted == True:
if proposal.deleted:
raise Http404("404")

# Here we have obtained the proposal that we want to display.
Expand Down Expand Up @@ -295,7 +295,6 @@ def proposals_to_review(request, conference_slug):
if not permissions.is_proposal_reviewer(request.user, conference):
raise PermissionDenied


proposals_qs = Proposal.objects.select_related(
'proposal_type', 'proposal_section', 'conference', 'author',
).filter(conference=conference).filter(status=ProposalStatus.PUBLIC).order_by('created_at')
Expand Down
16 changes: 0 additions & 16 deletions mkdocs.yml

This file was deleted.

45 changes: 45 additions & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
"""Automation using nox.
"""

import nox


@nox.session(python=["3.5", "3.6", "3.7", "3.8"])
def test(session):
session.install("-r", "requirements.txt")
session.install("-r", "tools/requirements-test.txt")

session.run("pytest", "--cov", "-v", "--tb=native")
session.run("coverage", "report", "-m")


@nox.session(python=["3.5", "3.6", "3.7", "3.8"])
def lint(session):
session.install("-r", "tools/requirements-lint.txt")
session.run(
"flake8",
"--max-complexity=24",
"--statistics",
"--benchmark",
"--ignore=E5,F4",
"junction/"
)
# TODO: Add tests/ to the arguments above.


@nox.session(python="3.5")
def docs(session):
session.install("-r", "tools/requirements-docs.txt")

def get_sphinx_build_command(kind):
return [
"sphinx-build",
"-W",
"-c", "docs/", # see note above
"-d", "docs/build/_doctrees/" + kind,
"-b", kind,
"docs/" + kind,
"docs/_build/" + kind,
]

session.run(*get_sphinx_build_command("html"))
25 changes: 0 additions & 25 deletions requirements-dev.txt

This file was deleted.

Loading