.gitlab-ci.yml 5.23 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

46
build_doc:
Laurent Peuch's avatar
Laurent Peuch committed
47
48
49
  only:
    changes:
      - doc/**/*
50
      - "**/*.py"
51
52
53
  except:
    variables:
      - $TRIGGERED_FROM_OTHER_PROJECT
54
55
56
57
58
  stage: lint
  before_script:
    - pip install tox
  script:
    - tox -e doc
59
60
61
62
  artifacts:
    paths:
      - .tox/doc/tmp/html
  allow_failure: true # XXX fix me
63
64

py3_server:
65
66
67
  except:
    variables:
      - $TRIGGERED_FROM_OTHER_PROJECT
68
69
  stage: tests
  image: r.intra.logilab.fr/jenkins/jnlp:buster
70
71
72
  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
73
74
  script:
    - tox -e py3-server
75
76
77
  artifacts:
    paths:
      - /builds/cubicweb/cubicweb/server.html
78
      - /builds/cubicweb/cubicweb/py3-server-deprecated-warnings.json
79
      - /reports/coverage-server.xml
80
81
82
  only:
    changes:
      - cubicweb/**/*
83
84

py3_web:
85
86
87
  except:
    variables:
      - $TRIGGERED_FROM_OTHER_PROJECT
Laurent Peuch's avatar
Laurent Peuch committed
88
89
90
  only:
    changes:
      - cubicweb/**/*
91
92
  stage: tests
  image: r.intra.logilab.fr/jenkins/jnlp:buster
93
94
  before_script:
    - sudo apt update && sudo apt install -y firefox-esr
95
96
  script:
    - tox -e py3-web
97
98
99
  artifacts:
    paths:
      - /builds/cubicweb/cubicweb/web.html
100
      - /builds/cubicweb/cubicweb/py3-web-deprecated-warnings.json
101
      - /reports/coverage-web.xml
102
103

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

122
py3-from-forge-server:
123
124
125
  only:
    changes:
      - cubicweb/**/*
Laurent Peuch's avatar
Laurent Peuch committed
126
127
  stage: tests
  image: r.intra.logilab.fr/jenkins/jnlp:buster
128
  allow_failure: true
129
130
131
  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
132
133
134
  artifacts:
    paths:
      - /builds/cubicweb/cubicweb/from-forge-server.html
135
      - /builds/cubicweb/cubicweb/py3-from-forge-server-deprecated-warnings.json
Laurent Peuch's avatar
Laurent Peuch committed
136
137
  script:
    - tox -e py3-from-forge-server
138
139

py3-from-forge-web:
Laurent Peuch's avatar
Laurent Peuch committed
140
141
142
  only:
    changes:
      - cubicweb/**/*
143
144
145
  stage: tests
  image: r.intra.logilab.fr/jenkins/jnlp:buster
  allow_failure: true
146
147
  before_script:
    - sudo apt update && sudo apt install -y firefox-esr
148
149
  script:
    - tox -e py3-from-forge-web
150
151
152
  artifacts:
    paths:
      - /builds/cubicweb/cubicweb/from-forge-web.html
153
      - /builds/cubicweb/cubicweb/py3-from-forge-web-deprecated-warnings.json
154
155

py3-from-forge-misc:
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-misc
166
167
168
  artifacts:
    paths:
      - /builds/cubicweb/cubicweb/from-forge-misc.html
169
      - /builds/cubicweb/cubicweb/py3-from-forge-misc-deprecated-warnings.json
170
171

trigger-readthedocs:
172
173
174
  only:
    refs:
      - branch/default
Laurent Peuch's avatar
Laurent Peuch committed
175
176
177
    changes:
      - cubicweb/**/*
      - doc/**/*
178
179
180
  except:
    variables:
      - $TRIGGERED_FROM_OTHER_PROJECT
181
182
  stage: after-tests
  script:
183
184
  # 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
185
186
187
188

sonarqube:
  stage: qa
  image: sonarsource/sonar-scanner-cli
189
190
  only:
    - branch/default
191
192
193
  except:
    variables:
      - $TRIGGERED_FROM_OTHER_PROJECT
Arthur Lutz's avatar
Arthur Lutz committed
194
195
196
197
198
199
200
201
202
203
204
  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}
205
206
207

pages:
  stage: deploy
208
209
210
  except:
    variables:
      - $TRIGGERED_FROM_OTHER_PROJECT
211
212
213
  before_script:
    - pip install tox
  script:
214
215
216
217
218
    # 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
219
220
221
222
223
224
    - mv .tox/doc/tmp/html public
  artifacts:
    paths:
      - public
  only:
    - branch/default