From 1bcfca75fb8ec0fefe7eec132e537313ed5f3942 Mon Sep 17 00:00:00 2001 From: riroan Date: Sun, 25 Aug 2024 00:37:53 +0900 Subject: [PATCH] =?UTF-8?q?CI=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yaml | 34 ++++++++++++++++++++++++++++++++++ service/product.py | 2 +- settings.py | 10 +++++----- 3 files changed, 40 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/ci.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..c5be715 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,34 @@ +name: CI + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - name: Check out repository code + uses: actions/checkout@v3 + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + + - name: Check lint + run: | + pre-commit run --all-files + + - name: Build docker image + run: | + docker build -t pangtok:latest . + + - name: Run tests in docker container + run: | + docker run --rm pangtok:latest python -m pytest diff --git a/service/product.py b/service/product.py index ad2638c..b8a630a 100644 --- a/service/product.py +++ b/service/product.py @@ -25,7 +25,7 @@ async def show_product( dislike_user_ids = [ like.user_id for like in likes if like.is_like == LikeStatus.DISLIKE ] - + return ProductResponseDto.from_entity( product=product, like_count=len(like_user_ids), diff --git a/settings.py b/settings.py index c63063c..e964acc 100644 --- a/settings.py +++ b/settings.py @@ -9,11 +9,11 @@ class Settings(BaseSettings): env_file='.env', env_file_encoding='utf-8' ) - db_name: str - db_user: str - db_password: str - db_host: str - db_port: int + db_name: str = str() + db_user: str = str() + db_password: str = str() + db_host: str = str() + db_port: int = int() def get_db_url(self): return URL.create(