]> git.ipfire.org Git - thirdparty/pdns.git/blame - .circleci/config.yml
Split auth tests to workflows, add ccache cache, use shallow clones
[thirdparty/pdns.git] / .circleci / config.yml
CommitLineData
fbd89850
PD
1version: 2.1
2
3commands:
85277158
PL
4 checkout-shallow:
5 description: "Do a shallow checkout of the repository"
6 steps:
7 - run:
8 name: Install git and openssh
9 command: apt-get update && apt-get -qq -y install openssh-client git
10 - run:
11 name: Store the keyid for the git repo
12 command: mkdir -p $HOME/.ssh && ssh-keyscan $(echo ${CIRCLE_REPOSITORY_URL} | sed 's,.*@\([^:]*\):.*,\1,') > $HOME/.ssh/known_hosts
13 - run:
14 name: Clone the repo
15 command: git clone --depth 1 --branch $CIRCLE_BRANCH $CIRCLE_REPOSITORY_URL ~/project
16
fbd89850
PD
17 auth-regress:
18 description: "run one auth regression context"
19 parameters:
20 skip:
21 type: string
22 default: ""
23 context:
24 type: string
25 default: ""
85277158
PL
26 prefix:
27 type: string
28 default: "/opt/pdns-auth/"
fbd89850 29 steps:
85277158
PL
30 - run:
31 name: Get jdnssectools
32 command: |
33 if [ ! -e /usr/bin/jdnssec-verifyzone ]; then
34 apt-get install -qq -y wget
35 wget https://github.com/dblacka/jdnssec-tools/releases/download/0.14/jdnssec-tools-0.14.tar.gz
36 tar xfz jdnssec-tools-0.14.tar.gz --strip-components=1 -C /
37 rm jdnssec-tools-0.14.tar.gz
38 fi
39 - run:
40 name: Install test dependencies
41 command: |
42 apt-get -y -qq install \
43 bc \
44 bind9utils \
45 default-jre-headless \
46 dnsutils \
47 ldnsutils \
48 unbound-host
49 - run:
50 workdir: ~/project/regression-tests
51 name: Run << parameters.context >> tests
52 command: |
53 [ -e ./vars ] && . ./vars
54 rm -rf tests/*/skip
55 for t in << parameters.skip >>
56 do
57 touch tests/$t/skip
58 done
59 PDNS=<< parameters.prefix >>sbin/pdns_server \
60 PDNS2=<< parameters.prefix >>sbin/pdns_server \
61 SDIG=<< parameters.prefix >>bin/sdig \
62 NOTIFY=<< parameters.prefix >>bin/pdns_notify \
63 NSEC3DIG=<< parameters.prefix >>bin/nsec3dig \
64 SAXFR=<< parameters.prefix >>bin/saxfr \
65 ZONE2SQL=<< parameters.prefix >>bin/zone2sql \
66 ZONE2LDAP=<< parameters.prefix >>bin/zone2ldap \
67 PDNSUTIL=<< parameters.prefix >>bin/pdnsutil \
68 PDNSCONTROL=<< parameters.prefix >>bin/pdns_control \
69 ./start-test-stop 5300 << parameters.context >>
fbd89850 70
36d385ad
PL
71 install-recursor-deps:
72 description: "Install all libraries needed for the recursor"
73 steps:
74 - run: apt-get update
75 - run:
76 command: |
77 apt-get install -qq -y \
78 libluajit-5.1 \
79 libboost-all-dev \
80 libcap2 \
81 libssl1.1 \
82 libsystemd0 \
83 libsodium18 \
84 libprotobuf10
85
85277158
PL
86 install-auth-deps:
87 description: Install all libraries needed to run the auth
88 steps:
89 - run: |
90 apt-get install -qq -y --no-install-recommends \
91 libboost-all-dev \
92 libssl1.1 \
93 libsystemd0 \
94 default-libmysqlclient-dev \
95 unixodbc
96
97 install-auth-dev-deps:
98 description: Install all packages needed to build the auth
99 steps:
100 - run: apt-get update
101 - run:
102 command: |
103 apt-get install -qq -y --no-install-recommends \
104 autoconf \
105 automake \
106 bison \
107 default-libmysqlclient-dev \
108 flex \
109 g++ \
110 git \
111 libboost-all-dev \
112 libssl-dev \
113 libtool \
114 make \
115 pkg-config \
116 ragel \
117 sqlite3 \
118 unixodbc-dev \
119 virtualenv \
120 wget
121
36d385ad
PL
122 add-auth-repo:
123 description: "Add the debian repo for the auth"
124 parameters:
125 version:
126 type: string
127 default: "42"
128 distro:
129 type: string
130 default: "debian"
131 release:
132 type: string
133 default: "stretch"
134 steps:
135 - run:
136 name: "Install dependencies"
137 command: "apt-get update && apt-get install -qq -y curl gnupg2"
138 - run:
139 name: "Install apt-keys"
140 command: |
141 if [ "<< parameters.version >>" = "master" ]; then
142 curl https://repo.powerdns.com/CBC8B383-pub.asc | apt-key add -
143 else
144 curl https://repo.powerdns.com/FD380FBB-pub.asc | apt-key add -
145 fi
146 - run:
147 name: "Add repository"
148 command: |
149 echo 'deb [arch=amd64] http://repo.powerdns.com/<< parameters.distro >> << parameters.release >>-auth-<< parameters.version>> main' >> /etc/apt/sources.list.d/pdns.list
150 - run:
151 name: "add pinning"
152 command: |
153 echo 'Package: pdns-*' > /etc/apt/preferences.d/pdns
154 echo 'Pin: origin repo.powerdns.com' >> /etc/apt/preferences.d/pdns
155 echo 'Pin-Priority: 600' >> /etc/apt/preferences.d/pdns
156 - run:
157 name: update apt cache
158 command: apt-get update
159
85277158
PL
160 setup-ccache:
161 description: Install .ccache and set $PATH
162 steps:
163 - run:
164 name: Install ccache
165 command: apt-get update && apt-get -qq -y install ccache
166 - run:
167 name: Setup ccache in $PATH
168 command: echo 'export PATH=/usr/lib/ccache:$PATH' >> $BASH_ENV
169
12538b7a
PL
170 save-ccache-cache:
171 description: Store the .ccache directory
172 parameters:
173 product:
174 type: string
175 default: ""
176 steps:
177 - save_cache:
178 key: ccache-cache-{{ arch }}-<< parameters.product >>-{{ .Branch }}
179 paths:
180 - ~/.ccache
181
182 restore-cache-ccache:
183 description: Restore the .ccache directory
184 parameters:
185 product:
186 type: string
187 default: ""
188 steps:
85277158 189 - setup-ccache
12538b7a
PL
190 - run:
191 name: ensure ca-certificates is installed
192 command: apt-get update && apt-get -qq -y install ca-certificates
193 - restore_cache:
194 keys:
195 - ccache-cache-{{ arch }}-<< parameters.product >>-{{ .Branch }}
85277158 196 - ccache-cache-{{ arch }}-<< parameters.product >>-
12538b7a 197
fbd89850 198jobs:
1d8e4b3c 199 build-auth:
fbd89850
PD
200 docker:
201 - image: debian:stretch
fbd89850
PD
202
203 steps:
85277158
PL
204 - checkout-shallow
205 - install-auth-dev-deps
206 - restore-cache-ccache:
207 product: auth
fbd89850
PD
208 - run:
209 name: autoconf
85277158 210 command: BUILDER_VERSION=0.0.0-git1 autoreconf -vfi
fbd89850
PD
211 - run:
212 name: configure
85277158
PL
213 command: |
214 CFLAGS="-O1 -Werror=vla" \
215 CXXFLAGS="-O1 -Werror=vla" \
216 ./configure \
217 --disable-lua-records \
218 --with-modules='bind gmysql godbc random' \
219 --enable-tools \
220 --prefix=/opt/pdns-auth
fbd89850
PD
221 - run:
222 name: build
223 command: make -j3 -k
85277158
PL
224 - save-ccache-cache:
225 product: auth
226 - run:
227 name: Install the binaries
228 command: make install
229 - persist_to_workspace:
230 root: /opt
231 paths:
232 - pdns-auth
fbd89850 233
85277158
PL
234 test-auth-regress-odbc-sqlite3:
235 docker:
236 - image: debian:stretch
237 steps:
238 - run:
239 name: ensure ca-certificates is installed
240 command: apt-get update && apt-get -qq -y install ca-certificates
241 - attach_workspace:
242 at: /opt
243 - run:
244 name: Configure ODBC for sqlite
245 command: |
246 cat >> ~/.odbc.ini \<<- __EOF__
247 [pdns-sqlite3-1]
248 Driver = SQLite3
249 Database = ${PWD}/regression-tests/pdns.sqlite3
250 [pdns-sqlite3-2]
251 Driver = SQLite3
252 Database = ${PWD}/regression-tests/pdns.sqlite32
253 __EOF__
254 - install-auth-deps
fbd89850 255 - run:
85277158
PL
256 name: Install ODBC deps
257 command: |
258 apt-get install -qq -y \
259 unixodbc \
260 libsqliteodbc \
261 sqlite3
262 - run:
263 name: Install test dependencies
264 command: |
265 apt-get -y -qq install \
266 bc \
267 bind9utils \
268 default-jre-headless \
269 dnsutils \
270 ldnsutils \
271 unbound-host
272 - checkout-shallow
273 - run:
274 name: Allow missing tools in verify-dnssec-zone
275 command: touch regression-tests/tests/verify-dnssec-zone/allow-missing
276 - run:
277 name: Run the ODBC sqlite tests
278 command: |
279 PDNS=/opt/pdns-auth/sbin/pdns_server \
280 PDNS2=/opt/pdns-auth/sbin/pdns_server \
281 SDIG=/opt/pdns-auth/bin/sdig \
282 NOTIFY=/opt/pdns-auth/bin/pdns_notify \
283 NSEC3DIG=/opt/pdns-auth/bin/nsec3dig \
284 SAXFR=/opt/pdns-auth/bin/saxfr \
285 ZONE2SQL=/opt/pdns-auth/bin/zone2sql \
286 ZONE2LDAP=/opt/pdns-auth/bin/zone2ldap \
287 PDNSUTIL=/opt/pdns-auth/bin/pdnsutil \
288 PDNSCONTROL=/opt/pdns-auth/bin/pdns_control \
289 GODBC_SQLITE3_DSN=pdns-sqlite3-1 ./start-test-stop 5300 godbc_sqlite3-nsec3
290 workdir: ~/project/regression-tests
fbd89850 291
85277158
PL
292 test-auth-regress-odbc-mssql:
293 docker:
294 - image: debian:stretch
295 - image: mcr.microsoft.com/mssql/server:2019-CTP2.2-ubuntu
296 environment:
297 - ACCEPT_EULA: Y
298 - SA_PASSWORD: 'SAsa12%%'
299 steps:
300 - run:
301 name: ensure ca-certificates is installed
302 command: apt-get update && apt-get -qq -y install ca-certificates
303 - attach_workspace:
304 at: /opt
305 - install-auth-deps
306 - run:
307 name: Install ODBC deps
308 command: |
309 apt-get install -qq -y \
310 freetds-bin \
311 tdsodbc \
312 unixodbc
fbd89850
PD
313 - run:
314 name: set up mssql odbc
85277158
PL
315 command: |
316 cat >> ~/.odbc.ini \<<- __EOF__
317 [pdns-mssql-docker]
318 Driver=FreeTDS
319 Trace=No
320 Server=127.0.0.1
321 Port=1433
322 Database=pdns
323 TDS_Version=7.1
324 [pdns-mssql-docker-nodb]
325 Driver=FreeTDS
326 Trace=No
327 Server=127.0.0.1
328 Port=1433
329 TDS_Version=7.1
330 __EOF__
331 - run:
332 command: cat /usr/share/tdsodbc/odbcinst.ini >> /etc/odbcinst.ini
333 - run:
334 name: create database
335 command: echo 'create database pdns' | isql -v pdns-mssql-docker-nodb sa SAsa12%%
336 - checkout-shallow
337 - run:
338 name: Allow missing tools in verify-dnssec-zone
339 command: touch regression-tests/tests/verify-dnssec-zone/allow-missing
fbd89850
PD
340 - run:
341 name: set up mssql odbc testing
85277158
PL
342 command: echo 'export GODBC_MSSQL_PASSWORD=SAsa12%% GODBC_MSSQL_USERNAME=sa GODBC_MSSQL_DSN=pdns-mssql-docker' > ./vars
343 workdir: ~/project/regression-tests
fbd89850
PD
344 - auth-regress:
345 context: godbc_mssql-nodnssec
346 skip: 8bit-txt-unescaped
347 - auth-regress:
348 context: godbc_mssql
349 skip: 8bit-txt-unescaped
350 - auth-regress:
351 context: godbc_mssql-nsec3
352 skip: 8bit-txt-unescaped
353 - auth-regress:
354 context: godbc_mssql-nsec3-optout
355 skip: 8bit-txt-unescaped verify-dnssec-zone
356 - auth-regress:
357 context: godbc_mssql-nsec3-narrow
358 skip: 8bit-txt-unescaped
1d8e4b3c 359
7fff14ef
PL
360 build-recursor:
361 docker:
362 - image: debian:stretch
363 steps:
12538b7a
PL
364 - restore-cache-ccache:
365 product: recursor
7fff14ef
PL
366 - run:
367 name: Install dependencies
368 command: |
369 apt-get update && apt-get -qq --no-install-recommends install \
370 autoconf \
371 automake \
372 ca-certificates \
373 curl \
374 bison \
375 flex \
376 g++ \
377 git \
378 libboost-all-dev \
379 libcap-dev \
380 libluajit-5.1-dev \
381 libprotobuf-dev \
382 libsodium-dev \
383 libssl-dev \
384 libsystemd-dev \
385 libtool \
386 make \
387 pkg-config \
388 protobuf-compiler \
389 ragel \
390 virtualenv
85277158 391 - checkout-shallow
7fff14ef
PL
392 - run:
393 name: autoconf
85277158 394 command: BUILDER_VERSION=0.0.0-git1 autoreconf -vfi
7fff14ef
PL
395 working_directory: ~/project/pdns/recursordist
396 - run:
397 name: configure
398 command: |
399 CFLAGS="-O1 -Werror=vla" \
400 CXXFLAGS="-O1 -Werror=vla" \
401 ./configure \
402 --enable-unit-tests \
403 --prefix=/opt/pdns-recursor \
404 --with-libsodium \
405 --with-lua=luajit \
406 --with-libcap \
407 --with-protobuf=yes \
408 --without-net-snmp
409 working_directory: ~/project/pdns/recursordist
410 - run:
411 name: build
85277158 412 command: make -j3 -k
7fff14ef 413 working_directory: ~/project/pdns/recursordist
12538b7a
PL
414 - save-ccache-cache:
415 product: recursor
7fff14ef 416 - run:
36d385ad
PL
417 name: Run unit tests
418 command: make check || (cat test-suite.log; false)
419 working_directory: ~/project/pdns/recursordist
420 - run:
421 name: Install resulting binaries
422 command: make install
7fff14ef 423 working_directory: ~/project/pdns/recursordist
36d385ad
PL
424 - persist_to_workspace:
425 root: /opt
426 paths:
427 - pdns-recursor
428
429 test-recursor-regression:
430 docker:
431 - image: debian:stretch
432 steps:
433 - add-auth-repo
434 - run: apt-get --no-install-recommends install -qq -y pdns-server pdns-backend-bind pdns-tools daemontools authbind jq libfaketime lua-posix moreutils bc virtualenv protobuf-compiler
435 - install-recursor-deps
436 - run:
437 name: Set up authbind
438 command: |
439 touch /etc/authbind/byport/53
440 chmod 755 /etc/authbind/byport/53
85277158 441 - checkout-shallow
36d385ad
PL
442 - attach_workspace:
443 at: /opt
444 - run:
445 name: Run regression tests
446 workdir: ~/project
447 command: |
448 PDNSRECURSOR=/opt/pdns-recursor/sbin/pdns_recursor \
449 RECCONTROL=/opt/pdns-recursor/bin/rec_control \
450 ./build-scripts/test-recursor
451
452 test-recursor-bulk:
453 docker:
454 - image: debian:stretch
455 steps:
456 - add-auth-repo
457 - run: apt-get --no-install-recommends install -qq -y pdns-tools moreutils time
458 - install-recursor-deps
85277158 459 - checkout-shallow
36d385ad
PL
460 - attach_workspace:
461 at: /opt
462 - run:
463 name: Get the majestic million list
464 workdir: ~/project/regression-tests
465 command: |
466 apt-get install -qq -y unzip && \
467 curl -LO http://s3-us-west-1.amazonaws.com/umbrella-static/top-1m.csv.zip && \
468 unzip top-1m.csv.zip -d .
469 - run:
470 name: Run bulktests
471 command: |
472 DNSBULKTEST=/usr/bin/dnsbulktest \
473 RECURSOR=/opt/pdns-recursor/sbin/pdns_recursor \
474 THRESHOLD=95 \
475 TRACE=no \
476 ./timestamp ./recursor-test 5300 50000 || \
477 (cat recursor.log; false)
478 workdir: ~/project/regression-tests
7fff14ef 479
4befa62e
PL
480 test-recursor-api:
481 docker:
482 - image: debian:stretch
483 steps:
484 - add-auth-repo
485 - run: apt-get --no-install-recommends install -qq -y virtualenv pdns-tools
486 - install-recursor-deps
85277158 487 - checkout-shallow
4befa62e
PL
488 - attach_workspace:
489 at: /opt
490 - run:
491 name: Run API tests
492 workdir: ~/project/regression-tests.api
493 command: |
494 PDNSRECURSOR="/opt/pdns-recursor/sbin/pdns_recursor" \
495 ./runtests recursor
496
1d8e4b3c
PL
497workflows:
498 version: 2
7fff14ef 499 build-and-test-all:
1d8e4b3c
PL
500 jobs:
501 - build-auth
85277158
PL
502 - test-auth-regress-odbc-sqlite3:
503 requires:
504 - build-auth
505 - test-auth-regress-odbc-mssql:
506 requires:
507 - build-auth
36d385ad 508
7fff14ef 509 - build-recursor
36d385ad
PL
510 - test-recursor-regression:
511 requires:
512 - build-recursor
513 - test-recursor-bulk:
514 requires:
515 - build-recursor
4befa62e
PL
516 - test-recursor-api:
517 requires:
518 - build-recursor