Skip to content

Commit b75844a

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

6 files changed

Lines changed: 15 additions & 7 deletions

File tree

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,10 @@ jobs:
4545
cp .env.example .env
4646
make test-unit
4747
- name: "Save the result of fast test suite"
48-
run: |
49-
docker cp lung_cancer_screening-web:/tmp/coverage.xml ./coverage.xml
50-
48+
uses: actions/upload-artifact@v2
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@v2
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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ omit = [
4343
"*/tests/*",
4444
"manage.py"
4545
]
46-
data_file = "/tmp/.coverage"
46+
data_file = ".coverage"
4747

4848
[tool.coverage.xml]
49-
output = "/tmp/coverage.xml"
49+
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/tests/unit.sh

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

36-
docker compose run --rm --remove-orphans web sh -c \
36+
echo "Running as app user: $(id -u):$(id -g)"
37+
UID=$(id -u) GID=$(id -u) docker compose run --rm --remove-orphans web sh -c \
3738
"echo 'Running unit tests...' && \
3839
poetry run coverage run manage.py test $TEST_MODULE $TAG \
3940
--settings=lung_cancer_screening.settings_test \

0 commit comments

Comments
 (0)