-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (59 loc) · 2.15 KB
/
pytest.yml
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
72
73
74
name: Pytest
on:
push:
workflow_dispatch:
jobs:
pytest-e2e:
runs-on: ubuntu-latest
name: python
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v4
- name: "Set up Python"
uses: actions/setup-python@v5
with:
python-version-file: ".python-version"
- name: Install the project
run: |
uv sync --all-extras --dev
uv pip install -e .
- name: Setup Docker Compose
uses: docker/setup-buildx-action@v2
- name: Start Docker Compose services
run: |
cp .env.example .env
docker compose up -d
docker compose ps
- name: Log container output if database fails
if: failure()
run: |
echo "Logging container output for debugging..."
docker compose logs owdp-database
docker compose ps
docker network inspect $(docker network ls -q) || true
docker inspect $(docker ps -aq) || true
- name: Wait for Frost and Init DB
run: |
echo "Running docker/frost/wait-for-frost-and-init-db.sh..."
cd docker/frost; bash wait-for-frost-and-init-db.sh
- name: Check indices were added
run: |
echo "Checking if a given index 'idx_observations_datastream_id' exists in the database..."
index_check=$(docker exec -t owdp-database psql -U sensorthings -d sensorthings -t -c "SELECT indexname FROM pg_indexes WHERE tablename = 'OBSERVATIONS' AND indexname = 'idx_observations_datastream_id';")
echo "Query result: $index_check"
index_check=$(echo "$index_check" | xargs)
if [[ "$index_check" != *"idx_observations_datastream_id"* ]]; then
echo "Error: The index 'idx_observations_datastream_id' is missing! Output was: '$index_check'"
exit 1
else
echo "Index 'idx_observations_datastream_id' found."
fi
- name: Run tests
run: |
cp .env.example .env
uv run pytest -x
- name: Stop Docker Compose services
if: always()
run: |
docker compose down