ci: backport gitlab-ci

authorNoe Gaumont <ngaumont@logilab.fr>
changesetb78885397de8
branch3.27
phasedraft
hiddenyes
parent revision#601e933448f1 [pkg] version 3.27.4
child revision#cea48cc49bb8 ci: force test
files modified by this revision
.gitlab-ci.yml
MANIFEST.in
# HG changeset patch
# User Noe Gaumont <ngaumont@logilab.fr>
# Date 1611753909 -3600
# Wed Jan 27 14:25:09 2021 +0100
# Branch 3.27
# Node ID b78885397de83b198551259066396d895e2a2cd6
# Parent 601e933448f178c8072f3ae0c35e535e7de665c7
ci: backport gitlab-ci

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
@@ -0,0 +1,224 @@
1 +image: python:latest
2 +
3 +stages:
4 +  - lint
5 +  - tests
6 +  - after-tests
7 +  - qa
8 +  - deploy
9 +
10 +lint_py:
11 +  except:
12 +    variables:
13 +      - $TRIGGERED_FROM_OTHER_PROJECT
14 +  only:
15 +    changes:
16 +      - "**/*.py"
17 +  stage: lint
18 +  before_script:
19 +    - pip install tox
20 +  script:
21 +    - tox -e flake8
22 +
23 +lint_manifest:
24 +  except:
25 +    variables:
26 +      - $TRIGGERED_FROM_OTHER_PROJECT
27 +  stage: lint
28 +  before_script:
29 +    - pip install tox
30 +  script:
31 +    - tox -e check-manifest
32 +
33 +lint_doc8:
34 +  except:
35 +    variables:
36 +      - $TRIGGERED_FROM_OTHER_PROJECT
37 +  only:
38 +    changes:
39 +      - doc/**/*
40 +  stage: lint
41 +  before_script:
42 +    - pip install tox
43 +  script:
44 +    - tox -e doc8
45 +
46 +build_doc:
47 +  only:
48 +    changes:
49 +      - doc/**/*
50 +      - "**/*.py"
51 +  except:
52 +    variables:
53 +      - $TRIGGERED_FROM_OTHER_PROJECT
54 +  stage: lint
55 +  before_script:
56 +    - pip install tox
57 +  script:
58 +    - tox -e doc
59 +  artifacts:
60 +    paths:
61 +      - .tox/doc/tmp/html
62 +  allow_failure: true # XXX fix me
63 +
64 +py3_server:
65 +  except:
66 +    variables:
67 +      - $TRIGGERED_FROM_OTHER_PROJECT
68 +  stage: tests
69 +  image: r.intra.logilab.fr/jenkins/jnlp:buster
70 +  before_script:
71 +    - sudo apt update
72 +    - sudo DEBIAN_FRONTEND=noninteractive APT_LISTCHANGES_FRONTEND=none apt-get install -y --assume-yes -qq -o=Dpkg::Use-Pty=0 slapd ldap-utils
73 +  script:
74 +    - tox -e py3-server
75 +  artifacts:
76 +    paths:
77 +      - /builds/cubicweb/cubicweb/server.html
78 +      - /builds/cubicweb/cubicweb/py3-server-deprecated-warnings.json
79 +      - /reports/coverage-server.xml
80 +  only:
81 +    changes:
82 +      - cubicweb/**/*
83 +
84 +py3_web:
85 +  except:
86 +    variables:
87 +      - $TRIGGERED_FROM_OTHER_PROJECT
88 +  only:
89 +    changes:
90 +      - cubicweb/**/*
91 +  stage: tests
92 +  image: r.intra.logilab.fr/jenkins/jnlp:buster
93 +  before_script:
94 +    - sudo apt update && sudo apt install -y firefox-esr
95 +  script:
96 +    - tox -e py3-web
97 +  artifacts:
98 +    paths:
99 +      - /builds/cubicweb/cubicweb/web.html
100 +      - /builds/cubicweb/cubicweb/py3-web-deprecated-warnings.json
101 +      - /reports/coverage-web.xml
102 +
103 +py3_misc:
104 +  except:
105 +    variables:
106 +      - $TRIGGERED_FROM_OTHER_PROJECT
107 +  only:
108 +    changes:
109 +      - cubicweb/**/*
110 +  stage: tests
111 +  image: r.intra.logilab.fr/jenkins/jnlp:buster
112 +  before_script:
113 +    - sudo apt update && sudo apt install -y firefox-esr
114 +  script:
115 +    - tox -e py3-misc
116 +  artifacts:
117 +    paths:
118 +      - /builds/cubicweb/cubicweb/misc.html
119 +      - /builds/cubicweb/cubicweb/py3-misc-deprecated-warnings.json
120 +      - /reports/coverage-misc.xml
121 +
122 +py3-from-forge-server:
123 +  only:
124 +    changes:
125 +      - cubicweb/**/*
126 +  stage: tests
127 +  image: r.intra.logilab.fr/jenkins/jnlp:buster
128 +  allow_failure: true
129 +  before_script:
130 +    - sudo apt update
131 +    - sudo DEBIAN_FRONTEND=noninteractive APT_LISTCHANGES_FRONTEND=none apt-get install -y --assume-yes -qq -o=Dpkg::Use-Pty=0 slapd ldap-utils
132 +  artifacts:
133 +    paths:
134 +      - /builds/cubicweb/cubicweb/from-forge-server.html
135 +      - /builds/cubicweb/cubicweb/py3-from-forge-server-deprecated-warnings.json
136 +  script:
137 +    - tox -e py3-from-forge-server
138 +
139 +py3-from-forge-web:
140 +  only:
141 +    changes:
142 +      - cubicweb/**/*
143 +  stage: tests
144 +  image: r.intra.logilab.fr/jenkins/jnlp:buster
145 +  allow_failure: true
146 +  before_script:
147 +    - sudo apt update && sudo apt install -y firefox-esr
148 +  script:
149 +    - tox -e py3-from-forge-web
150 +  artifacts:
151 +    paths:
152 +      - /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 +  only:
157 +    changes:
158 +      - cubicweb/**/*
159 +  stage: tests
160 +  image: r.intra.logilab.fr/jenkins/jnlp:buster
161 +  allow_failure: true
162 +  before_script:
163 +    - sudo apt update && sudo apt install -y firefox-esr
164 +  script:
165 +    - tox -e py3-from-forge-misc
166 +  artifacts:
167 +    paths:
168 +      - /builds/cubicweb/cubicweb/from-forge-misc.html
169 +      - /builds/cubicweb/cubicweb/py3-from-forge-misc-deprecated-warnings.json
170 +
171 +trigger-readthedocs:
172 +  only:
173 +    refs:
174 +      - branch/default
175 +    changes:
176 +      - cubicweb/**/*
177 +      - doc/**/*
178 +  except:
179 +    variables:
180 +      - $TRIGGERED_FROM_OTHER_PROJECT
181 +  stage: after-tests
182 +  script:
183 +  # regarding the " everywhere when there is a '%': yaml is extremly weird when % are involved
184 +  - curl -X POST -d "token=${READTHEDOCS_TOKEN}" https://readthedocs.org/api/v2/webhook/cubicweb/33537/ -w "\nhttp code:"\ "%{http_code}\n" -f
185 +
186 +sonarqube:
187 +  stage: qa
188 +  image: sonarsource/sonar-scanner-cli
189 +  only:
190 +    - branch/default
191 +  except:
192 +    variables:
193 +      - $TRIGGERED_FROM_OTHER_PROJECT
194 +  script:
195 +    - apk add python3 mercurial
196 +    - sonar-scanner
197 +      --define sonar.scm.revision=${CI_COMMIT_REF_NAME##*/}
198 +      --define sonar.projectBaseDir=.
199 +      --define sonar.projectVersion=`python3 ./setup.py --version`
200 +      --define sonar.scm.provider=hg
201 +      --define sonar.projectKey=${CI_PROJECT_PATH_SLUG}
202 +      --define sonar.projectName=${CI_PROJECT_TITLE}
203 +      --define sonar.links.homepage=${CI_PROJECT_URL}
204 +      --define sonar.host.url=${SONAR_URL}
205 +
206 +pages:
207 +  stage: deploy
208 +  except:
209 +    variables:
210 +      - $TRIGGERED_FROM_OTHER_PROJECT
211 +  before_script:
212 +    - pip install tox
213 +  script:
214 +    # remove previous artifacts from build_doc if any (cf. #206). The .tox/doc
215 +    # directory does not « look as a virtualenv », and tox refuses to remove it.
216 +    # Let's do it manually.
217 +    - rm -rf .tox/doc/
218 +    - tox -e doc
219 +    - mv .tox/doc/tmp/html public
220 +  artifacts:
221 +    paths:
222 +      - public
223 +  only:
224 +    - branch/default
diff --git a/MANIFEST.in b/MANIFEST.in
@@ -81,6 +81,7 @@
225  recursive-include cubicweb/skeleton *.py *.css *.js *.po compat *.tmpl format options pytest control
226 
227  prune cubicweb/misc/cwfs
228 
229  prune debian
230 -prune cubicweb.spec
231 +exclude cubicweb.spec
232 +exclude .gitlab-ci.yml