-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy path.gitlab-ci.yml
35 lines (32 loc) · 1.07 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# (c) 2008-2024 Sigasi
# License: BSD, see LICENSE for more details.
image: python:latest
workflow:
rules:
# Don't run while MR is "in draft"
- if: $CI_MERGE_REQUEST_TITLE =~ /Draft:/
when: never
# Run tests on MRs and after merge into the main branch
- if: $CI_MERGE_REQUEST_IID
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
unit-test:
tags:
- docker
stage: test
before_script:
# Set up the test environment
- python3 -m pip install -r requirements.txt
- git config --global user.email "[email protected]"
- git config --global user.name "Sigasi CI"
script:
- PYTHONPATH=$(pwd)/src:$(pwd)/src/SigasiProjectCreator/DotF python3 -m pytest --junitxml=test_report.xml --cov-report xml:coverage.xml --cov-report term --cov=src
artifacts:
when: always
expire_in: 1 week
reports:
junit: test_report.xml
coverage_report:
coverage_format: cobertura
path: coverage.xml
# Extract and report overall coverage from job output in MR
coverage: '/(?i)total.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/'