.gitlab-ci.yml 5.1 KB
Newer Older
Noé Gaumont's avatar
Noé Gaumont committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
image: python:latest

stages:
  - lint
  - tests
  - after-tests
  - qa
  - deploy

lint_py:
  except:
    variables:
      - $TRIGGERED_FROM_OTHER_PROJECT
  stage: lint
  before_script:
    - pip install tox
  script:
    - tox -e flake8
Noé Gaumont's avatar
Noé Gaumont committed
19
  allow_failure: true # XXX fix me
Noé Gaumont's avatar
Noé Gaumont committed
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

lint_manifest:
  except:
    variables:
      - $TRIGGERED_FROM_OTHER_PROJECT
  stage: lint
  before_script:
    - pip install tox
  script:
    - tox -e check-manifest

lint_doc8:
  except:
    variables:
      - $TRIGGERED_FROM_OTHER_PROJECT
  only:
    changes:
      - doc/**/*
  stage: lint
  before_script:
    - pip install tox
  script:
    - tox -e doc8

build_doc:
  only:
    changes:
      - doc/**/*
      - "**/*.py"
  except:
    variables:
      - $TRIGGERED_FROM_OTHER_PROJECT
  stage: lint
  before_script:
    - pip install tox
  script:
    - tox -e doc
  artifacts:
    paths:
      - .tox/doc/tmp/html
  allow_failure: true # XXX fix me

py3_server:
  except:
    variables:
      - $TRIGGERED_FROM_OTHER_PROJECT
  stage: tests
  image: r.intra.logilab.fr/jenkins/jnlp:buster
  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
  script:
    - tox -e py3-server
  artifacts:
    paths:
      - /builds/cubicweb/cubicweb/server.html
      - /builds/cubicweb/cubicweb/py3-server-deprecated-warnings.json
      - /reports/coverage-server.xml

py3_web:
  except:
    variables:
      - $TRIGGERED_FROM_OTHER_PROJECT
  stage: tests
  image: r.intra.logilab.fr/jenkins/jnlp:buster
  before_script:
    - sudo apt update && sudo apt install -y firefox-esr
  script:
    - tox -e py3-web
  artifacts:
    paths:
      - /builds/cubicweb/cubicweb/web.html
      - /builds/cubicweb/cubicweb/py3-web-deprecated-warnings.json
      - /reports/coverage-web.xml

py3_misc:
  except:
    variables:
      - $TRIGGERED_FROM_OTHER_PROJECT
  stage: tests
  image: r.intra.logilab.fr/jenkins/jnlp:buster
  before_script:
    - sudo apt update && sudo apt install -y firefox-esr
  script:
    - tox -e py3-misc
  artifacts:
    paths:
      - /builds/cubicweb/cubicweb/misc.html
      - /builds/cubicweb/cubicweb/py3-misc-deprecated-warnings.json
      - /reports/coverage-misc.xml

py3-from-forge-server:
  only:
    changes:
      - cubicweb/**/*
  stage: tests
  image: r.intra.logilab.fr/jenkins/jnlp:buster
  allow_failure: true
  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
  artifacts:
    paths:
      - /builds/cubicweb/cubicweb/from-forge-server.html
      - /builds/cubicweb/cubicweb/py3-from-forge-server-deprecated-warnings.json
  script:
    - tox -e py3-from-forge-server

py3-from-forge-web:
  only:
    changes:
      - cubicweb/**/*
  stage: tests
  image: r.intra.logilab.fr/jenkins/jnlp:buster
  allow_failure: true
  before_script:
    - sudo apt update && sudo apt install -y firefox-esr
  script:
    - tox -e py3-from-forge-web
  artifacts:
    paths:
      - /builds/cubicweb/cubicweb/from-forge-web.html
      - /builds/cubicweb/cubicweb/py3-from-forge-web-deprecated-warnings.json

py3-from-forge-misc:
  only:
    changes:
      - cubicweb/**/*
  stage: tests
  image: r.intra.logilab.fr/jenkins/jnlp:buster
  allow_failure: true
  before_script:
    - sudo apt update && sudo apt install -y firefox-esr
  script:
    - tox -e py3-from-forge-misc
  artifacts:
    paths:
      - /builds/cubicweb/cubicweb/from-forge-misc.html
      - /builds/cubicweb/cubicweb/py3-from-forge-misc-deprecated-warnings.json

trigger-readthedocs:
  only:
    refs:
      - branch/default
    changes:
      - cubicweb/**/*
      - doc/**/*
  except:
    variables:
      - $TRIGGERED_FROM_OTHER_PROJECT
  stage: after-tests
  script:
  # 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

sonarqube:
  stage: qa
  image: sonarsource/sonar-scanner-cli
  only:
    - branch/default
  except:
    variables:
      - $TRIGGERED_FROM_OTHER_PROJECT
  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}

pages:
  stage: deploy
  except:
    variables:
      - $TRIGGERED_FROM_OTHER_PROJECT
  before_script:
    - pip install tox
  script:
    # 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
    - mv .tox/doc/tmp/html public
  artifacts:
    paths:
      - public
  only:
    - branch/default