feat: setup CI
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
Aravinth Manivannan 2022-03-19 19:07:02 +05:30
parent 5482c1da86
commit 970ad61748
Signed by: realaravinth
GPG key ID: AD9F0F08E855ED88
4 changed files with 70 additions and 10 deletions

16
.woodpecker.yml Normal file
View file

@ -0,0 +1,16 @@
pipeline:
backend:
image: python
environment:
- DATABSE_URL=postgres://postgres:password@database:5432/postgres
commands:
- pip install virtualenv
- make env
- make lint
- make test
services:
database:
image: postgres
environment:
- POSTGRES_PASSWORD=password

41
Makefile Normal file
View file

@ -0,0 +1,41 @@
define run_migrations ## run migrations
@ . ./venv/bin/activate && python manage.py makemigrations
@ . ./venv/bin/activate && python manage.py migrate
endef
define unimplemented
@echo "ERROR: Unimplemented!" && echo -1.
endef
default: ## Run app
$(call run_migrations)
. ./venv/bin/activate && python manage.py runserver
coverage: ## Generate test coverage report
$(call unimplemented)
doc: ## Generates documentation
$(call unimplemented)
docker: ## Build Docker image from source
$(call unimplemented)
env: ## Install all dependencies
@-virtualenv venv
. ./venv/bin/activate && pip install -r requirements.txt
freeze: ## Freeze python dependencies
@. ./venv/bin/activate && pip freeze > requirements.txt
help: ## Prints help for targets with comments
@cat $(MAKEFILE_LIST) | grep -E '^[a-zA-Z_-]+:.*?## .*$$' | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
lint: ## Run linter
@./venv/bin/black ./payments/*
@./venv/bin/black ./billing/*
migrate: ## Run migrations
$(call run_migrations)
test: ## Run tests
@. ./venv/bin/activate && python manage.py test

View file

@ -9,9 +9,13 @@ https://docs.djangoproject.com/en/4.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/4.0/ref/settings/
"""
import environ
import os
from pathlib import Path
env = environ.Env()
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
@ -27,7 +31,6 @@ DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = [
@ -74,14 +77,9 @@ WSGI_APPLICATION = "payments.wsgi.application"
# https://docs.djangoproject.com/en/4.0/ref/settings/#databases
DATABASES = {
"default": {
"ENGINE": "django.db.backends.postgresql",
"NAME": "postgres",
"HOST": "localhost",
"PORT": "5432",
"PASSWORD": "password",
"USER": "postgres",
}
"default": env.db_url(
"DATABSE_URL", default="postgres://postgres:password@localhost:5432/postgres"
)
}

View file

@ -1,18 +1,23 @@
asgiref==3.5.0
astroid==2.9.3
black==22.1.0
click==8.0.4
Django==4.0.3
django-environ==0.8.1
greenlet==1.1.2
isort==5.10.1
jedi==0.18.1
lazy-object-proxy==1.7.1
mccabe==0.6.1
msgpack==1.0.3
mypy-extensions==0.4.3
parso==0.8.3
pika==1.2.0
pathspec==0.9.0
platformdirs==2.5.1
psycopg2==2.9.3
pylint==2.12.2
pynvim==0.4.3
sqlparse==0.4.2
toml==0.10.2
tomli==2.0.1
wrapt==1.13.3