From c53975830a89859131136cc43c956ec6425f4d5d Mon Sep 17 00:00:00 2001 From: Shounak Dey Date: Sun, 2 Feb 2025 17:51:02 +0530 Subject: [PATCH 1/2] Configure automated code quality checks Signed-off-by: Shounak Dey --- .github/workflows/quality.yml | 32 ++++++++++++++++++++++++++++++++ tox.ini | 9 +++++++-- 2 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/quality.yml diff --git a/.github/workflows/quality.yml b/.github/workflows/quality.yml new file mode 100644 index 0000000..f6e507f --- /dev/null +++ b/.github/workflows/quality.yml @@ -0,0 +1,32 @@ +--- +name: Checking code quality + +on: [push, pull_request] + +jobs: + + ci-qlty: + + runs-on: ubuntu-latest + + container: fedorapython/fedora-python-tox:latest + + strategy: + fail-fast: false + + steps: + + - name: Checkout the codebase current state + uses: actions/checkout@v4 + + - name: Install the base dependencies + run: | + python3 -m pip install --upgrade poetry tox + + - name: Check the correctness of the project config + run: | + poetry check + + - name: Check the quality of the code + run: | + tox -e cleaning \ No newline at end of file diff --git a/tox.ini b/tox.ini index 522500f..d6e80a9 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py{311,312} +envlist = py{311,312},cleaning isolated_build = true [testenv] @@ -10,6 +10,11 @@ set_env = allowlist_externals = poetry commands_pre = + pip3 install --upgrade poetry poetry install --all-extras commands = - poetry run pytest -vvvv --cov=fastapi_ecom --cov-report=html --cov-report=xml --cov-report=term-missing tests {posargs} \ No newline at end of file + poetry run pytest -vvvv --cov=fastapi_ecom --cov-report=html --cov-report=xml --cov-report=term-missing tests {posargs} + +[testenv:cleaning] +commands = + poetry run ruff check fastapi_ecom/ tests/ \ No newline at end of file From 4ee7e3d8340183bdb39cf827278c425b86817570 Mon Sep 17 00:00:00 2001 From: Shounak Dey Date: Sun, 2 Feb 2025 18:22:08 +0530 Subject: [PATCH 2/2] Configure automated code functionality checks Signed-off-by: Shounak Dey --- .github/workflows/tests.yml | 35 +++++++++++++++++++++++++++ fastapi_ecom/config/config.py.example | 6 ++--- 2 files changed, 38 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/tests.yml diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..27a8be9 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,35 @@ +--- +name: Checking code functionality + +on: [push, pull_request] + +jobs: + + ci-qlty: + + runs-on: ubuntu-latest + + container: fedorapython/fedora-python-tox:latest + + strategy: + fail-fast: false + matrix: + tox-env: ["py312"] + + steps: + + - name: Checkout the codebase current state + uses: actions/checkout@v4 + + - name: Install the base dependencies + run: | + python3 -m pip install --upgrade poetry tox + + - name: Copy the default database, server and alembic configuration files + run: | + mv fastapi_ecom/config/config.py.example fastapi_ecom/config/config.py + mv fastapi_ecom/migrations/alembic.ini.example fastapi_ecom/migrations/alembic.ini + + - name: Check the functionality of the code + run: | + tox -e ${{ matrix.tox-env }} \ No newline at end of file diff --git a/fastapi_ecom/config/config.py.example b/fastapi_ecom/config/config.py.example index d126f27..9825791 100644 --- a/fastapi_ecom/config/config.py.example +++ b/fastapi_ecom/config/config.py.example @@ -1,11 +1,11 @@ # The database name -database = "" +database = "test_db" # The username for the database user -username = "" +username = "test_user" # The password for the database user -password = "" +password = "test_pwd" # The location of serving the database service dtbsbhost = "localhost"