mirror of
https://git.linux-kernel.at/oliver/ivatar.git
synced 2025-11-19 14:38:02 +00:00
Split CI testing into parallel jobs for OpenTelemetry
- test_without_opentelemetry: Run baseline tests without OpenTelemetry - test_with_opentelemetry_and_coverage: Run comprehensive tests with OpenTelemetry enabled and measure coverage - Both jobs run in parallel for faster CI execution - Coverage is measured only on OpenTelemetry-enabled run to capture additional code paths - Updated pages job dependency to use the new coverage job
This commit is contained in:
@@ -11,7 +11,42 @@ cache:
|
||||
variables:
|
||||
PIP_CACHE_DIR: .pipcache
|
||||
|
||||
test_and_coverage:
|
||||
# Test without OpenTelemetry (baseline testing)
|
||||
test_without_opentelemetry:
|
||||
stage: build
|
||||
services:
|
||||
- postgres:latest
|
||||
variables:
|
||||
POSTGRES_DB: django_db
|
||||
POSTGRES_USER: django_user
|
||||
POSTGRES_PASSWORD: django_password
|
||||
POSTGRES_HOST: postgres
|
||||
DATABASE_URL: "postgres://django_user:django_password@postgres/django_db"
|
||||
PYTHONUNBUFFERED: 1
|
||||
# Ensure OpenTelemetry is disabled
|
||||
ENABLE_OPENTELEMETRY: "false"
|
||||
OTEL_ENABLED: "false"
|
||||
before_script:
|
||||
- virtualenv -p python3 /tmp/.virtualenv
|
||||
- source /tmp/.virtualenv/bin/activate
|
||||
- pip install -U pip
|
||||
- pip install Pillow
|
||||
- pip install -r requirements.txt
|
||||
- pip install pycco
|
||||
script:
|
||||
- source /tmp/.virtualenv/bin/activate
|
||||
- echo 'from ivatar.settings import TEMPLATES' > config_local.py
|
||||
- echo 'TEMPLATES[0]["OPTIONS"]["debug"] = True' >> config_local.py
|
||||
- echo "DEBUG = True" >> config_local.py
|
||||
- echo "from config import CACHES" >> config_local.py
|
||||
- echo "CACHES['default'] = CACHES['filesystem']" >> config_local.py
|
||||
- python manage.py sqldsn
|
||||
- python manage.py collectstatic --noinput
|
||||
- echo "Running tests without OpenTelemetry..."
|
||||
- ./run_tests_no_ot.sh
|
||||
|
||||
# Test with OpenTelemetry enabled and measure coverage
|
||||
test_with_opentelemetry_and_coverage:
|
||||
stage: build
|
||||
coverage: "/^TOTAL.*\\s+(\\d+\\%)$/"
|
||||
services:
|
||||
@@ -23,6 +58,11 @@ test_and_coverage:
|
||||
POSTGRES_HOST: postgres
|
||||
DATABASE_URL: "postgres://django_user:django_password@postgres/django_db"
|
||||
PYTHONUNBUFFERED: 1
|
||||
# Enable OpenTelemetry for comprehensive testing
|
||||
ENABLE_OPENTELEMETRY: "true"
|
||||
OTEL_ENABLED: "true"
|
||||
OTEL_SERVICE_NAME: "ivatar-ci"
|
||||
OTEL_ENVIRONMENT: "ci"
|
||||
before_script:
|
||||
- virtualenv -p python3 /tmp/.virtualenv
|
||||
- source /tmp/.virtualenv/bin/activate
|
||||
@@ -33,7 +73,6 @@ test_and_coverage:
|
||||
- pip install coverage
|
||||
- pip install pycco
|
||||
- pip install django_coverage_plugin
|
||||
|
||||
script:
|
||||
- source /tmp/.virtualenv/bin/activate
|
||||
- echo 'from ivatar.settings import TEMPLATES' > config_local.py
|
||||
@@ -43,7 +82,8 @@ test_and_coverage:
|
||||
- echo "CACHES['default'] = CACHES['filesystem']" >> config_local.py
|
||||
- python manage.py sqldsn
|
||||
- python manage.py collectstatic --noinput
|
||||
- coverage run --source . manage.py test -v3 --noinput
|
||||
- echo "Running tests with OpenTelemetry enabled and measuring coverage..."
|
||||
- coverage run --source . ./run_tests_with_ot.sh
|
||||
- coverage report --fail-under=70
|
||||
- coverage html
|
||||
artifacts:
|
||||
@@ -73,7 +113,7 @@ pycco:
|
||||
pages:
|
||||
stage: deploy
|
||||
dependencies:
|
||||
- test_and_coverage
|
||||
- test_with_opentelemetry_and_coverage
|
||||
- pycco
|
||||
script:
|
||||
- mv htmlcov/ public/
|
||||
|
||||
Reference in New Issue
Block a user