From 93b234e2f2be0e6efae0a7178e0f8c2bbe0fc8d5 Mon Sep 17 00:00:00 2001 From: Daniel Schadt Date: Sun, 8 Jun 2025 01:41:41 +0200 Subject: run postgres tests in CI --- ci/run_tests.sh | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100755 ci/run_tests.sh (limited to 'ci/run_tests.sh') diff --git a/ci/run_tests.sh b/ci/run_tests.sh new file mode 100755 index 0000000..f2e289a --- /dev/null +++ b/ci/run_tests.sh @@ -0,0 +1,49 @@ +#!/bin/bash +set -euxo pipefail + +DB=$1 + +PPATH="/usr/lib/postgresql/13/bin/" + +setup_postgres() { + apt update + apt install -y postgresql postgresql-client sudo + echo -n "postgres" >/tmp/pw + mkdir /tmp/postgres-db + chown postgres:postgres /tmp/postgres-db + sudo -u postgres "$PPATH/initdb" --pwfile /tmp/pw -U postgres /tmp/postgres-db + sudo -u postgres "$PPATH/postgres" -D /tmp/postgres-db >/dev/null 2>&1 & +} + +setup_redis() { + apt install -y redis-server + redis-server >/dev/null 2>&1 & +} + +setup_playwright() { + pip install poetry + pip install "playwright=="$(poetry show playwright | grep version | cut -f 2 -d ":" | tr -d " ") + playwright install firefox + playwright install-deps +} + +case "$DB" in + "sqlite") + ;; + + "postgres") + setup_postgres + sed -i 's/^sqlalchemy.url = .*$/sqlalchemy.url = "postgresql://postgres:postgres@localhost/postgres"/' testing.ini + ;; + + *) + echo "Unknown database: $DB" + exit 1 + ;; +esac + +exit + +setup_playwright +setup_redis +tox -e python -- --browser firefox -- cgit v1.2.3 From f95e1394883eb0e1c763b97e403df7c25a08501e Mon Sep 17 00:00:00 2001 From: Daniel Schadt Date: Sun, 8 Jun 2025 01:44:34 +0200 Subject: oops, ci broken --- ci/run_tests.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'ci/run_tests.sh') diff --git a/ci/run_tests.sh b/ci/run_tests.sh index f2e289a..1ba2836 100755 --- a/ci/run_tests.sh +++ b/ci/run_tests.sh @@ -33,7 +33,7 @@ case "$DB" in "postgres") setup_postgres - sed -i 's/^sqlalchemy.url = .*$/sqlalchemy.url = "postgresql://postgres:postgres@localhost/postgres"/' testing.ini + sed -i 's|^sqlalchemy.url = .*$|sqlalchemy.url = postgresql://postgres:postgres@localhost/postgres"|' testing.ini ;; *) @@ -42,8 +42,6 @@ case "$DB" in ;; esac -exit - setup_playwright setup_redis tox -e python -- --browser firefox -- cgit v1.2.3 From 0e0b63f08e6c5c52df5d12817f78333cca105154 Mon Sep 17 00:00:00 2001 From: Daniel Schadt Date: Sun, 8 Jun 2025 10:45:29 +0200 Subject: fix postgres connection URL in tests --- ci/run_tests.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'ci/run_tests.sh') diff --git a/ci/run_tests.sh b/ci/run_tests.sh index 1ba2836..adf69b7 100755 --- a/ci/run_tests.sh +++ b/ci/run_tests.sh @@ -33,7 +33,7 @@ case "$DB" in "postgres") setup_postgres - sed -i 's|^sqlalchemy.url = .*$|sqlalchemy.url = postgresql://postgres:postgres@localhost/postgres"|' testing.ini + sed -i 's|^sqlalchemy.url = .*$|sqlalchemy.url = postgresql://postgres:postgres@localhost/postgres|' testing.ini ;; *) @@ -42,6 +42,7 @@ case "$DB" in ;; esac +pip install tox setup_playwright setup_redis tox -e python -- --browser firefox -- cgit v1.2.3 From 1843560ee69655de615912c4eac5ec8dce921830 Mon Sep 17 00:00:00 2001 From: Daniel Schadt Date: Sun, 8 Jun 2025 10:58:16 +0200 Subject: update CI image to bookworm --- ci/run_tests.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ci/run_tests.sh') diff --git a/ci/run_tests.sh b/ci/run_tests.sh index adf69b7..200f794 100755 --- a/ci/run_tests.sh +++ b/ci/run_tests.sh @@ -3,7 +3,7 @@ set -euxo pipefail DB=$1 -PPATH="/usr/lib/postgresql/13/bin/" +PPATH="/usr/lib/postgresql/15/bin/" setup_postgres() { apt update -- cgit v1.2.3