From c3cd30b6425d1c677168e04c15c96a47ffdc1897 Mon Sep 17 00:00:00 2001 From: Richard Bowman Date: Tue, 3 Dec 2024 12:54:34 +0000 Subject: [PATCH] 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. --- .gitlab-ci.yml | 19 ++++++++++++------- pyproject.toml | 1 + 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1ebc01d9..b1483b1d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -16,11 +16,11 @@ meta-build-image: - cd .meta-testimage-python - docker build -t $CI_REGISTRY/openflexure/openflexure-microscope-server/testimage-python:latest . - docker push $CI_REGISTRY/openflexure/openflexure-microscope-server/testimage-python:latest - #only: - #refs: # commented out for initial run - # - main - # changes: - # - .meta/Dockerfile + only: + refs: # commented out for initial run + - v3 + changes: + - .meta/Dockerfile # Re-usable block to install (and cache) Poetry and openflexure-microscope-server @@ -72,6 +72,7 @@ mypy: extends: .python script: - 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 allow_failure: true @@ -86,8 +87,11 @@ mypy: pytest: stage: testing extends: .python - script: - - pytest --cov --cov-report term --cov-report xml:coverage.xml --junitxml=report.xml + script: > + - 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+)?\%)$/' artifacts: when: always @@ -95,6 +99,7 @@ pytest: - report.xml reports: junit: report.xml + codequality: pytest-warnings.json coverage_report: coverage_format: cobertura path: coverage.xml diff --git a/pyproject.toml b/pyproject.toml index b3a0ca1b..3a69ef5e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -32,6 +32,7 @@ dev = [ "ruff", "mypy[reports]", "mypy-gitlab-code-quality", + "pytest-gitlab-code-quality", "pytest", ] pi = [