Skip to content

Commit 299b8e7

Browse files
improving ci-pipeline
1 parent 1fb8fa4 commit 299b8e7

File tree

3 files changed

+15
-12
lines changed

3 files changed

+15
-12
lines changed

.github/workflows/django_ci_cd.yml

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,12 @@ jobs:
5656
- name: Run Migrations
5757
run: python manage.py migrate
5858

59-
- name: Run Tests with Coverage
60-
run: |
61-
coverage run manage.py test
62-
coverage report
63-
coverage html # Generates the HTML report in 'htmlcov' directory
59+
# Generate coverage XML report for Codecov
60+
- name: Run tests and generate coverage XML report
61+
run: pytest --cov --cov-branch --cov-report=xml
6462

65-
# Upload coverage HTML report as artifact
66-
- name: Upload coverage HTML report
67-
uses: actions/upload-artifact@v4
63+
# Upload to Codecov (external visualization tool)
64+
- name: Upload coverage reports to Codecov
65+
uses: codecov/codecov-action@v5
6866
with:
69-
name: coverage-report-html
70-
path: backend/htmlcov/ # Upload the entire 'htmlcov' directory
71-
67+
token: ${{ secrets.CODECOV_TOKEN }}

backend/requirements.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,7 @@ pytest==8.1.1
2222
pytest-django==4.8.0
2323
pytest-asyncio==0.23.5
2424
factory-boy==3.3.0
25-
coverage==7.5.0
25+
coverage==7.5.0
26+
27+
# Dev dependencies
28+
pytest-cov==6.1.1

pytest.ini

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# pytest.ini
2+
[pytest]
3+
DJANGO_SETTINGS_MODULE = backend.settings
4+
python_files = tests.py

0 commit comments

Comments
 (0)