Skip to content

Feature/40 cookiecutter django #41

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

Merged
merged 6 commits into from
Dec 4, 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
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: 2
updates:
# Update Github actions in workflows
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
61 changes: 61 additions & 0 deletions .github/workflows/backend-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: CI

# Enable Buildkit and let compose use it to speed up image building
env:
DOCKER_BUILDKIT: 1
COMPOSE_DOCKER_CLI_BUILD: 1
DATABASE_URL: pgsql://XDwVOJDPZWeKGECmAgdQMlsrrHgJFiir:EfhBcfu9MS0MNUboMvw7AOOvabRvO2jwDJEACSxXUslei0Me5WmJQE9JXV8oavo3@postgres:5432/personal_website

on:
pull_request:
branches: ["master"]
paths-ignore: ["docs/**"]

push:
branches: ["master"]
paths-ignore: ["docs/**"]

defaults:
run:
working-directory: backend

jobs:
flake8:
runs-on: ubuntu-latest
steps:
- name: Checkout Code Repository
uses: actions/checkout@v2

- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Install flake8
run: |
python -m pip install --upgrade pip
pip install flake8

- name: Lint with flake8
run: flake8

# With no caching at all the entire ci process takes 4m 30s to complete!
pytest:
runs-on: ubuntu-latest
steps:
- name: Checkout Code Repository
uses: actions/checkout@v2
- name: Build the Stack
run: docker-compose -f docker-compose.yml build

- name: Make DB Migrations
run: docker-compose -f docker-compose.yml run --rm django python manage.py migrate

- name: Run the Stack
run: docker-compose -f docker-compose.yml up -d

- name: Run Django Tests
run: docker-compose -f docker-compose.yml exec -e DATABASE_URL=${DATABASE_URL} -T django pytest

- name: Tear down the Stack
run: docker-compose down
4 changes: 4 additions & 0 deletions backend/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.*
!.coveragerc
!.env
!.pylintrc
39 changes: 39 additions & 0 deletions backend/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# http://editorconfig.org

root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.{py,rst,ini}]
indent_style = space
indent_size = 4

[*.py]
line_length = 88
known_first_party = personal_website,config
multi_line_output = 3
default_section = THIRDPARTY
recursive = true
skip = venv/
skip_glob = **/migrations/*.py
include_trailing_comma = true
force_grid_wrap = 0
use_parentheses = true

[*.{html,css,scss,json,yml}]
indent_style = space
indent_size = 2

[*.md]
trim_trailing_whitespace = false

[Makefile]
indent_style = tab

[nginx.conf]
indent_style = space
indent_size = 2
4 changes: 4 additions & 0 deletions backend/.envs/.local/.django
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# General
# ------------------------------------------------------------------------------
USE_DOCKER=yes
IPYTHONDIR=/app/.ipython
7 changes: 7 additions & 0 deletions backend/.envs/.local/.postgres
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# PostgreSQL
# ------------------------------------------------------------------------------
POSTGRES_HOST=postgres
POSTGRES_PORT=5432
POSTGRES_DB=personal_website
POSTGRES_USER=XDwVOJDPZWeKGECmAgdQMlsrrHgJFiir
POSTGRES_PASSWORD=EfhBcfu9MS0MNUboMvw7AOOvabRvO2jwDJEACSxXUslei0Me5WmJQE9JXV8oavo3
1 change: 1 addition & 0 deletions backend/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto
Loading