-
Notifications
You must be signed in to change notification settings - Fork 2
/
.gitlab-ci.yml
118 lines (110 loc) · 2.93 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
113
114
115
116
117
118
default:
image: teamparallax/conversion-service-base-image:v0.2.2
interruptible: true
cache:
paths:
- .yarn/
stages:
- prepare
- lint
- test:types
- test:unit
- test:integration
- build
- review
- release
# Workflow rules for MR-Pipelines taken from docs at docs.gitlab.com:
# https://docs.gitlab.com/ee/ci/yaml/#switch-between-branch-pipelines-and-merge-request-pipelines
workflow:
rules:
- if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS && $CI_PIPELINE_SOURCE == "push"
when: never
- if: $CI_COMMIT_BRANCH || $CI_COMMIT_TAG
include:
- local: .gitlab/ci/build.gitlab-ci.yml
- local: packages/conversion-service/.gitlab-ci.yml
- local: packages/auto-scaler/.gitlab-ci.yml
- local: packages/redis/.gitlab-ci.yml
- local: packages/logger/.gitlab-ci.yml
### Prepare - Stage
lint code:
stage: lint
before_script:
- yarn install --cache .yarn --prefer-offline
script:
- yarn lerna run lint
rules:
- changes:
- packages/**/*.ts
when: always
# The steps below originally come from here, but the release_job step
# should wait for the docker build before creating a release
# https://gitlab.com/uulmhack/pipelines/auto-create-release/-/blob/master/.gitlab-ci.yml
prepare release:
image: alpine:3.13
stage: prepare
before_script:
- apk add --no-cache git
script:
- |
echo "Generate diff from last release for the latest release"
git diff --unified=0 HEAD~1 ./CHANGELOG.md | tail -n +6 | sed -e "s/^+//" > ./latestChanges.md
artifacts:
paths:
- ./latestChanges.md
rules:
- if: "$CI_COMMIT_TAG"
exists:
- CHANGELOG.md
### Review Stage
code quality:
allow_failure: true
image: docker:stable
services:
- docker:stable-dind
stage: review
needs:
- job: "lint code"
variables:
DOCKER_TLS_CERTDIR: ""
DOCKER_HOST: tcp://localhost:2375
REPORT_FORMAT: json
SOURCE_CODE: ${PWD}/src/
before_script: []
script:
- echo "Generate Gitlab Code Quality Report"
- |
docker run \
--env SOURCE_CODE="${PWD}" \
--volume "${PWD}":/code \
--volume /var/run/docker.sock:/var/run/docker.sock \
"registry.gitlab.com/gitlab-org/ci-cd/codequality:0.85.24" /code
artifacts:
paths:
- gl-code-quality-report.json
reports:
codequality: gl-code-quality-report.json
rules:
- if: "$CODE_QUALITY_DISABLED"
when: never
- changes:
- packages/**/*.ts
when: always
### Release Stage
release job:
image: registry.gitlab.com/gitlab-org/release-cli:latest
before_script: []
needs:
- job: "prepare release"
artifacts: true
- job: "build docker conversion-service"
- job: "build docker dynamic-conversion-controller"
- job: "code quality"
script:
- echo "create gitlab-release for ${CI_COMMIT_TAG}"
stage: release
release:
tag_name: $CI_COMMIT_TAG
description: "./latestChanges.md"
rules:
- if: $CI_COMMIT_TAG