.gitlab-ci.yml 6.39 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:
Laurent Peuch's avatar
Laurent Peuch committed
11
12
13
14
15
  rules:
    - if: '$TRIGGERED_FROM_OTHER_PROJECT'
      when: never
    - changes:
        - "**/*.py"
16
17
18
19
20
21
22
  stage: lint
  before_script:
    - pip install tox
  script:
    - tox -e flake8

lint_manifest:
Laurent Peuch's avatar
Laurent Peuch committed
23
24
25
  rules:
    - if: '$TRIGGERED_FROM_OTHER_PROJECT'
      when: never
26
    - when: on_success
27
28
29
30
31
32
33
  stage: lint
  before_script:
    - pip install tox
  script:
    - tox -e check-manifest

lint_doc8:
Laurent Peuch's avatar
Laurent Peuch committed
34
35
36
37
38
  rules:
    - if: '$TRIGGERED_FROM_OTHER_PROJECT'
      when: never
    - changes:
        - doc/**/*
39
40
41
42
43
44
  stage: lint
  before_script:
    - pip install tox
  script:
    - tox -e doc8

Laurent Peuch's avatar
Laurent Peuch committed
45
lint_yaml:
Laurent Peuch's avatar
Laurent Peuch committed
46
47
48
49
50
51
  rules:
    - if: '$TRIGGERED_FROM_OTHER_PROJECT'
      when: never
    - changes:
        - "**/*.yaml"
        - "**/*.yml"
Laurent Peuch's avatar
Laurent Peuch committed
52
53
54
55
56
57
  stage: lint
  before_script:
    - pip install tox
  script:
    - tox -e yamllint

58
build_doc:
Laurent Peuch's avatar
Laurent Peuch committed
59
60
61
62
63
64
  rules:
    - if: '$TRIGGERED_FROM_OTHER_PROJECT'
      when: never
    - changes:
        - doc/**/*
        - "**/*.py"
65
66
67
68
69
  stage: lint
  before_script:
    - pip install tox
  script:
    - tox -e doc
70
71
72
  artifacts:
    paths:
      - .tox/doc/tmp/html
Laurent Peuch's avatar
Laurent Peuch committed
73
  allow_failure: true  # XXX fix me
74
75

py3_server:
Laurent Peuch's avatar
Laurent Peuch committed
76
77
78
79
80
  rules:
    - if: '$TRIGGERED_FROM_OTHER_PROJECT'
      when: never
    - changes:
        - cubicweb/**/*
81
82
83
        - "*.py"  # setup.py
        - requirements/dev.txt
        - requirements/test-server.txt
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

py3_web:
Laurent Peuch's avatar
Laurent Peuch committed
98
99
100
101
102
  rules:
    - if: '$TRIGGERED_FROM_OTHER_PROJECT'
      when: never
    - changes:
        - cubicweb/**/*
103
104
105
        - "*.py"  # setup.py
        - requirements/dev.txt
        - requirements/test-web.txt
106
107
  stage: tests
  image: r.intra.logilab.fr/jenkins/jnlp:buster
108
109
  before_script:
    - sudo apt update && sudo apt install -y firefox-esr
110
111
  script:
    - tox -e py3-web
112
113
114
  artifacts:
    paths:
      - /builds/cubicweb/cubicweb/web.html
115
      - /builds/cubicweb/cubicweb/py3-web-deprecated-warnings.json
116
      - /reports/coverage-web.xml
117
118

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

139
py3-from-forge-server:
Laurent Peuch's avatar
Laurent Peuch committed
140
141
142
  rules:
    - changes:
        - cubicweb/**/*
143
144
145
146
        - "*.py"  # setup.py
        - requirements/from-forge.txt
        - requirements/dev.txt
        - requirements/test-server.txt
Laurent Peuch's avatar
Laurent Peuch committed
147
    - if: '$TRIGGERED_FROM_OTHER_PROJECT'
Laurent Peuch's avatar
Laurent Peuch committed
148
149
  stage: tests
  image: r.intra.logilab.fr/jenkins/jnlp:buster
150
  allow_failure: true
151
152
153
  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
154
155
156
  artifacts:
    paths:
      - /builds/cubicweb/cubicweb/from-forge-server.html
157
      - /builds/cubicweb/cubicweb/py3-from-forge-server-deprecated-warnings.json
Laurent Peuch's avatar
Laurent Peuch committed
158
159
  script:
    - tox -e py3-from-forge-server
160
161

py3-from-forge-web:
Laurent Peuch's avatar
Laurent Peuch committed
162
163
164
  rules:
    - changes:
        - cubicweb/**/*
165
166
167
168
        - "*.py"  # setup.py
        - requirements/from-forge.txt
        - requirements/dev.txt
        - requirements/test-web.txt
Laurent Peuch's avatar
Laurent Peuch committed
169
    - if: '$TRIGGERED_FROM_OTHER_PROJECT'
170
171
172
  stage: tests
  image: r.intra.logilab.fr/jenkins/jnlp:buster
  allow_failure: true
173
174
  before_script:
    - sudo apt update && sudo apt install -y firefox-esr
175
176
  script:
    - tox -e py3-from-forge-web
177
178
179
  artifacts:
    paths:
      - /builds/cubicweb/cubicweb/from-forge-web.html
180
      - /builds/cubicweb/cubicweb/py3-from-forge-web-deprecated-warnings.json
181
182

py3-from-forge-misc:
Laurent Peuch's avatar
Laurent Peuch committed
183
184
185
  rules:
    - changes:
        - cubicweb/**/*
186
187
188
189
        - "*.py"  # setup.py
        - requirements/from-forge.txt
        - requirements/dev.txt
        - requirements/test-misc.txt
Laurent Peuch's avatar
Laurent Peuch committed
190
    - if: '$TRIGGERED_FROM_OTHER_PROJECT'
191
192
193
  stage: tests
  image: r.intra.logilab.fr/jenkins/jnlp:buster
  allow_failure: true
194
195
  before_script:
    - sudo apt update && sudo apt install -y firefox-esr
196
197
  script:
    - tox -e py3-from-forge-misc
198
199
200
  artifacts:
    paths:
      - /builds/cubicweb/cubicweb/from-forge-misc.html
201
      - /builds/cubicweb/cubicweb/py3-from-forge-misc-deprecated-warnings.json
202
203

trigger-readthedocs:
Laurent Peuch's avatar
Laurent Peuch committed
204
205
206
207
208
209
210
  rules:
    - if: '$TRIGGERED_FROM_OTHER_PROJECT'
      when: never
    - if: '$CI_COMMIT_REF_NAME == "branch/default"'
      changes:
        - cubicweb/**/*
        - doc/**/*
211
212
  stage: after-tests
  script:
Laurent Peuch's avatar
Laurent Peuch committed
213
214
    # 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
215
216
217
218

sonarqube:
  stage: qa
  image: sonarsource/sonar-scanner-cli
Laurent Peuch's avatar
Laurent Peuch committed
219
220
221
222
  rules:
    - if: '$TRIGGERED_FROM_OTHER_PROJECT'
      when: never
    - if: '$CI_COMMIT_REF_NAME == "branch/default"'
Arthur Lutz's avatar
Arthur Lutz committed
223
224
225
226
227
228
229
230
231
232
233
  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}
234
235
236

pages:
  stage: deploy
Laurent Peuch's avatar
Laurent Peuch committed
237
238
239
240
  rules:
    - if: '$TRIGGERED_FROM_OTHER_PROJECT'
      when: never
    - if: '$CI_COMMIT_REF_NAME == "branch/default"'
241
242
243
  before_script:
    - pip install tox
  script:
244
245
246
247
248
    # 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
249
250
251
252
    - mv .tox/doc/tmp/html public
  artifacts:
    paths:
      - public