File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # GitLab CI pipeline for pre-commit checks and tests
2+ image : python:3.10
3+
4+ variables :
5+ PIP_CACHE_DIR : " $CI_PROJECT_DIR/.pip"
6+
7+ cache :
8+ paths :
9+ - .pip/
10+ - .coverage
11+ - htmlcov/
12+ - coverage.xml
13+
14+ before_script :
15+ - pip install --upgrade pip
16+ - pip install -r requirements.txt
17+ - pip install pre-commit pytest pytest-cov pytest-asyncio
18+
19+ stages :
20+ - check
21+ - test
22+
23+ pre-commit-check :
24+ stage : check
25+ script :
26+ - pre-commit run --all-files
27+ rules :
28+ - if : $CI_PIPELINE_SOURCE == 'merge_request_event'
29+ - if : $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
30+
31+ test :
32+ stage : test
33+ script :
34+ - pytest tests/ -v --cov=app --cov-report=term --cov-report=xml --cov-report=html
35+ coverage : ' /TOTAL.*?(\d+(?:\.\d+)?)%/'
36+ artifacts :
37+ reports :
38+ coverage_report :
39+ coverage_format : cobertura
40+ path : coverage.xml
41+ paths :
42+ - coverage.xml
43+ - htmlcov/
44+ rules :
45+ - if : $CI_PIPELINE_SOURCE == 'merge_request_event'
46+ - if : $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
You can’t perform that action at this time.
0 commit comments