Skip to content

Commit

Permalink
We need postgres running in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
omad committed Dec 2, 2024
1 parent 7b1d1d5 commit 01a5bf4
Showing 1 changed file with 51 additions and 3 deletions.
54 changes: 51 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,24 @@ jobs:
main:
runs-on: ubuntu-latest
needs: ['lint']

services:
# Label used to access the service container
postgres:
# Docker Hub image
image: postgis/postgis:16-3.5
# Provide the password for postgres
env:
POSTGRES_PASSWORD: postgres
# POSTGRES_DB: pgintegration
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Maps tcp port 5432 on service container to the host
- 5432:5432
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -75,7 +92,36 @@ jobs:
echo "push_pypi=yes" >> $GITHUB_OUTPUT
fi
- name: Verify and Run Tests
- name: Setup test Database
run: |
echo "localhost:5432:*:postgres:postgres" > ~/.pgpass
createdb -h localhost -U postgres pgintegration
createdb -h localhost -U postgres pgisintegration
- name: Setup test environment
run: |
uv sync --all-extras
source .venv/bin/activate
uv pip install -e ./tests/drivers/fail_drivers --no-deps
uv pip install -e ./examples/io_plugin --no-deps
- name: Run Unit and Doc Tests
run: |
echo "Run tests"
uv sync --all-extras
source .venv/bin/activate
uv pip install -e ./tests/drivers/fail_drivers --no-deps
uv pip install -e ./examples/io_plugin --no-deps
pytest -r a \
--cov datacube \
--cov-report=xml \
--doctest-ignore-import-errors \
--durations=5 \
datacube \
tests
- name: Run Integration Tests
run: |
echo "Run tests"
uv sync --all-extras
Expand All @@ -90,7 +136,9 @@ jobs:
datacube \
tests \
integration_tests
env:
PGHOST: localhost
PGUSER: postgres

- name: Build Packages
run: |
Expand Down

0 comments on commit 01a5bf4

Please sign in to comment.