matrix-alertbot/.gitlab-ci.yml

72 lines
1.4 KiB
YAML
Raw Normal View History

2022-08-08 17:29:03 +02:00
workflow:
rules:
- if: $CI_MERGE_REQUEST_IID
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
2022-08-08 17:38:53 +02:00
VIRTUAL_ENV: "$CI_PROJECT_DIR/.venv"
2022-08-08 17:29:03 +02:00
FF_USE_FASTZIP: "true"
stages:
- install
- quality
- test
.pip cache template:
cache:
key:
files:
- setup.py
2022-08-08 17:38:53 +02:00
- requirements.txt
2022-08-08 17:29:03 +02:00
paths:
- .cache/pip
2022-08-08 17:38:53 +02:00
- ${VIRTUAL_ENV}
before_script:
2022-08-08 17:50:58 +02:00
- export PATH="${VIRTUAL_ENV}/bin:$PATH"
2022-08-08 17:29:03 +02:00
2022-08-08 17:54:04 +02:00
install:
2022-08-08 17:29:03 +02:00
extends: .pip cache template
image: python:3.10-alpine
stage: install
script:
- apk add --no-cache gcc g++ yaml-dev python3-dev
2022-08-08 17:38:53 +02:00
- python3 -m venv "${VIRTUAL_ENV}"
2022-08-08 17:30:38 +02:00
- pip install -r requirements.txt
2022-08-08 17:54:04 +02:00
- pip install .
2022-08-08 17:29:03 +02:00
cache:
policy: pull-push
interruptible: true
linting:
extends: .pip cache template
image: python:3.10-alpine
stage: quality
script:
- flake8 .
cache:
policy: pull
interruptible: true
tests:
extends: .pip cache template
image: python:3.10-alpine
stage: test
script:
2022-08-08 18:11:10 +02:00
- apk add --no-cache libstdc++
2022-08-08 22:57:49 +02:00
- coverage run --source matrix_alertbot -m pytest --junitxml=report.xml
2022-08-08 22:54:12 +02:00
- coverage report --precision 2
2022-08-08 17:29:03 +02:00
- coverage xml -o coverage.xml
cache:
policy: pull
artifacts:
reports:
coverage_report:
coverage_format: cobertura
path: coverage.xml
junit: report.xml
coverage: '/^TOTAL\s+\d+\s+\d+\s+(\d+\.\d+\%)$/'
2022-08-08 17:29:03 +02:00
interruptible: true