This is an automated email from the ASF dual-hosted git repository.

bnolsen pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/trafficserver-ci.git


The following commit(s) were added to refs/heads/main by this push:
     new 3589415  Cmake branch prefix (#299)
3589415 is described below

commit 3589415cd7e3e5a3466162863a8f8b336e742af7
Author: Brian Olsen <[email protected]>
AuthorDate: Tue Dec 12 12:40:34 2023 -0700

    Cmake branch prefix (#299)
    
    * prepend branch build cmake presets with branch-
    
    * move release/debug inherits to front
---
 jenkins/bin/clang-analyzer.sh    |   2 +-
 jenkins/bin/cmake.sh             |  28 ++--
 jenkins/bin/quiche.sh            |   2 +-
 jenkins/branch/CMakePresets.json | 301 +++++++++++++++++++++++++++++++++------
 4 files changed, 268 insertions(+), 65 deletions(-)

diff --git a/jenkins/bin/clang-analyzer.sh b/jenkins/bin/clang-analyzer.sh
index c6c8e2f..2ee684a 100755
--- a/jenkins/bin/clang-analyzer.sh
+++ b/jenkins/bin/clang-analyzer.sh
@@ -39,7 +39,7 @@ then
   presetpath="${WORKSPACE}/ci/jenkins/branch/CMakePresets.json"
   [ -f "${presetpath}" ] && /bin/cp -f "${presetpath}" .
 
-       cmake -B builddir --preset clang-analyzer
+       cmake -B builddir --preset branch-clang-analyzer
        cmake --build builddir -v
 
        ${ANAL_BUILD} \
diff --git a/jenkins/bin/cmake.sh b/jenkins/bin/cmake.sh
index d4824ce..a689336 100755
--- a/jenkins/bin/cmake.sh
+++ b/jenkins/bin/cmake.sh
@@ -20,15 +20,6 @@
 
 set -x
 
-# join function
-join() {
-  local separator="$1"
-  shift
-  local first="$1"
-  shift
-  printf "%s" "$first" "${@/#/$separator}"
-}
-
 NPROC=$(nproc)
 
 if [ ! -d cmake ]
@@ -49,23 +40,28 @@ then
 fi
 
 FEATURES="${FEATURES:=""}"
-[ -n "${FEATURES}" ] && FEATURES="${FEATURES} ${btype}"
+[ -n "${FEATURES}" ] && FEATURES="${btype} ${FEATURES}"
 [ -z "${FEATURES}" ] && FEATURES="${btype}"
 
 # build CMakeUserPresets.json
 
-# split
-IFS=' ' read -ra farray <<< "$FEATURES"
+# split, handles extra spaces
+IFS=' ' read -ra farray <<< "${FEATURES}"
+
+# prepend with 'branch-' and quote
+for ((ind=0 ; ind < ${#farray[@]} ; ++ind)); do
+  farray[$ind]=\"branch-${farray[$ind]}\"
+done
 
-# join
-inherits=\"$(join '", "' "${farray[@]}")\"
+# comma separate
+inherits=$(sed 's/ /, /g' <<< "${farray[@]}")
 
 read -d '' contents << EOF
 {
   "version": 2,
   "configurePresets": [
     { 
-      "name": "ci-preset", 
+      "name": "branch-user-preset", 
       "inherits": [${inherits}]
     } 
   ] 
@@ -74,7 +70,7 @@ EOF
 
 echo "${contents}" > CMakeUserPresets.json
 
-cmake -B build --preset ci-preset
+cmake -B build --preset branch-user-preset
 cmake --build build -j${NPROC} -v
 cmake --install build
 
diff --git a/jenkins/bin/quiche.sh b/jenkins/bin/quiche.sh
index 7fa3b2e..2a5fa60 100755
--- a/jenkins/bin/quiche.sh
+++ b/jenkins/bin/quiche.sh
@@ -34,7 +34,7 @@ cd "${WORKSPACE}/src"
 presetpath="../ci/jenkins/branch/CMakePresets.json"
 [ -f "${presetpath}" ] && /bin/cp -f "${presetpath}" .
 
-cmake -B build --preset quiche
+cmake -B build --preset branch-quiche
 cmake --build build -j${NPROC} -v
 cmake --install build
 
diff --git a/jenkins/branch/CMakePresets.json b/jenkins/branch/CMakePresets.json
index c30cf7d..6cbd394 100644
--- a/jenkins/branch/CMakePresets.json
+++ b/jenkins/branch/CMakePresets.json
@@ -6,41 +6,253 @@
     "patch": 0
   },
   "configurePresets": [
+    {
+      "name": "default",
+      "displayName": "Default build with ninja",
+      "description": "Default build using Ninja generator",
+      "generator": "Ninja",
+      "binaryDir": "${sourceDir}/build-default",
+      "cacheVariables": {
+        "CMAKE_BUILD_TYPE": "Debug",
+        "CMAKE_COMPILE_WARNING_AS_ERROR": "ON"
+      }
+    },
+    {
+      "name": "layout-defaults",
+      "displayName": "Default install layout paths template",
+      "hidden": true,
+      "cacheVariables": {
+        "CMAKE_INSTALL_BINDIR": "bin",
+        "CMAKE_INSTALL_SBINDIR": "bin",
+        "CMAKE_INSTALL_LIBDIR": "lib",
+        "CMAKE_INSTALL_SYSCONFDIR": "etc/trafficserver",
+        "CMAKE_INSTALL_DATADIR": "share/trafficserver",
+        "CMAKE_INSTALL_INCLUDEDIR": "include",
+        "CMAKE_INSTALL_LIBEXECDIR": "libexec/trafficserver",
+        "CMAKE_INSTALL_RUNSTATEDIR": "var/trafficserver",
+        "CMAKE_INSTALL_INFODIR": "share/info",
+        "CMAKE_INSTALL_MANDIR": "share/man",
+        "CMAKE_INSTALL_LOGDIR": "var/log/trafficserver",
+        "CMAKE_INSTALL_CACHEDIR": "var/trafficserver"
+      }
+    },
+    {
+      "name": "release",
+      "displayName": "Release build",
+      "description": "Release build with Ninja generator",
+      "generator": "Ninja",
+      "binaryDir": "${sourceDir}/build-release",
+      "cacheVariables": {
+        "CMAKE_BUILD_TYPE": "Release",
+        "CMAKE_COMPILE_WARNING_AS_ERROR": "OFF",
+        "CMAKE_INSTALL_PREFIX": "/opt/ats",
+        "BUILD_EXPERIMENTAL_PLUGINS": "ON"
+      }
+    },
+    {
+      "name": "autest",
+      "inherits": ["default"],
+      "binaryDir": "${sourceDir}/build-autest",
+      "cacheVariables": {
+        "ENABLE_AUTEST": "ON",
+        "CMAKE_INSTALL_PREFIX": "/tmp/ts-autest",
+        "BUILD_EXPERIMENTAL_PLUGINS": "ON",
+        "ENABLE_EXAMPLE": "ON"
+      }
+    },
+    {
+      "name": "dev",
+      "displayName": "development",
+      "description": "Development Presets",
+      "inherits": ["default"],
+      "binaryDir": "${sourceDir}/build-${presetName}",
+      "generator": "Ninja",
+      "cacheVariables": {
+        "CMAKE_COLOR_DIAGNOSTICS": "ON",
+        "CMAKE_EXPORT_COMPILE_COMMANDS": "ON",
+        "CMAKE_INSTALL_PREFIX": "/tmp/ats-dev"
+      }
+    },
+    {
+      "name": "asan",
+      "hidden": true,
+      "cacheVariables": {
+        "CMAKE_CXX_FLAGS_DEBUG": "-g -fsanitize=address,undefined",
+        "CMAKE_C_FLAGS_DEBUG": "-g -fsanitize=address,undefined"
+      }
+    },
+    {
+      "name": "hardened",
+      "hidden": true,
+      "cacheVariables": {
+        "CMAKE_CXX_FLAGS": "-D_FORTIFY_SOURCE=2 -fPIE -fstack-protector",
+        "CMAKE_EXE_LINKER_FLAGS": "-pie -Wl,-z,relro -Wl,-z,now"
+      }
+    },
+    {
+      "name": "dev-asan",
+      "displayName": "dev with asan",
+      "description": "Development Presets with ASAN sanitizer",
+      "inherits": ["dev", "asan"]
+    },
     {
       "name": "ci",
       "displayName": "CI defaults",
       "description": "Defaults for CI Pipeline builds",
-      "generator": "Unix Makefiles",
-      "binaryDir": "${sourceDir}/builddir",
+      "generator": "Ninja",
+      "binaryDir": "${sourceDir}/build-ci",
       "cacheVariables": {
         "CMAKE_BUILD_TYPE": "Debug",
-        "CMAKE_INSTALL_PREFIX": "/tmp/ats",
+        "CMAKE_COMPILE_WARNING_AS_ERROR": "ON",
         "ENABLE_CCACHE": "ON",
         "BUILD_EXPERIMENTAL_PLUGINS": "ON",
-        "BUILD_REGRESSION_TESTING": "ON",
-        "ENABLE_EXAMPLE": "ON"
+        "ENABLE_EXAMPLE": "ON",
+        "CMAKE_INSTALL_PREFIX": "/tmp/ats"
       }
     },
     {
-      "name": "release",
-      "displayName": "CI release",
-      "description": "CI release",
+      "name": "ci-centos",
+      "displayName": "CI CentOS",
+      "description": "CI Pipeline config for CentOS",
       "inherits": ["ci"],
+      "generator": "Unix Makefiles",
       "cacheVariables": {
-        "CMAKE_BUILD_TYPE": "Release"
+        "CMAKE_BUILD_TYPE": "Release",
+        "OPENSSL_ROOT_DIR": "/opt/openssl-quic"
       }
     },
     {
-      "name": "debug",
-      "displayName": "CI debug",
-      "description": "CI debug",
+      "name": "ci-docs",
+      "displayName": "Docs Build",
+      "description": "Presets for CI build of ATS docs",
+      "binaryDir": "${sourceDir}/build-docs",
+      "generator": "Ninja",
+      "cacheVariables": {
+        "ENABLE_DOCS": "ON"
+      }
+    },
+    {
+      "name": "ci-osx",
+      "displayName": "CI OSX",
+      "description": "CI Pipeline config for OSX",
+      "inherits": ["ci"],
+      "generator": "Unix Makefiles"
+    },
+    {
+      "name": "ci-rocky",
+      "displayName": "CI Rocky",
+      "description": "CI Pipeline config for Rocky Linux",
       "inherits": ["ci"],
+      "cacheVariables": {
+        "OPENSSL_ROOT_DIR": "/opt/boringssl",
+        "quiche_ROOT": "/opt/quiche",
+        "CMAKE_INSTALL_PREFIX": "/tmp/ats-quiche",
+        "ENABLE_QUICHE": true
+      }
+    },
+    {
+      "name": "ci-fedora",
+      "displayName": "CI Fedora",
+      "description": "CI Pipeline config for Fedora Linux",
+      "inherits": ["ci"],
+      "cacheVariables": {
+        "OPENSSL_ROOT_DIR": "/opt/openssl-quic"
+      }
+    },
+    {
+      "name": "ci-fedora-cxx20",
+      "displayName": "CI Fedora c++20",
+      "description": "CI Pipeline config for Fedora Linux compiled with c++20",
+      "inherits": ["ci"],
+      "cacheVariables": {
+        "CMAKE_CXX_STANDARD": "20"
+      }
+    },
+    {
+      "name": "ci-fedora-quiche",
+      "displayName": "CI Fedora Quiche",
+      "description": "CI Pipeline config for Fedora Linux (quiche build)",
+      "inherits": ["ci"],
+      "cacheVariables": {
+        "OPENSSL_ROOT_DIR": "/opt/boringssl",
+        "quiche_ROOT": "/opt/quiche",
+        "CMAKE_INSTALL_PREFIX": "/tmp/ats-quiche",
+        "ENABLE_QUICHE": true
+      }
+    },
+    {
+      "name": "ci-fedora-autest",
+      "displayName": "CI Fedora Quiche Autest",
+      "description": "CI Pipeline config for Fedora Linux (autest build)",
+      "inherits": ["ci-fedora", "autest"]
+    },
+    {
+      "name": "ci-freebsd",
+      "displayName": "CI Fedora",
+      "description": "CI Pipeline config for Fedora Linux",
+      "generator": "Unix Makefiles",
+      "binaryDir": "${sourceDir}/build-${presetName}",
+      "cacheVariables": {
+        "CMAKE_INSTALL_PREFIX": "/tmp/ats",
+        "BUILD_EXPERIMENTAL_PLUGINS": "ON"
+      }
+    },
+    {
+      "name": "ci-debian",
+      "displayName": "CI Debian Hardened Build",
+      "description": "CI Pipeline config for Debian with hardening flags",
+      "inherits": ["ci", "hardened"],
+      "cacheVariables": {
+        "OPENSSL_ROOT_DIR": "/opt/openssl-quic"
+      }
+    },
+    {
+      "name": "ci-ubuntu",
+      "displayName": "CI Ubuntu Hardened Build",
+      "description": "CI Pipeline config for Ubuntu with hardening flags",
+      "inherits": ["ci", "hardened"]
+    },
+    {
+      "name": "ci-clang-analyzer",
+      "displayName": "CI Clang Analyzer",
+      "description": "CI Pipeline config for running clang-analyzer",
+      "inherits": ["ci"],
+      "cacheVariables": {
+        "CMAKE_EXPORT_COMPILE_COMMANDS": "ON",
+        "ENABLE_CCACHE": "OFF",
+        "ENABLE_EXAMPLE": "OFF",
+        "BUILD_TESTING": "OFF"
+      }
+    },
+    {
+      "name": "branch",
+      "displayName": "CI branch defaults",
+      "inherits": ["ci"],
+      "binaryDir": "${sourceDir}/build",
+      "cacheVariables": {
+        "CMAKE_INSTALL_PREFIX": "/tmp/ats",
+        "BUILD_EXPERIMENTAL_PLUGINS": "ON"
+      }
+    },
+    {
+      "name": "branch-release",
+      "displayName": "CI branch release",
+      "inherits": ["branch"],
+      "cacheVariables": {
+        "CMAKE_BUILD_TYPE": "Release"
+      }
+    },
+    {
+      "name": "branch-debug",
+      "displayName": "CI branch debug",
+      "inherits": ["branch"],
       "cacheVariables": {
         "CMAKE_BUILD_TYPE": "Debug"
       }
     },
     {
-      "name": "asan",
+      "name": "branch-asan",
+      "description": "Inherit to enable asan, build feature",
       "hidden": true,
       "cacheVariables": {
         "CMAKE_CXX_FLAGS_DEBUG": "-g -fsanitize=address",
@@ -48,7 +260,8 @@
       }
     },
     {
-      "name": "lsan",
+      "name": "branch-lsan",
+      "description": "Inherit to enable lsan, build feature",
       "hidden": true,
       "cacheVariables": {
         "CMAKE_CXX_FLAGS_DEBUG": "-g -fsanitize=leak",
@@ -56,7 +269,8 @@
       }
     },
     {
-      "name": "tsan",
+      "name": "branch-tsan",
+      "description": "Inherit to enable tsan, build feature",
       "hidden": true,
       "cacheVariables": {
         "CMAKE_CXX_FLAGS_DEBUG": "-g -fsanitize=thread",
@@ -64,7 +278,8 @@
       }
     },
     {
-      "name": "hardened",
+      "name": "branch-hardened",
+      "description": "Inherit to enable hardening, build feature",
       "hidden": true,
       "cacheVariables": {
         "CMAKE_CXX_FLAGS": "-D_FORTIFY_SOURCE=2 -fPIE -fstack-protector",
@@ -72,10 +287,9 @@
       }
     },
     {
-      "name": "quiche",
-      "displayName": "CI Quiche",
-      "description": "CI Pipeline quiche build",
-      "inherits": ["ci"],
+      "name": "branch-quiche",
+      "displayName": "CI branch Quiche",
+      "inherits": ["branch"],
       "cacheVariables": {
         "ENABLE_AUTEST": "ON",
         "OPENSSL_ROOT_DIR": "/opt/boringssl",
@@ -84,42 +298,28 @@
       }
     },
     {
-      "name": "quic",
-      "displayName": "CI QUIC",
-      "description": "CI Pipeline quic build",
-      "inherits": ["ci"],
+      "name": "branch-quic",
+      "displayName": "CI branch QUIC",
+      "inherits": ["branch"],
       "cacheVariables": {
         "OPENSSL_ROOT_DIR": "/opt/openssl-quic"
       }
     },
     {
-      "name": "clang-analyzer",
-      "displayName": "CI Clang Analyzer",
-      "description": "CI Pipeline config for running clang-analyzer",
-      "inherits": ["ci"],
-      "cacheVariables": {
-        "BUILD_TESTING": "OFF",
-                               "CMAKE_EXPORT_COMPILE_COMMANDS": "ON",
-        "ENABLE_CCACHE": "OFF",
-        "ENABLE_EXAMPLE": "OFF"
-      }
-    },
-    {
-      "name": "autest",
-      "inherits": ["ci"],
-      "binaryDir": "${sourceDir}/build-autest",
+      "name": "branch-autest",
+      "displayName": "CI branch autest",
+      "inherits": ["branch"],
       "cacheVariables": {
         "ENABLE_AUTEST": "ON",
-        "BUILD_EXPERIMENTAL_PLUGINS": "ON",
         "ENABLE_EXAMPLE": "ON"
       }
     },
     {
-      "name": "coverity",
-      "displayName": "coverity defaults",
+      "name": "branch-coverity",
+      "displayName": "CI Branch coverity",
       "description": "Defaults for coverity builds",
       "generator": "Unix Makefiles",
-      "binaryDir": "${sourceDir}/build",
+      "inherits": ["branch"],
       "cacheVariables": {
         "CMAKE_BUILD_TYPE": "Debug",
         "BUILD_EXPERIMENTAL_PLUGINS": "ON",
@@ -127,15 +327,22 @@
       }
     },
     {
-      "name": "coverage",
-      "displayName": "coverage defaults",
-      "description": "Defaults for coverage builds",
-      "inherits": ["autest"],
+      "name": "branch-coverage",
+      "displayName": "CI Branch coverage",
+      "description": "Defaults for branch coverage builds",
+      "inherits": ["branch-autest"],
       "cacheVariables": {
         "CMAKE_CXX_FLAGS_DEBUG": "--coverage",
         "CMAKE_C_FLAGS_DEBUG": "--coverage"
       }
     }
+  ],
+  "buildPresets": [
+    {
+      "name": "autest",
+      "configurePreset": "autest",
+      "targets": ["autest"]
+    }
   ]
 }
 

Reply via email to