-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
112 lines (101 loc) · 2.53 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
stages:
- quality
- test
- misc
- deploy
- notify
image: gitlab.ixon.net:4221/ixon/docker/py3.10-alpine3.17-py-test:latest
.deps: &deps
before_script:
- apk add make
.test-artifacts: &test-artifacts
artifacts:
# Always expose artifacts
when: always
name: "$CI_JOB_STAGE-$CI_COMMIT_REF_NAME"
paths:
# Expose html coverage report as artifact
- $CI_PROJECT_DIR/htmlcov
reports:
junit:
- $CI_PROJECT_DIR/junit.xml
coverage_report:
coverage_format: cobertura
path: $CI_PROJECT_DIR/coverage.xml
# Artifacts will be deleted in 1 week after job finished
expire_in: 1 week
quality:
<<: *deps
stage: quality
needs: []
parallel:
matrix:
- job:
- py-unittest-lint
- py-lint
- py-unittest-typecheck
- py-typecheck
- py-bandit
script:
- make ${job}
unit-tests:
<<: *deps
<<: *test-artifacts
stage: test
needs: []
coverage: '/TOTAL.* (\d+.\d+\%\s*)$/'
script:
- make
TEST_FLAGS="--without-integration --without-slow-integration --cov-fail-under 100 --cov-report xml --color=yes --junitxml=junit.xml"
py-unittest
integration-tests:
<<: *deps
<<: *test-artifacts
stage: test
needs: []
script:
- make
TEST_FLAGS='-m integration_test --color=yes --junitxml=junit.xml' SKIP_COV=1
py-unittest
slow-integration-tests:
<<: *deps
<<: *test-artifacts
stage: test
needs: []
allow_failure: true
script:
- make
TEST_FLAGS='-m slow_integration_test --color=yes --junitxml=junit.xml' SKIP_COV=1
py-unittest
deploy:
<<: *deps
stage: deploy
rules:
- if: $CI_COMMIT_TAG
when: manual
needs: ["quality", "unit-tests", "integration-tests"]
artifacts:
name: "document-management-$CI_COMMIT_TAG"
paths:
- bundle.zip
script:
- apk add --update-cache --upgrade zip curl
- |-
cat > .env << ENV
IXON_API_COMPANY_ID=${IXON_API_COMPANY_ID}
IXON_API_TEMPLATE_ID=${IXON_API_TEMPLATE_ID}
ENV
- echo "${IXON_API_ACCESS_TOKEN}" > .accesstoken
- make deploy
notify-pipeline-failure:
image: 'alpine:3.18'
stage: notify
allow_failure: true
rules:
- if: $CI_PIPELINE_SOURCE == "schedule" && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
when: on_failure
before_script:
- apk add jq curl
script:
- jq -n -c "${CORE_PIPELINE_FAILURE_WEBHOOK_JQ_TEMPLATE}" > body.json
- 'curl -sX POST -H "Content-Type: application/json" "${CORE_PIPELINE_FAILURE_WEBHOOK_URL}" --data @body.json > /dev/null'