~npalix/coccinelle/upstream

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
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
# In order to make "docker build" use cache as most as possible, there
# are three "prepare" stages.
# - prepare distribution images: build one container by distribution (for now,
#   debian and opensuse/leap, both with OCaml 4.09)
# - prepare environment images: build debian containers for 3.12,
#   4.09 with parmap, 4.09 with menhir, 4.09 with pyml. It is worth noticing
#   that all these buildings implicitly use the cached container built on the
#   previous stage.
# - prepare image with all dependencies: build debian container with parmap,
#   menhir and pyml. It is worth noticing that this building use implicitly
#   the cached container with pyml built on the previous stage.

# We begin by trace-cmd because the triggered pipeline will be run in parallel.

stages:
  - trace-cmd
  - prepare distribution images
  - prepare environment images
  - prepare image with all dependencies
  - build
  - clone reference scores
  - test

# Dockerfiles are split in two:
# - a part specific to the distribution that installs package and adds
#   a user called "ci"
# - a part common to both distributions that makes "ci" sudoer and installs
#   opam
# "docker build" is run twice, once to make the specific part and once to
# make the common part starting from the container prepared by the first part.

.prepare docker image: &prepare_docker_image_def
  script:
    - docker build --tag $image_name-prepare ci/distributions/$distribution
    - docker build --tag $image_name ci/distributions/common
        --build-arg from=$image_name-prepare
        --build-arg ocaml_version=$ocaml_version
        --build-arg stdcompat=$stdcompat --build-arg pyml=$pyml
        --build-arg menhir=$menhir --build-arg parmap=$parmap

prepare debian docker image with 4.09.0:
  <<: *prepare_docker_image_def
  stage: prepare distribution images
  variables:
    image_name: debian-4.09.0
    distribution: debian
    ocaml_version: 4.09.0

prepare opensuse/leap docker image with 4.09.0:
  <<: *prepare_docker_image_def
  stage: prepare distribution images
  variables:
    image_name: opensuse-leap-4.09.0
    distribution: opensuse-leap
    ocaml_version: 4.09.0

prepare opensuse/leap docker image with 4.14.1:
  <<: *prepare_docker_image_def
  stage: prepare distribution images
  variables:
    image_name: opensuse-leap-4.14.1
    distribution: opensuse-leap
    ocaml_version: 4.14.1

prepare opensuse/leap docker image with 5.0.0:
  <<: *prepare_docker_image_def
  stage: prepare distribution images
  variables:
    image_name: opensuse-leap-5.0.0
    distribution: opensuse-leap
    ocaml_version: 5.0.0

prepare debian docker image with 3.12.1:
  <<: *prepare_docker_image_def
  stage: prepare environment images
  variables:
    image_name: debian-3.12.1
    distribution: debian
    ocaml_version: 3.12.1

prepare debian docker image with 4.14.1:
  <<: *prepare_docker_image_def
  stage: prepare distribution images
  variables:
    image_name: debian-4.14.1
    distribution: debian
    ocaml_version: 4.14.1

prepare debian docker image with 5.0.0:
  <<: *prepare_docker_image_def
  stage: prepare environment images
  variables:
    image_name: debian-5.0.0
    distribution: debian
    ocaml_version: 5.0.0

# Note: "yes" should be quoted in variable values (yes is parsed as a keyword)

prepare debian docker image with 4.09.0 and menhir:
  <<: *prepare_docker_image_def
  stage: prepare environment images
  variables:
    image_name: debian-4.09.0-menhir
    distribution: debian
    ocaml_version: 4.09.0
    menhir: "yes"

prepare debian docker image with 4.09.0 and parmap:
  <<: *prepare_docker_image_def
  stage: prepare environment images
  variables:
    image_name: debian-4.09.0-parmap
    distribution: debian
    ocaml_version: 4.09.0
    parmap: "yes"

prepare debian docker image with 4.09.0 and pyml:
  <<: *prepare_docker_image_def
  stage: prepare environment images
  variables:
    image_name: debian-4.09.0-pyml
    distribution: debian
    ocaml_version: 4.09.0
    pyml: "yes"

prepare debian docker image with 4.09.0 and all dependencies:
  <<: *prepare_docker_image_def
  stage: prepare image with all dependencies
  variables:
    image_name: debian-4.09.0-all-dependencies
    distribution: debian
    ocaml_version: 4.09.0
    pyml: "yes"
    parmap: "yes"
    menhir: "yes"

.build coccinelle: &build_coccinelle_def
  stage: build
  script:
    - docker build --tag coccinelle-with-$from . -f ci/Dockerfile.build
        --build-arg from=$from --build-arg configure_options=$configure_options

build with debian 3.12:
  <<: *build_coccinelle_def
  variables:
    from: debian-3.12.1

build with debian 4.09:
  <<: *build_coccinelle_def
  variables:
    from: debian-4.09.0

build with debian 4.14:
  <<: *build_coccinelle_def
  variables:
    from: debian-4.14.1

build with debian 5.0:
  <<: *build_coccinelle_def
  variables:
    from: debian-5.0.0

build with debian 4.09 with menhir:
  <<: *build_coccinelle_def
  variables:
    from: debian-4.09.0-menhir

build with debian 4.09 with parmap:
  <<: *build_coccinelle_def
  variables:
    from: debian-4.09.0-parmap

build with debian 4.09 with pyml:
  <<: *build_coccinelle_def
  variables:
    from: debian-4.09.0-pyml

build with debian 4.09 with all dependencies:
  <<: *build_coccinelle_def
  variables:
    from: debian-4.09.0-all-dependencies

build with opensuse/leap 4.09:
  <<: *build_coccinelle_def
  variables:
    from: opensuse-leap-4.09.0

build with opensuse/leap 4.14:
  <<: *build_coccinelle_def
  variables:
    from: opensuse-leap-4.14.1

build with opensuse/leap 5.0:
  <<: *build_coccinelle_def
  variables:
    from: opensuse-leap-5.0.0

clone reference scores:
  stage: clone reference scores
  script:
    - git clone git@gitlab.inria.fr:coccinelle/reference_scores.git
  artifacts:
    paths:
      - reference_scores/

# Note: use the shell command "test" instead of "[" since yaml wants to parse
# lines starting with square brackets as lists

.test coccinelle: &test_coccinelle_def
  stage: test
  script:
    - docker rm coccinelle-with-$from || true
    - docker create --name coccinelle-with-$from coccinelle-with-$from
        /home/ci/coccinelle/ci/test-script.sh
    - test ! -f reference_scores/$from || docker cp
        reference_scores/$from
        coccinelle-with-$from:/home/ci/coccinelle/tests/SCORE_expected.sexp
    - docker start --interactive coccinelle-with-$from
    - docker cp
        coccinelle-with-$from:/home/ci/coccinelle/tests/SCORE_expected.sexp
        reference_scores/$from
    - docker rm coccinelle-with-$from
  artifacts:
    paths:
      - reference_scores/$from

test with debian 3.12:
  <<: *test_coccinelle_def
  variables:
    from: debian-3.12.1

test with debian 4.09:
  <<: *test_coccinelle_def
  variables:
    from: debian-4.09.0

test with debian 4.14:
  <<: *test_coccinelle_def
  variables:
    from: debian-4.14.1

test with debian 5.0:
  <<: *test_coccinelle_def
  variables:
    from: debian-5.0.0

test with debian 4.09 with menhir:
  <<: *test_coccinelle_def
  variables:
    from: debian-4.09.0-menhir

test with debian 4.09 with parmap:
  <<: *test_coccinelle_def
  variables:
    from: debian-4.09.0-parmap

test with debian 4.09 with pyml:
  <<: *test_coccinelle_def
  variables:
    from: debian-4.09.0-pyml

test with debian 4.09 with all dependencies:
  <<: *test_coccinelle_def
  variables:
    from: debian-4.09.0-all-dependencies

test with debian 4.09 without python:
  <<: *test_coccinelle_def
  variables:
    from: debian-4.09.0
    configure_options: --disable-python

test with opensuse/leap 4.09:
  <<: *test_coccinelle_def
  variables:
    from: opensuse-leap-4.09.0

test with opensuse/leap 4.14:
  <<: *test_coccinelle_def
  variables:
    from: opensuse-leap-4.14.1

test with opensuse/leap 5.0:
  <<: *test_coccinelle_def
  variables:
    from: opensuse-leap-5.0.0

push reference scores:
  stage: .post
  only:
    - master@coccinelle/coccinelle
  script:
    - cd reference_scores &&
        git add * &&
        git commit -m "reference scores for commit $CI_COMMIT_SHORT_SHA" &&
        git push
      || true

#trace-cmd-check-changed:
#  stage: trace-cmd
#  image: "registry.gitlab.inria.fr/inria-ci/docker/python3-cloudstack"
#  tags:
#    - linux
#    - small
#  rules:
#    - if: $CLOUDSTACK_API_KEY
#  script:
#    - cd ci/trace-cmd
#    - python3 check-template-changed.py > ../../trace-cmd-config.yml
#  artifacts:
#    paths: [trace-cmd-config.yml]
#
#trace-cmd:
#  stage: trace-cmd
#  needs: [trace-cmd-check-changed]
#  rules:
#    - if: $CLOUDSTACK_API_KEY
#  trigger:
#    include:
#      - artifact: trace-cmd-config.yml
#        job: trace-cmd-check-changed