Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
bhnvx committed Mar 6, 2024
1 parent d033544 commit 15e832b
Show file tree
Hide file tree
Showing 20 changed files with 354 additions and 19 deletions.
108 changes: 108 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
name: CI

on:
push:

jobs:
static-analysis:
runs-on: ubuntu-22.04
steps:
- name: Check out the codes
uses: actions/checkout@v2

- name: Setup python environment
id: setup-python
uses: actions/setup-python@v2
with:
python-version: "3.11"

- name: Cache Poetry
id: cache-poetry
uses: actions/cache@v2
with:
key: poetry-1.4.2
path: ~/.local/

- name: Install Poetry
if: steps.cache-poetry.outputs.cache-hit != 'true'
run: |
curl -sSL https://install.python-poetry.org | python3 - --version 1.4.2
- name: Register Poetry bin
run: echo "${HOME}/.poetry/bin" >> $GITHUB_PATH

- name: Cache dependencies
id: cache-venv
uses: actions/cache@v2
with:
key: python-${{ steps.setup-python.outputs.python-version }}-poetry-lock-${{ hashFiles('poetry.lock') }}-toml-${{ hashFiles('pyproject.toml') }}-poetry-1.4.2
path: /home/runner/.cache/pypoetry/virtualenvs/

- name: Install dependencies
if: steps.cache-venv.outputs.cache-hit != 'true'
run: poetry install

- name: Run Black
run: poetry run black . --check

- name: Run Isort
run: poetry run isort . --check --diff

- name: Run Mypy
run: poetry run mypy .

- name: Run Toml Sort
run: poetry run toml-sort pyproject.toml --all --check

test:
runs-on: ubuntu-22.04
env:
LOG_LEVEL: DEBUG

steps:

- name: Set timezone to KST
run: |
sudo rm /etc/localtime
sudo ln -s /usr/share/zoneinfo/Asia/Seoul /etc/localtime
- name: Check out the codes
uses: actions/checkout@v2

- name: Setup python environment
id: setup-python
uses: actions/setup-python@v2
with:
python-version: "3.11"

- name: Cache Poetry
id: cache-poetry
uses: actions/cache@v2
with:
key: poetry-1.4.2
path: ~/.local/

- name: Install Poetry
if: steps.cache-poetry.outputs.cache-hit != 'true'
run: |
curl -sSL https://install.python-poetry.org | python3 - --version 1.4.2
- name: Register Poetry bin
run: echo "${HOME}/.poetry/bin" >> $GITHUB_PATH

- name: Cache dependencies
id: cache-venv
uses: actions/cache@v2
with:
key: python-${{ steps.setup-python.outputs.python-version }}-poetry-lock-${{ hashFiles('poetry.lock') }}-toml-${{ hashFiles('pyproject.toml') }}
path: /home/runner/.cache/pypoetry/virtualenvs/

- name: Install dependencies
if: steps.cache-venv.outputs.cache-hit != 'true'
run: poetry install

- name: Run Pytest
run: |
poetry run coverage run -m pytest --asyncio-mode=auto
poetry run coverage report -m
poetry run coverage html
3 changes: 3 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Empty file added app/__init__.py
Empty file.
Empty file added app/userapp/__init__.py
Empty file.
3 changes: 3 additions & 0 deletions app/userapp/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.contrib import admin

# Register your models here.
6 changes: 6 additions & 0 deletions app/userapp/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.apps import AppConfig


class UserappConfig(AppConfig):
default_auto_field = "django.db.models.BigAutoField"
name = "userapp"
Empty file.
3 changes: 3 additions & 0 deletions app/userapp/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.db import models

# Create your models here.
3 changes: 3 additions & 0 deletions app/userapp/tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.test import TestCase

# Create your tests here.
3 changes: 3 additions & 0 deletions app/userapp/views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.shortcuts import render

# Create your views here.
2 changes: 1 addition & 1 deletion bhnvx/asgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@

from django.core.asgi import get_asgi_application

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "bhnvx.settings")
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "bhnvx.settings_.base")

application = get_asgi_application()
Empty file added bhnvx/settings_/__init__.py
Empty file.
4 changes: 2 additions & 2 deletions bhnvx/settings.py → bhnvx/settings_/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from pathlib import Path

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
BASE_DIR = Path(__file__).resolve().parent.parent.parent


# Quick-start development settings - unsuitable for production
Expand All @@ -25,7 +25,7 @@
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = []
ALLOWED_HOSTS = ["*"]


# Application definition
Expand Down
Empty file added bhnvx/settings_/dev.py
Empty file.
Empty file added bhnvx/settings_/prod.py
Empty file.
2 changes: 1 addition & 1 deletion bhnvx/wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@

from django.core.wsgi import get_wsgi_application

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "bhnvx.settings")
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "bhnvx.settings_.base")

application = get_wsgi_application()
5 changes: 3 additions & 2 deletions manage.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import platform
import sys


def main():
def main() -> None:
"""Run administrative tasks."""
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "bhnvx.settings")
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "bhnvx.settings_.base")
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
Expand Down
Loading

0 comments on commit 15e832b

Please sign in to comment.