Skip to content

Commit cb877e2

Browse files
committed
Add postgresql ci job
1 parent 090352f commit cb877e2

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

.drone.jsonnet

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@ local debian_pipeline(name,
2727
image,
2828
arch='amd64',
2929
deps=default_deps,
30+
before_pytest=[],
31+
pytest_opts='',
3032
extra_cmds=[],
33+
services=[],
3134
allow_fail=false) = {
3235
kind: 'pipeline',
3336
type: 'docker',
@@ -51,11 +54,13 @@ local debian_pipeline(name,
5154
'eatmydata ' + apt_get_quiet + ' update',
5255
'eatmydata ' + apt_get_quiet + ' dist-upgrade -y',
5356
'eatmydata ' + apt_get_quiet + ' install --no-install-recommends -y ' + std.join(' ', deps),
54-
'PYTHONPATH=. python3 -mpytest -vv --color=yes --sql-tracing',
57+
] + before_pytest + [
58+
'PYTHONPATH=. python3 -mpytest -vv --color=yes --sql-tracing ' + pytest_opts,
5559
]
5660
+ extra_cmds,
5761
},
5862
],
63+
services: services,
5964
};
6065

6166
[
@@ -92,6 +97,19 @@ local debian_pipeline(name,
9297
debian_pipeline('Ubuntu latest (amd64)', docker_base + 'ubuntu-rolling'),
9398
debian_pipeline('Ubuntu LTS (amd64)', docker_base + 'ubuntu-lts'),
9499

100+
debian_pipeline(
101+
'PostgreSQL/bullseye',
102+
docker_base + 'debian-bullseye',
103+
deps=default_deps + ['python3-psycopg2', 'postgresql-client'],
104+
services=[
105+
{ name: 'pg', image: 'postgres:bullseye', environment: { POSTGRES_USER: 'ci', POSTGRES_PASSWORD: 'ci' } },
106+
],
107+
before_pytest=[
108+
'for i in $(seq 0 30); do if pg_isready -d ci -h pg -U ci -t 1; then break; fi; if [ "$i" = 30 ]; then echo "Timeout waiting for postgresql" >&2; exit 1; fi; sleep 1; done',
109+
],
110+
pytest_opts='--pgsql "postgresql://ci:ci@pg/ci"'
111+
),
112+
95113
// ARM builds (ARM64 and armhf)
96114
debian_pipeline('Debian sid (ARM64)', docker_base + 'debian-sid', arch='arm64'),
97115
debian_pipeline('Debian stable (armhf)', docker_base + 'debian-stable/arm32v7', arch='arm64'),

0 commit comments

Comments
 (0)