From 17c87e0b87db2fd3feb5bbe691c1261a00e5d2c8 Mon Sep 17 00:00:00 2001
From: Julian Rother <julian@cccv.de>
Date: Thu, 19 Oct 2023 23:46:10 +0200
Subject: [PATCH] CI testing for Debian Bookworm

---
 .gitlab-ci.yml | 63 +++++++++++++++++++++++++++++++++++++++-----------
 1 file changed, 50 insertions(+), 13 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 47721f5..18d0d49 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,4 +1,4 @@
-image: registry.git.cccv.de/uffd/docker-images/buster
+image: registry.git.cccv.de/uffd/docker-images/bookworm
 
 variables:
   DEBIAN_FRONTEND: noninteractive 
@@ -58,14 +58,27 @@ linter:bullseye:
     reports:
       codequality: codeclimate.json
 
+linter:bookworm:
+  image: registry.git.cccv.de/uffd/docker-images/bookworm
+  stage: test
+  script:
+  - pip3 install $PYLINT_PIN pylint-gitlab # this force-updates jinja2 and some other packages!
+  - python3 -m pylint --exit-zero --rcfile .pylintrc --output-format=pylint_gitlab.GitlabCodeClimateReporter app.py > codeclimate.json
+  - python3 -m pylint --exit-zero --rcfile .pylintrc --output-format=pylint_gitlab.GitlabPagesHtmlReporter app.py > pylint.html
+  - python3 -m pylint --rcfile .pylintrc --output-format=text app.py
+  artifacts:
+    when: always
+    paths:
+    - pylint.html
+    reports:
+      codequality: codeclimate.json
+
 unittests:buster:
   image: registry.git.cccv.de/uffd/docker-images/buster
   stage: test
   script:
   - python3-coverage run --include 'app.py' -m pytest --junitxml=report.xml || true
-  - python3-coverage report -m
   - python3-coverage html
-  - python3-coverage xml
   artifacts:
     when: always
     paths:
@@ -73,20 +86,14 @@ unittests:buster:
     - htmlcov
     expose_as: 'Coverage Report'
     reports:
-      coverage_report:
-        coverage_format: cobertura
-        path: coverage.xml
       junit: report.xml
-  coverage: '/^TOTAL.*\s+(\d+\%)$/'
 
 unittests:bullseye:
   image: registry.git.cccv.de/uffd/docker-images/bullseye
   stage: test
   script:
   - python3-coverage run --include 'app.py' -m pytest --junitxml=report.xml || true
-  #- python3-coverage report -m
   - python3-coverage html
-  #- python3-coverage xml
   artifacts:
     when: always
     paths:
@@ -94,11 +101,28 @@ unittests:bullseye:
     - htmlcov
     expose_as: 'Coverage Report'
     reports:
-      #coverage_report:
-      #  coverage_format: cobertura
-      #  path: coverage.xml
       junit: report.xml
-  #coverage: '/^TOTAL.*\s+(\d+\%)$/'
+
+unittests:bookworm:
+  image: registry.git.cccv.de/uffd/docker-images/bookworm
+  stage: test
+  script:
+  - python3-coverage run --include 'app.py' -m pytest --junitxml=report.xml || true
+  - python3-coverage report -m
+  - python3-coverage html
+  - python3-coverage xml
+  artifacts:
+    when: always
+    paths:
+    - htmlcov/index.html
+    - htmlcov
+    expose_as: 'Coverage Report'
+    reports:
+      coverage_report:
+        coverage_format: cobertura
+        path: coverage.xml
+      junit: report.xml
+  coverage: '/^TOTAL.*\s+(\d+\%)$/'
 
 test:package:apt:buster:
   image: registry.git.cccv.de/uffd/docker-images/buster
@@ -124,6 +148,18 @@ test:package:apt:bullseye:
   dependencies:
   - build:apt
 
+test:package:apt:bookworm:
+  image: registry.git.cccv.de/uffd/docker-images/bookworm
+  stage: test
+  script:
+  - apt -y install ./*.deb
+  - service uwsgi start uffd-nginxauth || ( service uwsgi status uffd-nginxauth; sleep 15; cat /var/log/uwsgi/app/uffd-nginxauth.log; )
+  - echo "server { listen 127.0.0.1:5000 default_server;  include /etc/uffd-nginxauth/nginx.include.conf; }" > /etc/nginx/sites-enabled/uffd-nginxauth.ini
+  - service nginx start || ( service nginx status; nginx -t; exit 1; )
+  - curl -Lv http://127.0.0.1:5000/status
+  dependencies:
+  - build:apt
+
 .publish:
   stage: deploy
   rules:
@@ -140,5 +176,6 @@ publish:apt:
   - echo Update published repo for all distros
   - 'curl --user "${APTLY_API_USER}:${APTLY_API_PW}" -X PUT -H "Content-Type: application/json" --data "{ }" "${APT_API_URL}/api/publish/${APT_REPO}/buster"'
   - 'curl --user "${APTLY_API_USER}:${APTLY_API_PW}" -X PUT -H "Content-Type: application/json" --data "{ }" "${APT_API_URL}/api/publish/${APT_REPO}/bullseye"'
+  - 'curl --user "${APTLY_API_USER}:${APTLY_API_PW}" -X PUT -H "Content-Type: application/json" --data "{ }" "${APT_API_URL}/api/publish/${APT_REPO}/bookworm"'
   dependencies:
   - build:apt
-- 
GitLab