Only rebuild docker for changes

Docker is now only rebuilt when it's changed, and on `v3`  branch.

I've also added code quality reporting for pytest.
This commit is contained in:
Richard Bowman 2024-12-03 12:54:34 +00:00
parent 71e6d84aa4
commit c3cd30b642
2 changed files with 13 additions and 7 deletions

View file

@ -16,11 +16,11 @@ meta-build-image:
- cd .meta-testimage-python - cd .meta-testimage-python
- docker build -t $CI_REGISTRY/openflexure/openflexure-microscope-server/testimage-python:latest . - docker build -t $CI_REGISTRY/openflexure/openflexure-microscope-server/testimage-python:latest .
- docker push $CI_REGISTRY/openflexure/openflexure-microscope-server/testimage-python:latest - docker push $CI_REGISTRY/openflexure/openflexure-microscope-server/testimage-python:latest
#only: only:
#refs: # commented out for initial run refs: # commented out for initial run
# - main - v3
# changes: changes:
# - .meta/Dockerfile - .meta/Dockerfile
# Re-usable block to install (and cache) Poetry and openflexure-microscope-server # Re-usable block to install (and cache) Poetry and openflexure-microscope-server
@ -72,6 +72,7 @@ mypy:
extends: .python extends: .python
script: script:
- mypy --cobertura-xml-report mypy --no-error-summary src | tee mypy/stdout.txt - mypy --cobertura-xml-report mypy --no-error-summary src | tee mypy/stdout.txt
after_script:
- cat mypy/stdout.txt | mypy-gitlab-code-quality > codequality.json - cat mypy/stdout.txt | mypy-gitlab-code-quality > codequality.json
allow_failure: true allow_failure: true
@ -86,8 +87,11 @@ mypy:
pytest: pytest:
stage: testing stage: testing
extends: .python extends: .python
script: script: >
- pytest --cov --cov-report term --cov-report xml:coverage.xml --junitxml=report.xml - pytest --cov --cov-report term
--cov-report xml:coverage.xml
--junitxml=report.xml
--gitlab-code-quality-report=pytest-warnings.json
coverage: '/(?i)total.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/' coverage: '/(?i)total.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/'
artifacts: artifacts:
when: always when: always
@ -95,6 +99,7 @@ pytest:
- report.xml - report.xml
reports: reports:
junit: report.xml junit: report.xml
codequality: pytest-warnings.json
coverage_report: coverage_report:
coverage_format: cobertura coverage_format: cobertura
path: coverage.xml path: coverage.xml

View file

@ -32,6 +32,7 @@ dev = [
"ruff", "ruff",
"mypy[reports]", "mypy[reports]",
"mypy-gitlab-code-quality", "mypy-gitlab-code-quality",
"pytest-gitlab-code-quality",
"pytest", "pytest",
] ]
pi = [ pi = [