-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from keem-hyun/feat/backend-setting
[BE] 코드 품질 향상 도구 세팅
- Loading branch information
Showing
11 changed files
with
268 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
name: Backend Code Quality CI | ||
|
||
on: | ||
push: | ||
branches: [ develop, release ] | ||
paths: | ||
- 'app/backend/**' | ||
pull_request: | ||
paths: | ||
- 'app/backend/**' | ||
|
||
jobs: | ||
lint-and-test: | ||
# Ubuntu 최신 환경에서 실행 | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
# Github Repository 체크아웃 | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
# python 환경 설정 | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.10" | ||
|
||
# python 버전 표시 | ||
- name : Display Python version | ||
run : python --version | ||
|
||
# Python 패키지 설치 | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r app/backend/requirements.txt | ||
# 코드 포맷팅 Pre-commit 실행 | ||
- name: Run pre-commit | ||
run: | | ||
cd app/backend | ||
pre-commit run --files **/*.py | ||
# 변경사항 확인 | ||
- name: Check for changes | ||
id: git-check | ||
run: | | ||
cd app/backend | ||
git diff --exit-code || echo "changes=true" >> $GITHUB_OUTPUT | ||
# 변경사항 커밋 & 푸시 | ||
- name: Commit and push changes | ||
if: steps.git-check.outputs.changes == 'true' && github.event_name == 'pull_request' | ||
run: | | ||
git config --local user.email "github-actions[bot]@users.noreply.github.com" | ||
git config --local user.name "github-actions[bot]" | ||
git add app/backend | ||
git commit -m "Apply automatic formatting changes" | ||
git push https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git HEAD:${{ github.head_ref }} | ||
# PR에 코멘트 추가 | ||
- name: Comment PR | ||
if: steps.git-check.outputs.changes == 'true' && github.event_name == 'pull_request' | ||
uses: actions/github-script@v6 | ||
with: | ||
github-token: ${{secrets.GITHUB_TOKEN}} | ||
script: | | ||
github.rest.issues.createComment({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.name, | ||
body: '✨ Code has been automatically formatted. Please review the changes.' | ||
}) | ||
# 남은 문제 확인 | ||
- name: Check for remaining issues | ||
if: failure() | ||
run: | | ||
echo "There are still some issues that couldn't be automatically fixed. Please address them manually." | ||
exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
[flake8] | ||
show-source = true | ||
extend-ignore = E203, E266, E501, W503 | ||
exclude = | ||
# No need to traverse our git directory | ||
.git, | ||
# There's no value in checking cache directories | ||
__pycache__, | ||
# The conf file is mostly autogenerated, ignore it | ||
docs/source/conf.py, | ||
# The old directory contains Flake8 2.0 | ||
old, | ||
# This contains our built documentation | ||
build, | ||
# This contains builds of flake8 that we don't want to check | ||
dist, | ||
.gitignore, | ||
*/migrations/* | ||
max-complexity = 10 | ||
max-line-length = 120 | ||
select = B,C,E,F,W,T4,B9,PT | ||
# B : bugbear | ||
# C : comprehensions | ||
# PT : pytest style | ||
#bugbear, comprehensions | ||
extend-select = B950, C4 | ||
#pytest style | ||
pytest-fixture-no-parentheses = True | ||
pytest-mark-no-parentheses = True | ||
per-file-ignores = | ||
__init__.py:F401 | ||
app/utils/prompts.py:W291,W293 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# See https://pre-commit.com for more information | ||
# See https://pre-commit.com/hooks.html for more hooks | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.6.0 | ||
hooks: | ||
- id: trailing-whitespace | ||
- id: end-of-file-fixer | ||
- id: check-yaml | ||
- id: check-added-large-files | ||
- repo: https://github.com/psf/black | ||
rev: 24.8.0 | ||
hooks: | ||
- id: black | ||
language_version: python3.10 | ||
- repo: https://github.com/pycqa/flake8 | ||
rev: 7.1.1 | ||
hooks: | ||
- id: flake8 | ||
additional_dependencies: [flake8-bugbear, flake8-comprehensions, flake8-pytest-style] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,27 @@ | ||
fastapi | ||
uvicorn | ||
sqlalchemy[asyncio]>=2.0.0 | ||
pymysql==1.1.1 | ||
pydantic | ||
passlib | ||
bcrypt | ||
aiomysql | ||
greenlet | ||
python-dotenv | ||
alembic | ||
pytest | ||
cryptography | ||
mysqlclient | ||
alembic | ||
aiohttp | ||
python-jose | ||
boto3 | ||
haversine | ||
aiofiles | ||
asyncpg | ||
asyncpg | ||
flake8 | ||
black | ||
itsdangerous | ||
pydantic-settings | ||
pre-commit | ||
flake8-bugbear | ||
flake8-comprehensions | ||
flake8-pytest-style | ||
isort | ||
mypy |
Oops, something went wrong.