.gitlab-ci.yml 5.74 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
26
  rules:
    - if: '$TRIGGERED_FROM_OTHER_PROJECT'
      when: never
    - when: always
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
52
53
  rules:
    - if: '$TRIGGERED_FROM_OTHER_PROJECT'
      when: never
    - changes:
        - "**/*.yaml"
        - "*.yaml"
        - "**/*.yml"
        - "*.yml"
Laurent Peuch's avatar
Laurent Peuch committed
54
55
56
57
58
59
  stage: lint
  before_script:
    - pip install tox
  script:
    - tox -e yamllint

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

py3_server:
Laurent Peuch's avatar
Laurent Peuch committed
78
79
80
81
82
  rules:
    - if: '$TRIGGERED_FROM_OTHER_PROJECT'
      when: never
    - changes:
        - cubicweb/**/*
83
84
  stage: tests
  image: r.intra.logilab.fr/jenkins/jnlp:buster
85
86
87
  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
88
89
  script:
    - tox -e py3-server
90
91
92
  artifacts:
    paths:
      - /builds/cubicweb/cubicweb/server.html
93
      - /builds/cubicweb/cubicweb/py3-server-deprecated-warnings.json
94
      - /reports/coverage-server.xml
95
96

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

py3_misc:
Laurent Peuch's avatar
Laurent Peuch committed
115
116
117
118
119
  rules:
    - if: '$TRIGGERED_FROM_OTHER_PROJECT'
      when: never
    - changes:
        - cubicweb/**/*
120
121
  stage: tests
  image: r.intra.logilab.fr/jenkins/jnlp:buster
122
123
  before_script:
    - sudo apt update && sudo apt install -y firefox-esr
124
125
  script:
    - tox -e py3-misc
126
127
128
  artifacts:
    paths:
      - /builds/cubicweb/cubicweb/misc.html
129
      - /builds/cubicweb/cubicweb/py3-misc-deprecated-warnings.json
130
      - /reports/coverage-misc.xml
Laurent Peuch's avatar
Laurent Peuch committed
131

132
py3-from-forge-server:
Laurent Peuch's avatar
Laurent Peuch committed
133
134
135
136
  rules:
    - changes:
        - cubicweb/**/*
    - if: '$TRIGGERED_FROM_OTHER_PROJECT'
Laurent Peuch's avatar
Laurent Peuch committed
137
138
  stage: tests
  image: r.intra.logilab.fr/jenkins/jnlp:buster
139
  allow_failure: true
140
141
142
  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
143
144
145
  artifacts:
    paths:
      - /builds/cubicweb/cubicweb/from-forge-server.html
146
      - /builds/cubicweb/cubicweb/py3-from-forge-server-deprecated-warnings.json
Laurent Peuch's avatar
Laurent Peuch committed
147
148
  script:
    - tox -e py3-from-forge-server
149
150

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

py3-from-forge-misc:
Laurent Peuch's avatar
Laurent Peuch committed
168
169
170
171
  rules:
    - changes:
        - cubicweb/**/*
    - if: '$TRIGGERED_FROM_OTHER_PROJECT'
172
173
174
  stage: tests
  image: r.intra.logilab.fr/jenkins/jnlp:buster
  allow_failure: true
175
176
  before_script:
    - sudo apt update && sudo apt install -y firefox-esr
177
178
  script:
    - tox -e py3-from-forge-misc
179
180
181
  artifacts:
    paths:
      - /builds/cubicweb/cubicweb/from-forge-misc.html
182
      - /builds/cubicweb/cubicweb/py3-from-forge-misc-deprecated-warnings.json
183
184

trigger-readthedocs:
Laurent Peuch's avatar
Laurent Peuch committed
185
186
187
188
189
190
191
  rules:
    - if: '$TRIGGERED_FROM_OTHER_PROJECT'
      when: never
    - if: '$CI_COMMIT_REF_NAME == "branch/default"'
      changes:
        - cubicweb/**/*
        - doc/**/*
192
193
  stage: after-tests
  script:
Laurent Peuch's avatar
Laurent Peuch committed
194
195
    # 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
196
197
198
199

sonarqube:
  stage: qa
  image: sonarsource/sonar-scanner-cli
Laurent Peuch's avatar
Laurent Peuch committed
200
201
202
203
  rules:
    - if: '$TRIGGERED_FROM_OTHER_PROJECT'
      when: never
    - if: '$CI_COMMIT_REF_NAME == "branch/default"'
Arthur Lutz's avatar
Arthur Lutz committed
204
205
206
207
208
209
210
211
212
213
214
  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}
215
216
217

pages:
  stage: deploy
Laurent Peuch's avatar
Laurent Peuch committed
218
219
220
221
  rules:
    - if: '$TRIGGERED_FROM_OTHER_PROJECT'
      when: never
    - if: '$CI_COMMIT_REF_NAME == "branch/default"'
222
223
224
  before_script:
    - pip install tox
  script:
225
226
227
228
229
    # 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
230
231
232
233
    - mv .tox/doc/tmp/html public
  artifacts:
    paths:
      - public