Skip to content

Feature/add tree cluster pagination #379

Feature/add tree cluster pagination

Feature/add tree cluster pagination #379

name: "Test Postgres Migrations and Seed on PR"
on:
pull_request:
branches:
- develop
jobs:
test_migrations_and_seed:
runs-on: ubuntu-latest
services:
postgres:
image: postgis/postgis
env:
POSTGRES_DB: postgres
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v4
- name: Setup Dependencies
run: sudo apt-get update && sudo apt-get install -y curl
- name: Install Goose
run: |
curl -fsSL https://raw.githubusercontent.com/pressly/goose/master/install.sh | sh
- name: Test Migrations Up
run: |
goose -dir internal/storage/postgres/migrations postgres "postgres://postgres:postgres@localhost:5432/postgres" up
echo "Checking if all migrations are up"
goose -dir internal/storage/postgres/migrations postgres "postgres://postgres:postgres@localhost:5432/postgres" status
- name: Test Migrations Down
run: |
for i in $(ls -1 internal/storage/postgres/migrations/*.sql | sort -r); do
echo "Checking down $i"
goose -dir internal/storage/postgres/migrations postgres "postgres://postgres:postgres@localhost:5432/postgres" down
done
- name: Test Migrations Reset
run: |
goose -dir internal/storage/postgres/migrations postgres "postgres://postgres:postgres@localhost:5432/postgres" up
goose -dir internal/storage/postgres/migrations postgres "postgres://postgres:postgres@localhost:5432/postgres" reset
echo "Checking if all migrations are down"
goose -dir internal/storage/postgres/migrations postgres "postgres://postgres:postgres@localhost:5432/postgres" status
- name: Test Seed Up
run: |
goose -dir internal/storage/postgres/migrations postgres "postgres://postgres:postgres@localhost:5432/postgres" up
goose -dir internal/storage/postgres/seed -no-versioning postgres "postgres://postgres:postgres@localhost:5432/postgres" up
- name: Test Seed Down
run: |
goose -dir internal/storage/postgres/seed -no-versioning postgres "postgres://postgres:postgres@localhost:5432/postgres" down