From 01c48f439b509ee107898f941b8a692f81b7f2e2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Joan=20Vallv=C3=A9=20Navarro?= <jvallve@iri.upc.edu>
Date: Wed, 1 Mar 2023 14:22:21 +0100
Subject: [PATCH] Update .gitlab-ci.yml file

---
 .gitlab-ci.yml | 58 +++++++++++++++++++++++++++++++++++++++++---------
 1 file changed, 48 insertions(+), 10 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 3301cc59e..1df6cec14 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -10,6 +10,12 @@ stages:
   - echo $WOLF_IMU_BRANCH
 
 .preliminaries_template: &preliminaries_definition
+  ## OVERRIDE VARIABLES
+  - export WOLF_CORE_BRANCH="454-implementation-of-new-nodes-creation"
+
+  ## PRINT VARIABLES
+  - *print_variables_definition
+
   ## Install ssh-agent if not already installed, it is required by Docker.
   ## (change apt-get to yum if you use an RPM-based image)
   - 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
@@ -43,20 +49,28 @@ stages:
   - git config --global user.name "${CI_USERNAME}"
   - git checkout -b $CI_NEW_BRANCH # temporary branch
 
+  # download license script
+  - if [ -f /ci_deps/license_manager.sh ]; then
+  -   echo "File license_manager.sh already exists."
+  - else
+  -   echo "Downloading file license_manager.sh..."
+  -   wget -P /ci_deps  https://gitlab.iri.upc.edu/mobile_robotics/wolf_projects/wolf_lib/wolf/-/raw/devel/wolf_scripts/license_manager.sh
+  - fi
+
   # license headers
   - export CURRENT_YEAR=$( date +'%Y' )
   - echo "current year:" ${CURRENT_YEAR}
   - if [ -f license_header_${CURRENT_YEAR}.txt ]; then
       # add license headers to new files
   -   echo "File license_header_${CURRENT_YEAR}.txt already exists. License headers are assumed to be updated. Adding headers to new files..."
-  -   ./ci_deps/wolf/wolf_scripts/license_manager.sh --add --path=. --license-header=license_header_${CURRENT_YEAR}.txt --exclude=ci_deps
+  -   source /ci_deps/license_manager.sh --add --path=. --license-header=license_header_${CURRENT_YEAR}.txt --exclude=ci_deps
   - else
       # update license headers of all files
   -   export PREV_YEAR=$(( CURRENT_YEAR-1 ))
   -   echo "Creating new file license_header_${CURRENT_YEAR}.txt..."
   -   git mv license_header_${PREV_YEAR}.txt license_header_${CURRENT_YEAR}.txt
   -   sed -i "s/${PREV_YEAR}/${PREV_YEAR},${CURRENT_YEAR}/g" license_header_${CURRENT_YEAR}.txt
-  -   ./ci_deps/wolf/wolf_scripts/license_manager.sh --update --path=. --license-header=license_header_${CURRENT_YEAR}.txt --exclude=ci_deps
+  -   source /ci_deps/license_manager.sh --update --path=. --license-header=license_header_${CURRENT_YEAR}.txt --exclude=ci_deps
   - fi
 
   # push changes (if any)
@@ -67,6 +81,24 @@ stages:
   -   echo "No changes, nothing to commit!"
   - fi
 
+.install_yamlschemacpp_template: &install_yamlschemacpp_definition
+  - cd ${CI_PROJECT_DIR}/ci_deps
+  - if [ -d yaml-schema-cpp ]; then
+  -   echo "directory yaml-schema-cpp exists"
+  -   cd yaml-schema-cpp
+  -   git checkout main
+  -   git pull
+  - else
+  -   git clone -b main ssh://git@gitlab.iri.upc.edu:2202/labrobotica/algorithms/yaml-schema-cpp.git
+  -   cd yaml-schema-cpp
+  - fi
+  - mkdir -pv build
+  - cd build
+  - cmake -DCMAKE_BUILD_TYPE=release -DBUILD_TESTS=OFF ..
+  - make -j$(nproc)
+  - make install
+  - ldconfig
+
 .install_wolf_template: &install_wolf_definition
   - cd ${CI_PROJECT_DIR}/ci_deps
   - if [ -d wolf ]; then
@@ -99,14 +131,8 @@ stages:
 license_headers:
   stage: license
   image: labrobotica/wolf_deps:20.04
-  cache:
-    - key: wolf-focal
-      paths:
-      - ci_deps/wolf/
   before_script:
-    - *print_variables_definition
     - *preliminaries_definition
-    - *install_wolf_definition
   script:
     - *license_header_definition
 
@@ -118,9 +144,15 @@ build_and_test:bionic:
     - key: wolf-bionic
       paths:
       - ci_deps/wolf/
+    - key: yamlschemacpp-bionic
+      paths:
+      - ci_deps/yaml_schema_cpp/
+    - key: yamlschemacpp-bionic
+      paths:
+      - ci_deps/yaml_schema_cpp/
   before_script:
-    - *print_variables_definition
     - *preliminaries_definition
+    - *install_yamlschemacpp_definition
     - *install_wolf_definition
   script:
     - *build_and_test_definition
@@ -133,9 +165,15 @@ build_and_test:focal:
     - key: wolf-focal
       paths:
       - ci_deps/wolf/
+    - key: yamlschemacpp-focal
+      paths:
+      - ci_deps/yaml_schema_cpp/
+    - key: yamlschemacpp-focal
+      paths:
+      - ci_deps/yaml_schema_cpp/
   before_script:
-    - *print_variables_definition
     - *preliminaries_definition
+    - *install_yamlschemacpp_definition
     - *install_wolf_definition
   script:
     - *build_and_test_definition
-- 
GitLab