-
Notifications
You must be signed in to change notification settings - Fork 5
61 lines (54 loc) · 1.59 KB
/
pytest.yml
File metadata and controls
61 lines (54 loc) · 1.59 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
name: Pytest
on:
pull_request:
paths:
- "**.py"
- "requirements.txt"
permissions:
contents: read
jobs:
pytest:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: labconnect
ports:
- 5432:5432
options: >-
--health-cmd="pg_isready -U postgres -d labconnect"
--health-interval=10s
--health-timeout=5s
--health-retries=3
strategy:
matrix:
python-version: ["3.12.4"]
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Wait for PostgreSQL to be ready
run: |
while ! pg_isready -h localhost -p 5432 -U postgres -d labconnect; do
echo "Waiting for PostgreSQL..."
sleep 2
done
- name: Set up the Database
env:
DATABASE_URL: postgresql+psycopg2://postgres:postgres@localhost:5432/labconnect
run: |
python db_init.py create
- name: Running pytest
env:
DATABASE_URL: postgresql+psycopg2://postgres:postgres@localhost:5432/labconnect
run: |
python -m pytest tests/