Skip to content

Commit

Permalink
Update CI postgres setup (#13123)
Browse files Browse the repository at this point in the history
* Remove deprecated version field

* Add pg_dump wrapper for db tests
  • Loading branch information
HenryNguyen5 committed May 7, 2024
1 parent 9141b52 commit ed1f945
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
23 changes: 23 additions & 0 deletions .github/actions/setup-postgres/bin/pg_dump
@@ -0,0 +1,23 @@
#!/usr/bin/env bash
#
# This script acts as a docker replacement around pg_dump so that developers can
# run DB involved tests locally without having postgres installed.
#
# Installation:
# - Make sure that your PATH doesn't already contain a postgres installation
# - Add this script to your PATH
#
# Usage:
# You should be able to setup your test db via:
# - go build -o chainlink.test . # Build the chainlink binary to run test db prep commands from
# - export CL_DATABASE_URL="postgresql://postgres:postgres@localhost:5432/chainlink_test?sslmode=disable"
# - pushd .github/actions/setup-postgres/ # Navigate to the setup-postgres action so we can spin up a docker postgres
# instance
# - docker compose up # Spin up postgres
# - ./chainlink.test local db preparetest # Run the db migration, which will shell out to our pg_dump wrapper too.
# - popd
# - go test -timeout 30s ./core/services/workflows/... -v # Run tests that use the database

cd "$(dirname "$0")" || exit

docker compose exec -T postgres pg_dump "$@"
1 change: 0 additions & 1 deletion .github/actions/setup-postgres/docker-compose.yml
@@ -1,5 +1,4 @@
name: gha_postgres
version: "3.8"
services:
postgres:
ports:
Expand Down

0 comments on commit ed1f945

Please sign in to comment.