From 5935a46596bb493c3f54c6b1009842b0ec4506b2 Mon Sep 17 00:00:00 2001 From: Max Date: Sun, 27 Jul 2025 01:39:36 +0300 Subject: [PATCH 1/4] chore(env): Update .env.example --- .env.example | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.env.example b/.env.example index 7fdd6b7..69d2416 100644 --- a/.env.example +++ b/.env.example @@ -8,10 +8,11 @@ DJANGO_SECRET_KEY=your_django_secret_key DJANGO_ALLOWED_HOSTS=localhost,127.0.0.1,0.0.0.0 POSTGRES_DATABASE=your_postgres_database_name -POSTGRES_HOST=db POSTGRES_PASSWORD=your_postgres_password -POSTGRES_PORT=5432 POSTGRES_USERNAME=your_postgres_username +POSTGRES_HOST=db +POSTGRES_PORT=5432 + REDIS_HOST=redis REDIS_PORT=6379 From 6a5d4bcdc2aa0922b04725e5fd39d2c759622a5a Mon Sep 17 00:00:00 2001 From: Max Date: Sun, 27 Jul 2025 18:00:32 +0300 Subject: [PATCH 2/4] ci: Fix coverage reporting and update CI badge This commit resolves issues with the CI workflow related to code coverage reporting. - Explicitly specifies the coverage configuration file (`--rcfile=.coveragerc`) to ensure correct settings are applied during tests. - Adds a step to copy the `coverage.xml` report from the Docker container to the host, making it available for the Codecov action. - Updates the CI status badge in the README to point to the correct workflow file. --- .github/workflows/ci.yml | 5 ++++- README.md | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e2d67a5..d8bb812 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -66,7 +66,10 @@ jobs: - name: Run tests and generate coverage report 🛡️ run: > docker compose exec -T web sh -c - "cd promo_code && coverage run manage.py test && coverage xml" + "cd promo_code && coverage run --rcfile=.coveragerc manage.py test && coverage xml" + + - name: Copy coverage report from container 📂 + run: docker compose cp web:/app/promo_code/coverage.xml ./coverage.xml - name: Upload coverage to Codecov 🚀 uses: codecov/codecov-action@v5 diff --git a/README.md b/README.md index 5824957..49b62fb 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Promo Code API -[![CI/CD](https://github.com/RandomProgramm3r/Promo-Code-API/actions/workflows/linting.yml/badge.svg)](https://github.com/RandomProgramm3r/Promo-Code-API/actions) +[![CI/CD](https://github.com/RandomProgramm3r/Promo-Code-API/actions/workflows/ci.yml/badge.svg)](https://github.com/RandomProgramm3r/Promo-Code-API/actions) [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff) [![codecov](https://codecov.io/github/RandomProgramm3r/Promo-Code-API/graph/badge.svg?token=VNBK0FAU3Z)](https://codecov.io/github/RandomProgramm3r/Promo-Code-API) From 838f46c1e6445236c3edfbd7a6f2174d05eebae5 Mon Sep 17 00:00:00 2001 From: Max Date: Sun, 27 Jul 2025 18:18:53 +0300 Subject: [PATCH 3/4] fix(ci): Correct coverage report path in workflow This commit updates the CI workflow to use the correct path when copying the coverage report from the Docker container. The previous path was incorrect, causing the Codecov upload step to fail. --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d8bb812..49e5152 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -69,7 +69,7 @@ jobs: "cd promo_code && coverage run --rcfile=.coveragerc manage.py test && coverage xml" - name: Copy coverage report from container 📂 - run: docker compose cp web:/app/promo_code/coverage.xml ./coverage.xml + run: docker compose cp web:/usr/src/app/promo_code/coverage.xml ./coverage.xml - name: Upload coverage to Codecov 🚀 uses: codecov/codecov-action@v5 From 8803b7c851c8bfec82e2fc450ac3cbae833eb14b Mon Sep 17 00:00:00 2001 From: Max Date: Sun, 27 Jul 2025 18:24:02 +0300 Subject: [PATCH 4/4] docs: Update Codecov badge URL This commit corrects the Codecov badge URL in the README to point to the `main` branch, ensuring it accurately reflects the coverage status of the primary branch. The badge has also been moved to maintain a consistent order with other badges. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 49b62fb..a16fab6 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # Promo Code API [![CI/CD](https://github.com/RandomProgramm3r/Promo-Code-API/actions/workflows/ci.yml/badge.svg)](https://github.com/RandomProgramm3r/Promo-Code-API/actions) +[![codecov](https://codecov.io/github/RandomProgramm3r/Promo-Code-API/branch/main/graph/badge.svg?token=VNBK0FAU3Z)](https://codecov.io/github/RandomProgramm3r/Promo-Code-API) [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff) -[![codecov](https://codecov.io/github/RandomProgramm3r/Promo-Code-API/graph/badge.svg?token=VNBK0FAU3Z)](https://codecov.io/github/RandomProgramm3r/Promo-Code-API) The application provides an HTTP API for companies and end-users, is integrated with an external anti-fraud service, and uses PostgreSQL and Redis for data storage and caching.