-
Notifications
You must be signed in to change notification settings - Fork 4
71 lines (61 loc) · 2.13 KB
/
postgres_testing.yml
File metadata and controls
71 lines (61 loc) · 2.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
name: Run Postgres Tests
on:
workflow_call:
inputs:
python-versions:
description: "JSON string of Python versions"
type: string
required: true
secrets:
POSTGRES_USER:
required: true
POSTGRES_PASSWORD:
required: true
jobs:
postgres-test:
name: Postgres Tests (Python ${{ matrix.python-version }})
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ${{ fromJSON(inputs.python-versions) }}
# Define services here to run Docker containers alongside your job
services:
postgres:
image: bodoai1/pydough-postgres-tpch:latest
env:
# Set environment variables for Postgres container
POSTGRES_USER: ${{ secrets.POSTGRES_USER }}
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }}
POSTGRES_DB: "pydough_test"
ports:
- 5432:5432
env:
POSTGRES_USER: ${{ secrets.POSTGRES_USER }}
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }}
POSTGRES_DB: pydough_test
POSTGRES_HOST: 127.0.0.1
steps:
- uses: actions/checkout@v4
- name: Setup Python ${{ matrix.python-version }}
id: setup-python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
version: "0.6.0"
- name: Create virtual environment
run: uv venv
- name: Install dependencies
run: uv pip install -e ".[postgres]"
- name: Wait for Postgres to be ready
run: |
for i in $(seq 1 36); do
pg_isready -h ${{ env.POSTGRES_HOST }} -U ${{ env.POSTGRES_USER }} -d ${{ env.POSTGRES_DB }} && break || sleep 5;
done
pg_isready -h ${{ env.POSTGRES_HOST }} -U ${{ env.POSTGRES_USER }} -d ${{ env.POSTGRES_DB }} && echo "PostgreSQL is running" || exit 1;
- name: Confirm Postgres connector is installed
run: uv run python -c "import psycopg2; print('Postgres connector installed')"
- name: Run Postgres Tests
run: uv run pytest -m postgres tests/ -rs