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 b0077f3
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion .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 All @@ -40,7 +45,7 @@ jobs:
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -qq libudev-dev libxss-dev libxres-dev gcc pkg-config libwayland-dev libx11-dev libx11-xcb-dev libxkbcommon-x11-dev libgles2-mesa-dev libegl1-mesa-dev libffi-dev libxcursor-dev libvulkan-dev xdotool x11-utils xdotool i3-wm
sudo apt-get install -qq libudev-dev libxss-dev libxres-dev gcc pkg-config libwayland-dev libx11-dev libx11-xcb-dev libxkbcommon-x11-dev libgles2-mesa-dev libegl1-mesa-dev libffi-dev libxcursor-dev libvulkan-dev xdotool x11-utils xdotool i3-wm postgresql
echo "DISPLAY=${DISPLAY}"
# Start a virtual frame buffer and wait a bit for it to be ready...
Xvfb :99 -screen 0 1920x1024x24 &
Expand All @@ -56,8 +61,22 @@ jobs:
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'
run: |
sudo -u postgres psql --host $PGHOST \
--username="postgres" \
--dbname="postgres" \
--command="CREATE USER $PGUSER PASSWORD $PGPASSWORD" \
--command="ALTER USER $PGUSER CREATEDB" \
--command="CREATE USER ${PGUSER}_ro PASSWORD $PGPASSWORD" \
--command="\du"
go test ./cmd/worklog/pgstore
- name: integration tests
uses: nick-fields/retry@v3
with:
Expand Down

0 comments on commit b0077f3

Please sign in to comment.