Skip to content

Commit 07e5b11

Browse files
committed
Persist coverage reports to host
1 parent d799120 commit 07e5b11

7 files changed

Lines changed: 17 additions & 8 deletions

File tree

.github/workflows/stage-2-test.yaml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,11 @@ jobs:
4444
run: |
4545
cp .env.example .env
4646
make test-unit
47-
- name: "Save the result of fast test suite"
48-
run: |
49-
docker cp lung_cancer_screening-web:/tmp/coverage.xml ./coverage.xml
50-
47+
- name: "Upload coverage report to artifacts"
48+
uses: actions/upload-artifact@v4
49+
with:
50+
name: coverage.xml
51+
path: coverage.xml
5152

5253
test-lint:
5354
name: "Linting"
@@ -90,6 +91,10 @@ jobs:
9091
uses: actions/checkout@v6
9192
with:
9293
fetch-depth: 0 # Full history is needed to improving relevancy of reporting
94+
- name: Download coverage report
95+
uses: actions/download-artifact@v4
96+
with:
97+
name: coverage.xml
9398
- name: "Perform static analysis"
9499
uses: ./.github/actions/perform-static-analysis
95100
with:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,4 @@ lung_cancer_screening/assets/compiled/*
2222
tests/TEST-*.xml
2323
node_modules
2424
.coverage
25+
coverage.xml

docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ services:
77
dockerfile: Dockerfile
88
target: development
99
command: python manage.py runserver 0.0.0.0:8000
10+
user: "${UID}:${GID}"
1011
ports:
1112
- "8000:8000"
1213
env_file:

pyproject.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,13 @@ build-backend = "poetry.core.masonry.api"
3838
paths = ["tests/features"]
3939

4040
[tool.coverage.run]
41+
relative_files = true
4142
omit = [
4243
"*/migrations/*",
4344
"*/tests/*",
4445
"manage.py"
4546
]
46-
data_file = "/tmp/.coverage"
47+
data_file = ".coverage"
4748

4849
[tool.coverage.xml]
49-
output = "/tmp/coverage.xml"
50+
output = "coverage.xml"

scripts/config/sonar-scanner.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ sonar.qualitygate.wait=true
55
sonar.sourceEncoding=UTF-8
66
sonar.sources=.
77

8-
#sonar.python.coverage.reportPaths=.coverage/coverage.xml
8+
sonar.python.coverage.reportPaths=coverage.xml
99
#sonar.[javascript|typescript].lcov.reportPaths=.coverage/lcov.info

scripts/reports/perform-static-analysis.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ function run-sonar-scanner-in-docker() {
4848
# shellcheck disable=SC1091
4949
source ./scripts/docker/docker.lib.sh
5050

51+
ls -lah
5152
# shellcheck disable=SC2155
5253
local image=$(name=sonarsource/sonar-scanner-cli docker-get-image-version-and-pull)
5354
docker run --rm --platform linux/amd64 \

scripts/tests/unit.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ else
3333
TEST_MODULE=""
3434
fi
3535

36-
docker compose run --rm --remove-orphans web sh -c \
36+
UID=$(id -u) GID=$(id -u) docker compose run --rm --remove-orphans web sh -c \
3737
"echo 'Running unit tests...' && \
3838
poetry run coverage run manage.py test $TEST_MODULE $TAG \
3939
--settings=lung_cancer_screening.settings_test \

0 commit comments

Comments
 (0)