-
Notifications
You must be signed in to change notification settings - Fork 10
/
.gitlab-ci.yml
194 lines (181 loc) · 4.18 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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
stages:
- build
- test
- prepare
- deploy
image:
name: docker/compose:latest
variables:
# this variable enables caching within docker-in-docker
# https://docs.gitlab.com/ee/ci/docker/using_docker_build.html#use-docker-in-docker-workflow-with-docker-executor
MOUNT_POINT: /builds/$CI_PROJECT_PATH/vendor
# bundler-specific
BUNDLE_JOBS: 4
BUNDLE_PATH: vendor
.test_settings: &test_settings
variables:
BUNDLE_WITHOUT: assorted
stage: test
services:
- docker:dind
before_script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
artifacts:
paths:
- coverage/
.yjit_matrix: &yjit_matrix
parallel:
matrix:
- RUBYOPT: ["", "--yjit"]
# Cache gems in between builds
cache:
key: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
paths:
- vendor
lint rubocop code:
image: "ruby:3.3"
variables:
BUNDLE_WITHOUT: test:coverage:assorted
before_script:
- bundle install
script:
- bundle exec rake rubocop
lint rubocop wiki:
image: "ruby:3.3"
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
variables:
BUNDLE_ONLY: lint
before_script:
- git clone https://gitlab.com/os85/httpx.wiki.git
- bundle install
- |
cat > .rubocop-wiki.yml << FILE
require:
- rubocop-md
AllCops:
TargetRubyVersion: 3.3
DisabledByDefault: true
FILE
script:
- bundle exec rubocop httpx.wiki --config .rubocop-wiki.yml
test jruby:
<<: *test_settings
script:
./spec.sh jruby 9.0.0.0
allow_failure: true
test ruby 2/7:
<<: *test_settings
script:
./spec.sh ruby 2.7
test ruby 3/0:
<<: *test_settings
only:
- master
script:
./spec.sh ruby 3.0
test ruby 3/1:
<<: *test_settings
only:
- master
script:
./spec.sh ruby 3.1
test ruby 3/2:
<<: *test_settings
<<: *yjit_matrix
script:
./spec.sh ruby 3.2
test ruby 3/3:
<<: *test_settings
<<: *yjit_matrix
script:
./spec.sh ruby 3.3
test truffleruby:
<<: *test_settings
script:
./spec.sh truffleruby latest
allow_failure: true
regression tests:
image: "ruby:3.3"
variables:
BUNDLE_WITHOUT: lint:assorted
CI: 1
COVERAGE_KEY: "$RUBY_ENGINE-$RUBY_VERSION-regression-tests"
artifacts:
paths:
- coverage/
stage: test
before_script:
- apt-get update && apt-get install -y libmagic-dev shared-mime-info
- bundle install
script:
- bundle exec rake regression_tests
coverage:
coverage: '/Coverage: \d+.\d+\%/'
stage: prepare
variables:
BUNDLE_WITHOUT: lint:test:assorted
image: "ruby:3.3"
script:
- gem install simplecov --no-doc
# this is a workaround, because simplecov doesn't support relative paths.
#
# https://github.com/simplecov-ruby/simplecov/issues/887
#
# this is necessary in our case, because coverage files are generated inside
# the custom docker container, which runs in /home, and the absolute paths aren't
# gonna match the paths where the files are, once we merge them. Therefore,
# all of those have to be rewritten before the merge happens.
#
- find coverage -name "*resultset.json" -exec sed -i 's?/home?'`pwd`'?' {} \;
- rake coverage:report
artifacts:
paths:
- "coverage/"
pages:
stage: deploy
needs:
- coverage
image: "ruby:3.3"
before_script:
- gem install hanna-nouveau
script:
- rake prepare_website
- mkdir -p public/
- cp -r coverage/ public/
artifacts:
paths:
- rdoc/
- wiki/
- data/
- coverage/
- public/
only:
- master
prepare_release:
stage: prepare
rules:
- if: $CI_COMMIT_TAG
when: never
script:
- echo "EXTRA_DESCRIPTION=$(cat doc/release_notes/${${CI_COMMIT_TAG:1}//./_}.md)" >> variables.env
- echo "TAG=v$(cat CI_COMMIT_TAG)" >> variables.env
artifacts:
reports:
dotenv: variables.env
release:
stage: deploy
image: registry.gitlab.com/gitlab-org/release-cli:latest
needs:
- job: prepare_release
artifacts: true
rules:
- if: $CI_COMMIT_TAG
when: never
script:
- echo "running release_job for $TAG"
release:
name: 'Release $TAG'
description: '$EXTRA_DESCRIPTION'
tag_name: '$TAG'
ref: '$CI_COMMIT_SHA'