Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
42b446d
♻️ refactor: app 폴더 구조 변경
taewoo-dev Jun 1, 2025
d1f0957
♻️ refactor: app 폴더 구조 변경 2
taewoo-dev Jun 1, 2025
2de1cd6
✨ refactor: alchemy & tortoise 분리
taewoo-dev Jun 1, 2025
742875c
♻️ test : test setting 추가
taewoo-dev Jun 3, 2025
cadcaf2
♻️ refactor: badge router DTO 네이밍 변경
taewoo-dev Jun 3, 2025
100e3b2
♻️ refactor: cheese router DTO 구조 변경
taewoo-dev Jun 3, 2025
cea8f7b
♻️ refactor: color router DTO 구조 변경
taewoo-dev Jun 3, 2025
3c5479b
♻️ refactor: emotion router DTO 구조변경
taewoo-dev Jun 3, 2025
00a712b
♻️ refactor: payment router 역할분리
taewoo-dev Jun 3, 2025
17a8812
♻️ refactor: teller card router DTO 구조 변경
taewoo-dev Jun 10, 2025
1cef705
♻️ refactor: mobile router DTO 구조변경
taewoo-dev Jun 10, 2025
a0817e4
♻️ refactor: mission router DTO 구조 변경
taewoo-dev Jun 11, 2025
d04d640
♻️ refactor: CI 리팩토링
taewoo-dev Jun 11, 2025
0fcf0c1
✅ test: fixture tortoise connection error fix
taewoo-dev Jun 12, 2025
d239a90
✅ test: add badge router
taewoo-dev Jun 12, 2025
a15a545
✅ test: add color router
taewoo-dev Jun 12, 2025
564034d
✅ test: add emotion router
taewoo-dev Jun 12, 2025
c0616b0
✅ test: add cheese router
taewoo-dev Jun 12, 2025
55bad81
✅ test: add color,emotion router premium case
taewoo-dev Jun 12, 2025
c5de4ad
✅ test: add inventory db clean up function
taewoo-dev Jun 12, 2025
96f3c33
✅ test: add teller card router
taewoo-dev Jun 12, 2025
368f2ae
✅ test: add mobile router
taewoo-dev Jun 12, 2025
cfe10c4
💡 chore: add time machine
taewoo-dev Jun 12, 2025
98701c0
✅ test: add payment router
taewoo-dev Jun 13, 2025
a7c068a
✅ test: mission router
taewoo-dev Jun 13, 2025
3cbe919
💡 chore: CI add redis
taewoo-dev Jun 13, 2025
1f80dd2
💡 chore: CI fix env settings
taewoo-dev Jun 13, 2025
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
154 changes: 132 additions & 22 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
@@ -1,41 +1,151 @@
name: Code Quality Checks
name: CI

on:
push:
branches:
- develop
pull_request:

jobs:
ci:
runs-on: ubuntu-latest

jobs:
static-analysis: # mypy, black, ruff 등 정적 분석
runs-on: ubuntu-22.04 # 실제 프로덕션에서는 모든 버전을 고정하는 것이 좋다.
# 예기치 못하게 버전이 올라가서 장애나는 것을 막기 위해
steps:
- name: Checkout code
uses: actions/checkout@v3
- 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.12"

- name: Set up Python
uses: actions/setup-python@v4
- name: Cache Poetry
id: cache-poetry
uses: actions/cache@v4
with:
python-version: '3.12'
key: poetry-1.8.5
path: ~/.local/ # poetry 는 ~/.local 에 설치되므로, 이 디렉터리를 통째로 캐시할 것입니다.

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

- name: Register Poetry bin
run: echo "${HOME}/.poetry/bin" >> $GITHUB_PATH

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

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

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

- name: Run Ruff
run: |
poetry run ruff check --select I
poetry run ruff check

- name: Run Mypy
run: poetry run mypy .

test: # 전체 테스트 실행한다.
runs-on: ubuntu-22.04

services:
redis:
image: redis:7.2-alpine
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 5s
--health-timeout 5s
--health-retries 5
env:
MYSQL_HOST: 127.0.0.1
MYSQL_PORT: 3306
MYSQL_USER: root
MYSQL_PASSWORD: password
MYSQL_DATABASE: tellingme_local
REDIS_HOST: localhost

- name: Install Packages & Libraries
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.12"

- name: Cache Poetry
id: cache-poetry
uses: actions/cache@v4
with:
key: poetry-1.8.5
path: ~/.local/ # poetry 는 ~/.local 에 설치되므로, 이 디렉터리를 통째로 캐시할 것입니다.

- name: Install Poetry
if: steps.cache-poetry.outputs.cache-hit != 'true'
run: |
poetry install
curl -sSL https://install.python-poetry.org | python3 - --version 1.8.5

- name: Register Poetry bin
run: echo "${HOME}/.poetry/bin" >> $GITHUB_PATH

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

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

- name: Set timezone to KST
run: |
poetry run isort . --check --diff
sudo rm /etc/localtime
sudo ln -s /usr/share/zoneinfo/Asia/Seoul /etc/localtime

- name: Run black (Code formatting)
- name: Start Mysql
run: |
poetry run black . --check
sudo systemctl start mysql
mysql -e "use mysql; FLUSH PRIVILEGES; ALTER USER '${{ env.MYSQL_USER }}'@'localhost' IDENTIFIED BY '${{ env.MYSQL_PASSWORD }}';" -uroot -proot
mysql -e 'CREATE DATABASE ${{ env.MYSQL_DATABASE }};' -u${{ env.MYSQL_USER }} -p${{ env.MYSQL_PASSWORD }}

- name: Run Mypy
- name: Run tests
run: |
poetry run mypy .
poetry run coverage run -m pytest .
poetry run coverage report -m


# deploy:
# runs-on: ubuntu-24.04
# needs: [test, static-analysis]
# if: github.ref == 'refs/heads/main'
# steps:
# - name: Check out the codes
# uses: actions/checkout@v3
#
# - name: deploy staging
# env:
# PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY_STAGING }}
# HOSTNAME: ${{ secrets.SSH_HOST_STAGING }}
# USER_NAME: ${{ secrets.USER_NAME_STAGING }}
#
# # staging 서버의 .bashrc 에 gunicorn_reload 가 정의되어 있습니다. gunicorn master 에게 HUP 를 줘서 worker 를 재시작합니다.
# run: |
# echo "$PRIVATE_KEY" > private_key && chmod 600 private_key
# ssh -o StrictHostKeyChecking=no -t -i private_key ${USER_NAME}@${HOSTNAME} "bash -i -c 'gunicorn_reload'"

# todo : CD 작성하기
Loading