-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
74 lines (61 loc) · 1.89 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
# SPDX-FileCopyrightText: Magenta ApS <https://magenta.dk>
# SPDX-License-Identifier: MPL-2.0
stages:
- sync
- lint
- build
- test
- coverage
- release
- deploy
- docs
variables:
DOCKERFILE: docker/Dockerfile
IMAGE_SHA: ${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHA}
# Global Conditions
.if-default-branch-refs: &if-default-branch-refs
if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
.if-tag: &if-tag
if: '$CI_COMMIT_TAG'
.if-merge-request: &if-merge-request
if: '$CI_MERGE_REQUEST_IID'
include:
- project: labs/salt-automation
file:
- gitlab-ci-templates/common/no-interrupt-meta.v1.yml
- gitlab-ci-templates/common/pre-commit.v1.yml
- gitlab-ci-templates/common/conventional-commits.v1.yml
- gitlab-ci-templates/common/conventional-commits-changelog.v1.yml
- gitlab-ci-templates/common/docker-build.v1.yml
workflow:
rules:
- <<: *if-tag
variables:
# Override the IMAGE_SHA variable on tag pipelines to avoid both the default
# branch pipeline and tag pipeline overriding each other's images arbitrarily when
# they are both running at the same time on master.
IMAGE_SHA: ${CI_REGISTRY_IMAGE}:${CI_COMMIT_TAG}
- <<: *if-default-branch-refs
- <<: *if-merge-request
Unittest:
stage: test
needs: [Build]
# rules:
# - <<: *if-merge-request
image: ${IMAGE_SHA}
before_script:
- mkdir -p /coverage-results
- cd /app
script:
- TEST=true ../entrypoint.sh
after_script:
- mkdir -p ${CI_PROJECT_DIR}/coverage-results.${CI_JOB_ID}/
- mv /coverage-results/* ${CI_PROJECT_DIR}/coverage-results.${CI_JOB_ID}/
coverage: '/^TOTAL.+?(\d+\%)$/'
artifacts:
when: always
reports:
junit: ${CI_PROJECT_DIR}/coverage-results.${CI_JOB_ID}/junit.xml
coverage_report:
coverage_format: cobertura
path: ${CI_PROJECT_DIR}/coverage-results.${CI_JOB_ID}/coverage.xml