ci: rework test_api job

Part-of: <https://dev.funkwhale.audio/funkwhale/funkwhale/-/merge_requests/2286>
environments/review-docs-poetr-umn39l/deployments/16928
jo 2023-01-18 23:47:17 +01:00
rodzic 1e5273cc5e
commit 1a9b93183d
2 zmienionych plików z 21 dodań i 18 usunięć

Wyświetl plik

@ -172,15 +172,21 @@ lint_front:
test_api:
interruptible: true
retry: 1
stage: test
rules:
- if: $CI_COMMIT_BRANCH =~ /(stable|develop)/
- changes: [api/**/*]
image: $CI_REGISTRY/funkwhale/ci/python-funkwhale-api:$PYTHON_VERSION
parallel:
matrix:
- PYTHON_VERSION: ["3.8", "3.9", "3.10", "3.11"]
services:
- postgres:15-alpine
- redis:7-alpine
stage: test
retry: 1
cache:
key: "$CI_PROJECT_ID__pip_cache"
paths:
- "$PIP_CACHE_DIR"
paths: ["$PIP_CACHE_DIR"]
variables:
DATABASE_URL: "postgresql://postgres@postgres/postgres"
FUNKWHALE_URL: "https://funkwhale.ci"
@ -189,9 +195,16 @@ test_api:
CACHE_URL: "redis://redis:6379/0"
before_script:
- cd api
- poetry install --no-root
- poetry install
script:
- poetry run pytest --cov-report xml --cov-report term-missing:skip-covered --cov=funkwhale_api --junitxml=report.xml tests/
- >
poetry run pytest
--junitxml=report.xml
--cov
--cov-config=pyproject.toml
--cov-report=term-missing:skip-covered
--cov-report=xml
tests
artifacts:
expire_in: 2 weeks
reports:
@ -199,17 +212,7 @@ test_api:
coverage_report:
coverage_format: cobertura
path: api/coverage.xml
parallel:
matrix:
- PY_VER: ["3.8", "3.9", "3.10", "3.11"]
image: $CI_REGISTRY/funkwhale/backend-test-docker:$PY_VER
coverage: '/TOTAL\s*\d*\s*\d*\s*(\d*%)/'
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event" || $CI_PIPELINE_SOURCE == "push"
changes:
- api/**/*
- if: $CI_COMMIT_REF_PROTECTED == "true"
when: always
# Those tests are disabled for now since no vitest dom emulation is providing
# AudioContext, which is required for our HTML audio player

Wyświetl plik

@ -175,7 +175,7 @@ env = [
[tool.coverage.run]
plugins = ["django_coverage_plugin"]
include = ["funkwhale_api/*"]
source = ["funkwhale_api"]
omit = [
"*migrations*",
"*tests*",