Skip to content

Commit d934c79

Browse files
committed
Merge branch 'develop'
2 parents 69fc3c1 + 564ee59 commit d934c79

40 files changed

+1119
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- Project/backend/**
9+
pull_request:
10+
branches:
11+
- develop
12+
paths:
13+
- Project/backend/**
14+
15+
defaults:
16+
run:
17+
working-directory: main/Project/backend/
18+
19+
jobs:
20+
test:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Checkout code
24+
uses: actions/checkout@v3
25+
with:
26+
path: main
27+
28+
# Install python
29+
- name: Set up Python 3.11
30+
uses: actions/setup-python@v4
31+
with:
32+
python-version: 3.11
33+
34+
- name: Install dependencies
35+
run:
36+
pip install -r codebase/requirements.txt
37+
38+
- name: Run tests
39+
run: bash scripts/test.sh

Project/backend/.dockerignore

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Ignore files generated by text editors
2+
*~
3+
*.swp
4+
5+
# Ignore version control files and directories
6+
.git
7+
.gitignore
8+
svn
9+
CVS
10+
11+
# Ignore Python bytecode files and cache directories
12+
*.pyc
13+
__pycache__
14+
15+
# Ignore local development settings files
16+
.env
17+
.local
18+
.venv
19+
20+
# Ignore Docker build context directories
21+
.dockerignore
22+
.docker
23+
24+
# Ignore node_modules directory
25+
node_modules
26+
27+
# Ignore media/storage files
28+
/media
29+
30+
#Ignore pytest files
31+
.pytest_cache
32+
/.pytest_cache
33+
.coverage

Project/backend/.env.example

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Application configuration variables
2+
# BACKEND
3+
APP_NAME=amos-knowledge-graph
4+
APP_HOST=0.0.0.0
5+
APP_PORT=8000
6+
APP_ENV='dev' # Could be dev, production or test
7+
DEBUG=True
8+
ALLOWED_HOSTS=*
9+
CSRF_TRUSTED_ORIGINS='*'
10+
CORS_ALLOWED_ORIGINS='*'
11+
12+
# Database
13+
POSTGRES_USER=amos
14+
POSTGRES_PASSWORD=password
15+
POSTGRES_DB=amos
16+
POSTGRES_PORT=5432
17+
POSTGRES_HOST=amos-db
18+
19+
JANUS_PORT=8182

Project/backend/.gitignore

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
### Python template
2+
3+
.idea/
4+
.vscode/
5+
# Byte-compiled / optimized / DLL files
6+
__pycache__/
7+
*.py[cod]
8+
*$py.class
9+
10+
# C extensions
11+
*.so
12+
13+
# Distribution / packaging
14+
.Python
15+
build/
16+
develop-eggs/
17+
dist/
18+
downloads/
19+
eggs/
20+
.eggs/
21+
lib/
22+
lib64/
23+
parts/
24+
sdist/
25+
var/
26+
wheels/
27+
share/python-wheels/
28+
*.egg-info/
29+
.installed.cfg
30+
*.egg
31+
MANIFEST
32+
33+
# PyInstaller
34+
# Usually these files are written by a python script from a template
35+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
36+
*.manifest
37+
*.spec
38+
39+
# Installer logs
40+
pip-log.txt
41+
pip-delete-this-directory.txt
42+
43+
# Unit test / coverage reports
44+
htmlcov/
45+
.tox/
46+
.nox/
47+
.coverage
48+
.coverage.*
49+
.cache
50+
nosetests.xml
51+
coverage.xml
52+
*.cover
53+
*.py,cover
54+
.hypothesis/
55+
.pytest_cache/
56+
cover/
57+
58+
# Translations
59+
*.mo
60+
*.pot
61+
62+
# Django stuff:
63+
*.log
64+
local_settings.py
65+
*.sqlite3
66+
*.sqlite3-journal
67+
68+
# Flask stuff:
69+
instance/
70+
.webassets-cache
71+
72+
# Scrapy stuff:
73+
.scrapy
74+
75+
# Sphinx documentation
76+
docs/_build/
77+
78+
# PyBuilder
79+
.pybuilder/
80+
target/
81+
82+
# Jupyter Notebook
83+
.ipynb_checkpoints
84+
85+
# IPython
86+
profile_default/
87+
ipython_config.py
88+
89+
# pyenv
90+
# For a library or package, you might want to ignore these files since the code is
91+
# intended to run in multiple environments; otherwise, check them in:
92+
# .python-version
93+
94+
# pipenv
95+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
96+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
97+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
98+
# install all needed dependencies.
99+
#Pipfile.lock
100+
101+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
102+
__pypackages__/
103+
104+
# Celery stuff
105+
celerybeat-schedule
106+
celerybeat.pid
107+
108+
# SageMath parsed files
109+
*.sage.py
110+
111+
# Environments
112+
.env
113+
.venv
114+
env/
115+
venv/
116+
ENV/
117+
env.bak/
118+
venv.bak/
119+
120+
# Spyder project settings
121+
.spyderproject
122+
.spyproject
123+
124+
# Rope project settings
125+
.ropeproject
126+
127+
# mkdocs documentation
128+
/site
129+
130+
# mypy
131+
.mypy_cache/
132+
.dmypy.json
133+
dmypy.json
134+
135+
# Pyre type checker
136+
.pyre/
137+
138+
# pytype static type analyzer
139+
.pytype/
140+
141+
# Cython debug symbols
142+
cython_debug/

Project/backend/Makefile

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
include .env
2+
export $(shell sed 's/=.*//' .env)
3+
4+
5+
SHELL := /bin/sh
6+
PROJECTNAME ?= amos-knowledge-graph
7+
APP_NAME := $(PROJECTNAME)
8+
BACKEND_APP_NAME := $(APP_NAME)-backend
9+
DOCKER_COMPOSE != docker compose 1> /dev/null 2> /dev/null && echo docker compose || echo docker-compose
10+
11+
12+
define HELP
13+
14+
Manage $(PROJECTNAME). Usage:
15+
16+
make lint Run linter
17+
make format Run formatter
18+
make test Run tests
19+
make migrations Create migration files e.g: make migrations message="Your migration message here"
20+
make migrate Run migrations
21+
make build-dev Build and run dev environment
22+
make stop-dev Stop dev environment
23+
make all Show help
24+
25+
endef
26+
27+
export HELP
28+
29+
help:
30+
@echo "$$HELP"
31+
32+
lint:
33+
@bash ./scripts/lint.sh
34+
35+
format:
36+
@bash ./scripts/format.sh
37+
38+
test:
39+
@bash ./scripts/test.sh
40+
41+
migrations:
42+
docker exec -it $(BACKEND_APP_NAME) $(SHELL) "-c" \
43+
"alembic revision --autogenerate -m '$(msg)'"
44+
45+
migrate:
46+
docker exec -it $(BACKEND_APP_NAME) $(SHELL) "-c" \
47+
"alembic upgrade head"
48+
49+
50+
build-dev:
51+
DOCKER_BUILDKIT=1 COMPOSE_DOCKER_CLI_BUILD=1 $(DOCKER_COMPOSE) -f docker-compose.yml up --build -d
52+
53+
54+
stop-dev:
55+
@$(DOCKER_COMPOSE) -f docker-compose.yml down
56+
57+
58+
all: help
59+
60+
.PHONY: help lint format test make-migrations migrate build-dev stop-dev all

0 commit comments

Comments
 (0)