Skip to content

Move sensor data ingestion to job queue #12057

Move sensor data ingestion to job queue

Move sensor data ingestion to job queue #12057

Workflow file for this run

name: lint-and-test
on:
push:
pull_request:
types:
- opened
- synchronize
jobs:
check:
runs-on: ubuntu-latest
name: Check (on Python 3.12)
steps:
- uses: actions/checkout@v6
- name: "Set up Python"
uses: actions/setup-python@v6
with:
python-version-file: ".python-version"
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
cache-dependency-glob: '.pre-commit-config.yaml'
version: "0.10.9"
- name: Install dev dependencies
run: uv sync --only-group dev --frozen
- uses: tox-dev/action-pre-commit-uv@v1
test:
needs: check
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
py_version: [ "3.10", "3.11", "3.12" ]
include:
# Include coverage for Python 3.12
- py_version: 3.12
coverage: yes
name: "Test (on Python ${{ matrix.py_version }})"
steps:
- name: Check out src from Git
uses: actions/checkout@v6
- name: Set up test environment
uses: ./.github/actions/setup-test-env
with:
python-version: ${{ matrix.py_version }}
- name: Run all tests AND record coverage
# NB the --ignore and -k "not ..." statements are not used to ignore test modules,
# but only to ignore some modules with doctests that do not (yet) pass (e.g. requiring app contexts)
run: |
if [[ "${{ matrix.py_version }}" == "3.10" ]]; then
PYTEST_K="not get_object_or_literal and not get_or_create_model and not find_smallest_common_unit"
else
PYTEST_K="not get_object_or_literal and not get_or_create_model"
fi
uv run pytest -v \
--doctest-modules \
--ignore documentation \
--ignore wsgi.py \
--ignore flexmeasures/cli/data_add.py \
--ignore flexmeasures/cli/data_delete.py \
--ignore flexmeasures/cli/data_edit.py \
--ignore flexmeasures/cli/data_show.py \
--ignore flexmeasures/cli/db_ops.py \
--ignore flexmeasures/cli/jobs.py \
--ignore flexmeasures/cli/monitor.py \
--ignore flexmeasures/data/migrations \
--ignore flexmeasures/data/scripts \
-k "$PYTEST_K" \
--cov=flexmeasures \
--cov-branch \
--cov-report=lcov
- name: Coveralls
uses: coverallsapp/github-action@v2
with:
fail-on-error: false
if: ${{ matrix.coverage == 'yes' }}
env:
PGHOST: 127.0.0.1
PGPORT: 5432
PGUSER: flexmeasures_test
PGDB: flexmeasures_test
PGPASSWORD: flexmeasures_test
FLEXMEASURES_ENV: testing
SQLALCHEMY_DATABASE_URI: postgresql://flexmeasures_test:[email protected]:5432/flexmeasures_test
services:
# Label used to access the service container
postgres:
# Docker Hub image
image: postgres:17.4
env:
POSTGRES_USER: flexmeasures_test
POSTGRES_PASSWORD: flexmeasures_test
POSTGRES_DB: flexmeasures_test
ports:
- 5432:5432
# needed because the postgres container does not provide a healthcheck
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5