ci: rework test_api job
Part-of: <https://dev.funkwhale.audio/funkwhale/funkwhale/-/merge_requests/2286>
This commit is contained in:
parent
1e5273cc5e
commit
1a9b93183d
|
@ -172,15 +172,21 @@ lint_front:
|
||||||
|
|
||||||
test_api:
|
test_api:
|
||||||
interruptible: true
|
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:
|
services:
|
||||||
- postgres:15-alpine
|
- postgres:15-alpine
|
||||||
- redis:7-alpine
|
- redis:7-alpine
|
||||||
stage: test
|
|
||||||
retry: 1
|
|
||||||
cache:
|
cache:
|
||||||
key: "$CI_PROJECT_ID__pip_cache"
|
paths: ["$PIP_CACHE_DIR"]
|
||||||
paths:
|
|
||||||
- "$PIP_CACHE_DIR"
|
|
||||||
variables:
|
variables:
|
||||||
DATABASE_URL: "postgresql://postgres@postgres/postgres"
|
DATABASE_URL: "postgresql://postgres@postgres/postgres"
|
||||||
FUNKWHALE_URL: "https://funkwhale.ci"
|
FUNKWHALE_URL: "https://funkwhale.ci"
|
||||||
|
@ -189,9 +195,16 @@ test_api:
|
||||||
CACHE_URL: "redis://redis:6379/0"
|
CACHE_URL: "redis://redis:6379/0"
|
||||||
before_script:
|
before_script:
|
||||||
- cd api
|
- cd api
|
||||||
- poetry install --no-root
|
- poetry install
|
||||||
script:
|
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:
|
artifacts:
|
||||||
expire_in: 2 weeks
|
expire_in: 2 weeks
|
||||||
reports:
|
reports:
|
||||||
|
@ -199,17 +212,7 @@ test_api:
|
||||||
coverage_report:
|
coverage_report:
|
||||||
coverage_format: cobertura
|
coverage_format: cobertura
|
||||||
path: api/coverage.xml
|
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*%)/'
|
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
|
# Those tests are disabled for now since no vitest dom emulation is providing
|
||||||
# AudioContext, which is required for our HTML audio player
|
# AudioContext, which is required for our HTML audio player
|
||||||
|
|
|
@ -175,7 +175,7 @@ env = [
|
||||||
|
|
||||||
[tool.coverage.run]
|
[tool.coverage.run]
|
||||||
plugins = ["django_coverage_plugin"]
|
plugins = ["django_coverage_plugin"]
|
||||||
include = ["funkwhale_api/*"]
|
source = ["funkwhale_api"]
|
||||||
omit = [
|
omit = [
|
||||||
"*migrations*",
|
"*migrations*",
|
||||||
"*tests*",
|
"*tests*",
|
||||||
|
|
Loading…
Reference in New Issue