Skip to content

Commit

Permalink
Try running complement builds?
Browse files Browse the repository at this point in the history
  • Loading branch information
clokep committed Oct 24, 2024
1 parent 7ff4584 commit 5353f8d
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 5 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,9 @@ jobs:
- arrangement: workers
database: Postgres

- arrangement: workers
database: Psycopg

steps:
- name: Run actions/checkout@v4 for synapse
uses: actions/checkout@v4
Expand All @@ -680,7 +683,7 @@ jobs:
COMPLEMENT_DIR=`pwd`/complement synapse/scripts-dev/complement.sh -p 1 -json 2>&1 | synapse/.ci/scripts/gotestfmt
shell: bash
env:
POSTGRES: ${{ (matrix.database == 'Postgres') && 1 || '' }}
POSTGRES: ${{ (matrix.database == 'Postgres' || matrix.database == 'Psycopg') && matrix.database || '' }}
WORKERS: ${{ (matrix.arrangement == 'workers') && 1 || '' }}
name: Run Complement Tests
Expand Down
12 changes: 12 additions & 0 deletions docker/complement/conf/start_for_complement.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,18 @@ export SYNAPSE_REPORT_STATS=no
case "$SYNAPSE_COMPLEMENT_DATABASE" in
postgres)
# Set postgres authentication details which will be placed in the homeserver config file
export POSTGRES_DRIVER=psycopg2
export POSTGRES_PASSWORD=somesecret
export POSTGRES_USER=postgres
export POSTGRES_HOST=localhost

# configure supervisord to start postgres
export START_POSTGRES=true
;;

psycopg)
# Set postgres authentication details which will be placed in the homeserver config file
export POSTGRES_DRIVER=psycopg
export POSTGRES_PASSWORD=somesecret
export POSTGRES_USER=postgres
export POSTGRES_HOST=localhost
Expand Down
4 changes: 2 additions & 2 deletions docker/conf/homeserver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ listeners:

{% if POSTGRES_PASSWORD %}
database:
name: "psycopg2"
name: "{{ POSTGRES_DRIVER or "psycopg2" }}"
args:
user: "{{ POSTGRES_USER or "synapse" }}"
password: "{{ POSTGRES_PASSWORD }}"
database: "{{ POSTGRES_DB or "synapse" }}"
dbname: "{{ POSTGRES_DB or "synapse" }}"
{% if not SYNAPSE_USE_UNIX_SOCKET %}
{# Synapse will use a default unix socket for Postgres when host/port is not specified (behavior from `psycopg2`). #}
host: "{{ POSTGRES_HOST or "db" }}"
Expand Down
10 changes: 8 additions & 2 deletions scripts-dev/complement.sh
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,11 @@ if [[ -n "$WORKERS" ]]; then
export PASS_SYNAPSE_WORKER_TYPES="$WORKER_TYPES"

# Workers can only use Postgres as a database.
export PASS_SYNAPSE_COMPLEMENT_DATABASE=postgres
if [[ "$POSTGRES" = "psycopg" ]]; then
export PASS_SYNAPSE_COMPLEMENT_DATABASE=psycopg
else
export PASS_SYNAPSE_COMPLEMENT_DATABASE=postgres
fi

# And provide some more configuration to complement.

Expand All @@ -256,7 +260,9 @@ if [[ -n "$WORKERS" ]]; then
export COMPLEMENT_SPAWN_HS_TIMEOUT_SECS=120
else
export PASS_SYNAPSE_COMPLEMENT_USE_WORKERS=
if [[ -n "$POSTGRES" ]]; then
if [[ "$POSTGRES" = "psycopg" ]]; then
export PASS_SYNAPSE_COMPLEMENT_DATABASE=psycopg
elif [[ -n "$POSTGRES" ]]; then
export PASS_SYNAPSE_COMPLEMENT_DATABASE=postgres
else
export PASS_SYNAPSE_COMPLEMENT_DATABASE=sqlite
Expand Down

0 comments on commit 5353f8d

Please sign in to comment.