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/.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" 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