Commit awqms test suite #199
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |