fix(ci): fix postgres TCP setup and truncateAll superuser error
- Use apt-get install + configure listen_addresses + md5 auth in pg_hba so psql can connect via 127.0.0.1 (not just Unix socket) - Use pg_ctlcluster restart after config changes + wait for pg_isready - Replace session_replication_role (requires superuser) with a single TRUNCATE ... CASCADE which handles FK deps without elevated privileges - All 3 integration tests now pass in CI (act + Gitea Actions) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit was merged in pull request #136.
This commit is contained in:
+10
-11
@@ -44,26 +44,25 @@ jobs:
|
||||
run: |
|
||||
sudo apt-get update -qq && sudo apt-get install -y -qq postgresql > /dev/null
|
||||
PG_VER=$(ls /etc/postgresql/)
|
||||
sudo pg_ctlcluster $PG_VER main start
|
||||
sudo sed -i "s/^#*listen_addresses\s*=.*/listen_addresses = '127.0.0.1'/" /etc/postgresql/$PG_VER/main/postgresql.conf
|
||||
echo "host all all 127.0.0.1/32 md5" | sudo tee -a /etc/postgresql/$PG_VER/main/pg_hba.conf
|
||||
sudo pg_ctlcluster $PG_VER main restart
|
||||
until sudo -u postgres pg_isready -h 127.0.0.1; do sleep 1; done
|
||||
sudo -u postgres psql -c "CREATE USER test WITH PASSWORD 'test';"
|
||||
sudo -u postgres psql -c "CREATE DATABASE polympr_test OWNER test;"
|
||||
sudo -u postgres psql -d polympr_test -c "GRANT ALL ON SCHEMA public TO test;"
|
||||
|
||||
- name: Apply migrations
|
||||
run: |
|
||||
sed 's/--> statement-breakpoint/;/g' databases/migrations/0000_square_jetstream.sql | \
|
||||
PGPASSWORD=test psql -h 127.0.0.1 -U test -d polympr_test
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm install --ignore-scripts && deno install
|
||||
|
||||
- name: Apply migrations
|
||||
env:
|
||||
POSTGRES_HOST: localhost
|
||||
POSTGRES_PORT: 5432
|
||||
POSTGRES_USER: test
|
||||
POSTGRES_PASS: test
|
||||
POSTGRES_DB: polympr_test
|
||||
run: node_modules/.bin/drizzle-kit migrate
|
||||
|
||||
- name: Run integration tests
|
||||
env:
|
||||
POSTGRES_HOST: localhost
|
||||
POSTGRES_HOST: 127.0.0.1
|
||||
POSTGRES_PORT: 5432
|
||||
POSTGRES_USER: test
|
||||
POSTGRES_PASS: test
|
||||
|
||||
Reference in New Issue
Block a user