From e051ce3e6874af88bbca9fdebfe4a6a1794e8e5c Mon Sep 17 00:00:00 2001
From: Joscha Schmiedt <joscha@schmiedt.dev>
Date: Sun, 15 Sep 2024 22:08:31 +0200
Subject: [PATCH] Move building of dependencies and venv activation to
 Dockerfile

---
 .docker/Dockerfile | 11 +++++++++--
 .gitlab-ci.yml     | 17 ++---------------
 Makefile           |  2 +-
 3 files changed, 12 insertions(+), 18 deletions(-)

diff --git a/.docker/Dockerfile b/.docker/Dockerfile
index da36ef0..08fd0e7 100644
--- a/.docker/Dockerfile
+++ b/.docker/Dockerfile
@@ -6,9 +6,9 @@ RUN apt-get install -y lcov
 RUN apt-get install -y doxygen graphviz
 RUN apt-get install -y clang-format clang-tidy
 RUN apt-get install -y python3-pip python3-venv
-RUN apt-get install -y git
+RUN apt-get install -y git  
 RUN apt-get install -y curl zip unzip tar
-RUN apt-get install -y perl
+RUN apt-get install -y perl pkg-config
 
 
 RUN apt-get install -y  openjdk-17-jdk-headless
@@ -21,8 +21,15 @@ COPY doc/requirements.txt doc-requirements.txt
 RUN ./venv/bin/pip install -r doc-requirements.txt
 COPY requirements.txt build-requirements.txt
 RUN ./venv/bin/pip install -r build-requirements.txt
+RUN ./venv/bin/conan profile detect
+# add venv with conan to .bashrc
+RUN echo "source /venv/bin/activate" >> /root/.bashrc
 
 COPY . /libcaosdb/
 WORKDIR /libcaosdb
 RUN git rev-parse HEAD > libcaosdb_commit
 RUN rm -rf .git
+
+# build dependencies
+RUN /venv/bin/conan install /libcaosdb --build=missing -s build_type=Debug
+RUN /venv/bin/conan install /libcaosdb --build=missing -s build_type=Release
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index c703a46..ea86d41 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -86,8 +86,7 @@ code_style:
 build_vcpkg:
   tags: [ docker ]
   stage: test
-  script:
-    - apt update && apt install -y pkg-config 
+  script:    
     - cd vcpkg && git fetch origin 5d3798ac7388ca66c169773e46103b14077b76a4 && cd ..
     - make vcpkg-build-release
   allow_failure: true
@@ -96,19 +95,8 @@ build_vcpkg:
 test:
   tags: [ docker ]
   stage: test
-  script:
-    - conan profile detect
+  script:    
     - make test
-    # - mkdir build
-    # - cd build
-    # - VERSION="$(conan inspect --raw version ..)"
-    # - conan install -s "compiler.libcxx=libstdc++11" --build=missing -o build_acm=True . #.. "caosdb/$VERSION@_/_"
-    # - conan build -s "compiler.libcxx=libstdc++11" . --s build_type=Debug
-    # - cd build/Debug
-    # - cmake --build . -j
-    # - cmake --build . -j --target unit_test_coverage
-    # - cmake --build . -j --target cxxcaosdbcli
-    # - cmake --build . -j --target ccaosdbcli  # Disabled until it compiles again.
 
 trigger_prepare:
   # Calculate the branch name
@@ -237,7 +225,6 @@ trigger_inttest:
   tags: [ cached-dind ]
   stage: deploy
   script:
-    - conan profile detect
     - make doc
     - cp -r build/Release/doc/sphinx_out ./public
 
diff --git a/Makefile b/Makefile
index 49609d5..a2d082d 100644
--- a/Makefile
+++ b/Makefile
@@ -22,7 +22,7 @@
 # This Makefile is a wrapper for several other scripts.
 
 
-CLANG_FORMAT ?= clang-format-11
+CLANG_FORMAT ?= clang-format
 CONAN_SETTINGS = "compiler.libcxx=libstdc++11"
 
 # OS specific handling, with code by Ken Jackson and oHo,
-- 
GitLab