forked from wikiti/deepl-rb
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.gitlab-ci.yml
135 lines (117 loc) · 3.24 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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# Note: This GitLab CI configuration is used for internal testing, users can ignore it.
include:
- project: '${CI_PROJECT_NAMESPACE}/ci-libs-for-client-libraries'
file:
- '/${CI_PROJECT_NAME}/.gitlab-ci.yml'
- project: 'deepl/ops/ci-cd-infrastructure/gitlab-ci-lib'
file:
- '/templates/.buildkit.yml'
- '/templates/.secret-detection.yml'
# Global --------------------------
workflow:
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
- if: $CI_COMMIT_TAG
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
stages:
- install
- check
- test
# - publish
before_script:
- ruby --version
- bundle install
# stage: install ----------------------
package:
stage: install
parallel:
matrix:
- DOCKER_IMAGE: 'ruby:2.7'
- DOCKER_IMAGE: 'ruby:3.2'
- DOCKER_IMAGE: 'ruby:3.3'
image:
name: ${DOCKER_IMAGE}
entrypoint: ['/builds/deepl/backend/oss-client-libs/deepl-ruby']
script:
- bundle exec rake build
artifacts:
paths:
- pkg/
# stage: check ----------------------
.rubocop_base:
stage: check
image:
name: ruby:2.7
entrypoint: ['/builds/deepl/backend/oss-client-libs/deepl-ruby']
script: bundle exec rubocop
rubocop_scheduled:
extends: .rubocop_base
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
retry: 2
rubocop_manual:
extends: .rubocop_base
rules:
- if: $CI_PIPELINE_SOURCE != "schedule"
secret_detection:
extends: .secret-detection
stage: check
image: !reference [.secret-detection, image]
before_script:
- echo "overriding default before_script..."
rules:
- if: $CI_MERGE_REQUEST_ID
license_check:
stage: check
before_script:
- echo "overriding default before_script..."
script:
- ./license_checker.sh '*.rb' | tee license_check_output.txt
- '[ ! -s license_check_output.txt ]'
# stage: test ----------------------
.test_base:
stage: test
extends: .test
parallel:
matrix:
- DOCKER_IMAGE: 'ruby:2.7'
- DOCKER_IMAGE: 'ruby:3.2'
- DOCKER_IMAGE: 'ruby:3.3'
- DOCKER_IMAGE: 'ruby:2.7'
USE_MOCK_SERVER: "use mock server"
- DOCKER_IMAGE: 'ruby:3.2'
USE_MOCK_SERVER: "use mock server"
- DOCKER_IMAGE: 'ruby:3.3'
USE_MOCK_SERVER: "use mock server"
image:
name: ${DOCKER_IMAGE}
entrypoint: ['/builds/deepl/backend/oss-client-libs/deepl-ruby']
script:
- >
if [[ ! -z "${USE_MOCK_SERVER}" ]]; then
echo "Using mock server"
export DEEPL_SERVER_URL=http://deepl-mock:3000
export DEEPL_MOCK_SERVER_PORT=3000
export DEEPL_PROXY_URL=http://deepl-mock:3001
export DEEPL_MOCK_PROXY_SERVER_PORT=3001
fi
- bundle exec rake test
- bundle exec rspec --format RspecJunitFormatter --out rspec.xml
artifacts:
reports:
coverage_report:
coverage_format: cobertura
path: coverage/coverage.xml
junit:
- rspec.xml
when: always
test_scheduled:
extends: .test_base
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
retry: 2
test_manual:
stage: test
extends: .test_base
rules:
- if: $CI_PIPELINE_SOURCE != "schedule"