-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
33 lines (31 loc) · 921 Bytes
/
.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
stages:
- test
variables:
POSTGRES_DB: odoo
POSTGRES_USER: odoo
POSTGRES_PASSWORD: odoo
POSTGRES_HOST_AUTH_METHOD: trust
test:
stage: test
image:
name: ghcr.io/oca/oca-ci/py3.10-odoo17.0:latest
services:
- name: postgres:15
tags:
- galaxy-docker-shared
script:
- oca_install_addons && oca_init_test_database && oca_run_tests
# generate coverage report
- coverage html -d htmlcov && coverage xml -o coverage.xml
# read line-rate from coverage.xml and print it as percentage
- total=$(grep -oP '<coverage[^>]*line-rate="\K[0-9.]+' coverage.xml | head -n 1 | awk '{print $1 * 100}') && echo "total ${total}%"
coverage: '/(?i)total.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/'
artifacts:
paths:
- htmlcov/*
when: always
reports:
junit: test_results/*.xml
coverage_report:
coverage_format: cobertura
path: coverage.xml