.gitlab-ci.yml 5.47 KB
Newer Older
1
2
3
4
5
image: python:latest

stages:
  - lint
  - tests
6
  - after-tests
7
  - qa
8
  - deploy
9
10

lint_py:
11
12
13
  except:
    variables:
      - $TRIGGERED_FROM_OTHER_PROJECT
14
15
16
  only:
    changes:
      - "**/*.py"
17
18
19
20
21
22
23
  stage: lint
  before_script:
    - pip install tox
  script:
    - tox -e flake8

lint_manifest:
24
25
26
  except:
    variables:
      - $TRIGGERED_FROM_OTHER_PROJECT
27
28
29
30
31
32
33
  stage: lint
  before_script:
    - pip install tox
  script:
    - tox -e check-manifest

lint_doc8:
34
35
36
  except:
    variables:
      - $TRIGGERED_FROM_OTHER_PROJECT
37
38
39
  only:
    changes:
      - doc/**/*
40
41
42
43
44
45
  stage: lint
  before_script:
    - pip install tox
  script:
    - tox -e doc8

Laurent Peuch's avatar
Laurent Peuch committed
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
lint_yaml:
  except:
    variables:
      - $TRIGGERED_FROM_OTHER_PROJECT
  only:
    changes:
      - "**/*.yaml"
      - "*.yaml"
      - "**/*.yml"
      - "*.yml"
  stage: lint
  before_script:
    - pip install tox
  script:
    - tox -e yamllint

62
build_doc:
Laurent Peuch's avatar
Laurent Peuch committed
63
64
65
  only:
    changes:
      - doc/**/*
66
      - "**/*.py"
67
68
69
  except:
    variables:
      - $TRIGGERED_FROM_OTHER_PROJECT
70
71
72
73
74
  stage: lint
  before_script:
    - pip install tox
  script:
    - tox -e doc
75
76
77
78
  artifacts:
    paths:
      - .tox/doc/tmp/html
  allow_failure: true # XXX fix me
79
80

py3_server:
81
82
83
  except:
    variables:
      - $TRIGGERED_FROM_OTHER_PROJECT
84
85
  stage: tests
  image: r.intra.logilab.fr/jenkins/jnlp:buster
86
87
88
  before_script:
    - sudo apt update
    - sudo DEBIAN_FRONTEND=noninteractive APT_LISTCHANGES_FRONTEND=none apt-get install -y --assume-yes -qq -o=Dpkg::Use-Pty=0 slapd ldap-utils
89
90
  script:
    - tox -e py3-server
91
92
93
  artifacts:
    paths:
      - /builds/cubicweb/cubicweb/server.html
94
      - /builds/cubicweb/cubicweb/py3-server-deprecated-warnings.json
95
      - /reports/coverage-server.xml
96
97
98
  only:
    changes:
      - cubicweb/**/*
99
100

py3_web:
101
102
103
  except:
    variables:
      - $TRIGGERED_FROM_OTHER_PROJECT
Laurent Peuch's avatar
Laurent Peuch committed
104
105
106
  only:
    changes:
      - cubicweb/**/*
107
108
  stage: tests
  image: r.intra.logilab.fr/jenkins/jnlp:buster
109
110
  before_script:
    - sudo apt update && sudo apt install -y firefox-esr
111
112
  script:
    - tox -e py3-web
113
114
115
  artifacts:
    paths:
      - /builds/cubicweb/cubicweb/web.html
116
      - /builds/cubicweb/cubicweb/py3-web-deprecated-warnings.json
117
      - /reports/coverage-web.xml
118
119

py3_misc:
120
121
122
  except:
    variables:
      - $TRIGGERED_FROM_OTHER_PROJECT
Laurent Peuch's avatar
Laurent Peuch committed
123
124
125
  only:
    changes:
      - cubicweb/**/*
126
127
  stage: tests
  image: r.intra.logilab.fr/jenkins/jnlp:buster
128
129
  before_script:
    - sudo apt update && sudo apt install -y firefox-esr
130
131
  script:
    - tox -e py3-misc
132
133
134
  artifacts:
    paths:
      - /builds/cubicweb/cubicweb/misc.html
135
      - /builds/cubicweb/cubicweb/py3-misc-deprecated-warnings.json
136
      - /reports/coverage-misc.xml
Laurent Peuch's avatar
Laurent Peuch committed
137

138
py3-from-forge-server:
139
140
141
  only:
    changes:
      - cubicweb/**/*
Laurent Peuch's avatar
Laurent Peuch committed
142
143
  stage: tests
  image: r.intra.logilab.fr/jenkins/jnlp:buster
144
  allow_failure: true
145
146
147
  before_script:
    - sudo apt update
    - sudo DEBIAN_FRONTEND=noninteractive APT_LISTCHANGES_FRONTEND=none apt-get install -y --assume-yes -qq -o=Dpkg::Use-Pty=0 slapd ldap-utils
148
149
150
  artifacts:
    paths:
      - /builds/cubicweb/cubicweb/from-forge-server.html
151
      - /builds/cubicweb/cubicweb/py3-from-forge-server-deprecated-warnings.json
Laurent Peuch's avatar
Laurent Peuch committed
152
153
  script:
    - tox -e py3-from-forge-server
154
155

py3-from-forge-web:
Laurent Peuch's avatar
Laurent Peuch committed
156
157
158
  only:
    changes:
      - cubicweb/**/*
159
160
161
  stage: tests
  image: r.intra.logilab.fr/jenkins/jnlp:buster
  allow_failure: true
162
163
  before_script:
    - sudo apt update && sudo apt install -y firefox-esr
164
165
  script:
    - tox -e py3-from-forge-web
166
167
168
  artifacts:
    paths:
      - /builds/cubicweb/cubicweb/from-forge-web.html
169
      - /builds/cubicweb/cubicweb/py3-from-forge-web-deprecated-warnings.json
170
171

py3-from-forge-misc:
172
173
174
  only:
    changes:
      - cubicweb/**/*
175
176
177
  stage: tests
  image: r.intra.logilab.fr/jenkins/jnlp:buster
  allow_failure: true
178
179
  before_script:
    - sudo apt update && sudo apt install -y firefox-esr
180
181
  script:
    - tox -e py3-from-forge-misc
182
183
184
  artifacts:
    paths:
      - /builds/cubicweb/cubicweb/from-forge-misc.html
185
      - /builds/cubicweb/cubicweb/py3-from-forge-misc-deprecated-warnings.json
186
187

trigger-readthedocs:
188
189
190
  only:
    refs:
      - branch/default
Laurent Peuch's avatar
Laurent Peuch committed
191
192
193
    changes:
      - cubicweb/**/*
      - doc/**/*
194
195
196
  except:
    variables:
      - $TRIGGERED_FROM_OTHER_PROJECT
197
198
  stage: after-tests
  script:
199
200
  # regarding the " everywhere when there is a '%': yaml is extremly weird when % are involved
  - curl -X POST -d "token=${READTHEDOCS_TOKEN}" https://readthedocs.org/api/v2/webhook/cubicweb/33537/ -w "\nhttp code:"\ "%{http_code}\n" -f
Arthur Lutz's avatar
Arthur Lutz committed
201
202
203
204

sonarqube:
  stage: qa
  image: sonarsource/sonar-scanner-cli
205
206
  only:
    - branch/default
207
208
209
  except:
    variables:
      - $TRIGGERED_FROM_OTHER_PROJECT
Arthur Lutz's avatar
Arthur Lutz committed
210
211
212
213
214
215
216
217
218
219
220
  script:
    - apk add python3 mercurial
    - sonar-scanner
      --define sonar.scm.revision=${CI_COMMIT_REF_NAME##*/}
      --define sonar.projectBaseDir=.
      --define sonar.projectVersion=`python3 ./setup.py --version`
      --define sonar.scm.provider=hg
      --define sonar.projectKey=${CI_PROJECT_PATH_SLUG}
      --define sonar.projectName=${CI_PROJECT_TITLE}
      --define sonar.links.homepage=${CI_PROJECT_URL}
      --define sonar.host.url=${SONAR_URL}
221
222
223

pages:
  stage: deploy
224
225
226
  except:
    variables:
      - $TRIGGERED_FROM_OTHER_PROJECT
227
228
229
  before_script:
    - pip install tox
  script:
230
231
232
233
234
    # remove previous artifacts from build_doc if any (cf. #206). The .tox/doc
    # directory does not « look as a virtualenv », and tox refuses to remove it.
    # Let's do it manually.
    - rm -rf .tox/doc/
    - tox -e doc
235
236
237
238
239
240
    - mv .tox/doc/tmp/html public
  artifacts:
    paths:
      - public
  only:
    - branch/default