File tree Expand file tree Collapse file tree 2 files changed +23
-9
lines changed Expand file tree Collapse file tree 2 files changed +23
-9
lines changed Original file line number Diff line number Diff line change @@ -33,12 +33,25 @@ jobs:
33
33
DJANGO_ENV : test
34
34
run : docker-compose -f local.yml run --rm django bash ./init.sh
35
35
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
+
36
48
- name : Cleanup
37
49
run : docker-compose -f local.yml down --volumes
38
50
39
51
report-coverage :
40
52
needs : run-tests
41
53
runs-on : ubuntu-latest
54
+
42
55
steps :
43
56
- name : Check out merged code
44
57
uses : actions/checkout@v2
51
64
- name : Build the Docker environment
52
65
run : docker-compose -f local.yml build
53
66
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
55
73
run : docker-compose -f local.yml run --rm django coverage report
56
74
57
75
- name : Cleanup after coverage
Original file line number Diff line number Diff line change @@ -21,10 +21,10 @@ include = */*.py
21
21
[report]
22
22
show_missing = True" > .coveragerc
23
23
24
- # Run each test file with coverage
24
+ # Run each test file with coverage (without generating report yet)
25
25
for test_file in $test_files ; do
26
26
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
28
28
29
29
# Check the exit status of pytest
30
30
if [ $? -ne 0 ]; then
@@ -33,15 +33,11 @@ for test_file in $test_files; do
33
33
fi
34
34
done
35
35
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
41
37
if [ $failure_count -ne 0 ]; then
42
38
echo " $failure_count test(s) failed. Refer to the terminal output for details."
43
39
exit 1
44
40
else
45
41
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 ."
47
43
fi
You can’t perform that action at this time.
0 commit comments