Skip to content

Commit

Permalink
ci: add postgres support
Browse files Browse the repository at this point in the history
  • Loading branch information
kortschak committed Sep 21, 2024
1 parent ca8251e commit c290318
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ jobs:
DISPLAY: ':99.0'
XDG_SESSION_TYPE: 'x11'
EGL_PLATFORM: 'x11'
PGHOST: localhost
PGPORT: 5432
PGDATABASE: test_database
PGUSER: test_user
PGPASSWORD: password

steps:
- name: install Go
Expand Down Expand Up @@ -49,15 +54,46 @@ jobs:
i3 &
sleep 1
# add PostgreSQL binaries to PATH
echo "$(pg_config --bindir)" >> $GITHUB_PATH
export PGHOST="${RUNNER_TEMP}/postgres"
export PGDATA="$PGHOST/pgdata"
mkdir -p "$PGDATA"
echo PGHOST: $PGHOST
echo PGDATA: $PGDATA
echo GITHUB_PATH: $GITHUB_PATH
ls -l $GITHUB_PATH
psql --version
export PWFILE="${RUNNER_TEMP}/pwfile"
echo "postgres" > "$PWFILE"
initdb --pgdata="$PGDATA" --username="postgres" --pwfile="$PWFILE"
echo "unix_socket_directories = '$PGHOST'" >> "$PGDATA/postgresql.conf"
pg_ctl start
psql --host "$PGHOST" --username="postgres" --dbname="postgres" --command="CREATE USER $PGUSER PASSWORD '$PGPASSWORD'" --command="\du"
createdb --owner="$PGUSER" --username="postgres" "$PGDATABASE"
- name: unit tests
uses: nick-fields/retry@v3
with:
timeout_minutes: 10
max_attempts: 3
command: |
go test ./rpc ./internal/... ./cmd/*/api ./cmd/worklog/store
go test ./cmd/worklog/pgstore
go test -run 'Test(Amendments|Continuation|DashboardData)$' ./cmd/worklog
- name: unit tests postgres
if: matrix.platform == 'ubuntu-latest'
uses: nick-fields/retry@v3
with:
timeout_minutes: 10
max_attempts: 3
command: |
go test ./cmd/worklog/pgstore
- name: integration tests
uses: nick-fields/retry@v3
with:
Expand Down

0 comments on commit c290318

Please sign in to comment.