Skip to content

Commit d18ae37

Browse files
committed
Merge branch 'main-CI-CD-pipeline-BAD-PAA' into 'main'
Added .gitlab-ci.yml file -- PAA See merge request bizzappdev/ai/polytalkio/polytalk!10
2 parents 2257e6b + 45ddb63 commit d18ae37

1 file changed

Lines changed: 46 additions & 0 deletions

File tree

.gitlab-ci.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
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

0 commit comments

Comments
 (0)