Skip to content

Commit f6b3d33

Browse files
author
Your Name
committed
Separation of coverage Report_2
1 parent a1dd50e commit f6b3d33

File tree

2 files changed

+23
-9
lines changed

2 files changed

+23
-9
lines changed

.github/workflows/run_full_test_suite.yml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,25 @@ jobs:
3333
DJANGO_ENV: test
3434
run: docker-compose -f local.yml run --rm django bash ./init.sh
3535

36+
- name: Save coverage data
37+
run: |
38+
mkdir -p coverage_data
39+
docker-compose -f local.yml run --rm django cp .coverage coverage_data/
40+
continue-on-error: true
41+
42+
- name: Upload coverage data as artifact
43+
uses: actions/upload-artifact@v2
44+
with:
45+
name: coverage-data
46+
path: coverage_data/.coverage
47+
3648
- name: Cleanup
3749
run: docker-compose -f local.yml down --volumes
3850

3951
report-coverage:
4052
needs: run-tests
4153
runs-on: ubuntu-latest
54+
4255
steps:
4356
- name: Check out merged code
4457
uses: actions/checkout@v2
@@ -51,7 +64,12 @@ jobs:
5164
- name: Build the Docker environment
5265
run: docker-compose -f local.yml build
5366

54-
- name: Extract coverage data
67+
- name: Download coverage data
68+
uses: actions/download-artifact@v2
69+
with:
70+
name: coverage-data
71+
72+
- name: Generate Coverage Report
5573
run: docker-compose -f local.yml run --rm django coverage report
5674

5775
- name: Cleanup after coverage

init.sh

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ include = */*.py
2121
[report]
2222
show_missing = True" > .coveragerc
2323

24-
# Run each test file with coverage
24+
# Run each test file with coverage (without generating report yet)
2525
for test_file in $test_files; do
2626
echo "Running $test_file..."
27-
coverage run --append -m pytest "$test_file" # Using settings from .coveragerc
27+
coverage run --append -m pytest "$test_file" # Collect coverage data
2828

2929
# Check the exit status of pytest
3030
if [ $? -ne 0 ]; then
@@ -33,15 +33,11 @@ for test_file in $test_files; do
3333
fi
3434
done
3535

36-
# Generate coverage reports
37-
echo "Generating coverage report..."
38-
coverage report
39-
40-
# Report the results
36+
# Report the results without generating the coverage report
4137
if [ $failure_count -ne 0 ]; then
4238
echo "$failure_count test(s) failed. Refer to the terminal output for details."
4339
exit 1
4440
else
4541
echo "All tests passed successfully!"
46-
echo "Coverage summary has been output to the terminal."
42+
echo "Coverage data collected. Coverage report will be generated separately."
4743
fi

0 commit comments

Comments
 (0)