You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by bn...@apache.org on 2023/12/13 14:18:21 UTC

(trafficserver-ci) branch main updated: add check for override cmake presets, clean up nproc (#305)

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 c5ea065  add check for override cmake presets, clean up nproc (#305)
c5ea065 is described below

commit c5ea065c7cd730e9228a3eb5e0b8ffd40f67c7af
Author: Brian Olsen <bn...@gmail.com>
AuthorDate: Wed Dec 13 07:18:15 2023 -0700

    add check for override cmake presets, clean up nproc (#305)
---
 jenkins/bin/clang-analyzer.sh       |  3 +++
 jenkins/bin/cmake_basic.sh          | 22 ++++++++++------------
 jenkins/bin/format.sh               | 12 ++++++++++--
 jenkins/branch/autest.pipeline      |  6 ++++--
 jenkins/branch/cache-tests.pipeline |  9 +++++----
 jenkins/branch/coverage.pipeline    | 10 ++++++----
 jenkins/branch/coverity.pipeline    | 11 +++++++++--
 jenkins/branch/freebsd.pipeline     | 13 +++++++++++--
 jenkins/branch/osx-m1.pipeline      | 16 ++++++++++++----
 jenkins/branch/osx.pipeline         | 13 +++++++++++--
 10 files changed, 81 insertions(+), 34 deletions(-)

diff --git a/jenkins/bin/clang-analyzer.sh b/jenkins/bin/clang-analyzer.sh
index 2ee684a..5a45ed7 100755
--- a/jenkins/bin/clang-analyzer.sh
+++ b/jenkins/bin/clang-analyzer.sh
@@ -34,6 +34,7 @@ mkdir -p ${RPTDIR}
 
 if [ -d cmake ]
 then
+  echo "Building with CMake"
 
   # copy in CMakePresets.json
   presetpath="${WORKSPACE}/ci/jenkins/branch/CMakePresets.json"
@@ -55,6 +56,8 @@ then
     --html-title="clang-analyzer: ${GITHUB_BRANCH}"
 
 else
+  echo "Building with autotools"
+
   autoreconf -fiv
   ${SCAN_BUILD} --keep-cc \
     ./configure --enable-experimental-plugins --with-luajit
diff --git a/jenkins/bin/cmake_basic.sh b/jenkins/bin/cmake_basic.sh
index 7da0935..2d9e33b 100755
--- a/jenkins/bin/cmake_basic.sh
+++ b/jenkins/bin/cmake_basic.sh
@@ -20,7 +20,7 @@
 
 set -x
 
-NPROC=`nproc`
+NPROC=$(nproc)
 
 if [ ! -d cmake ]
 then
@@ -30,17 +30,15 @@ fi
 
 cd "${WORKSPACE}/src"
 
-cmake -B cmake-build-release\
-  -GNinja \
-  -DCMAKE_COMPILE_WARNING_AS_ERROR=ON \
-  -DCMAKE_BUILD_TYPE=Release \
-  -DBUILD_EXPERIMENTAL_PLUGINS=ON \
-  -DCMAKE_INSTALL_PREFIX=/tmp/ats
-#  -DOPENSSL_ROOT_DIR=/opt/openssl-quic
-cmake --build cmake-build-release -j${NPROC} -v
-cmake --install cmake-build-release
-
-pushd cmake-build-release
+# copy in CMakePresets.json
+presetpath="${WORKSPACE}/ci/jenkins/branch/CMakePresets.json"
+[ -f "${presetpath}" ] && /bin/cp -f "${presetpath}" .
+
+cmake -B build --preset=branch-release
+cmake --build build -j${NPROC} -v
+cmake --install build
+
+pushd build
 ctest -j${NPROC} --output-on-failure --no-compress-output -T Test
 /tmp/ats/bin/traffic_server -K -k -R 1
 popd
diff --git a/jenkins/bin/format.sh b/jenkins/bin/format.sh
index 716bfd4..0aef7f4 100755
--- a/jenkins/bin/format.sh
+++ b/jenkins/bin/format.sh
@@ -43,13 +43,21 @@ echo "Success! No DOS carriage return"
 
 set -x
 
+NPROC=$(nproc)
+
 if [ -d cmake ]
 then
+  echo "Building with CMake"
+
+  presetpath="${WORKSPACE}/ci/jenkins/branch/CMakePresets.json"
+  [ -f "${presetpath}" ] && /bin/cp -f "${presetpath}" .
 
-  cmake -B build
-	cmake --build build --target format -j`nproc` -v || exit 1
+  cmake -B build --preset=branch
+  cmake --build build --target format -j${NPROC} -v || exit 1
 
 else
+  echo "Building with autotools"
+
   autoreconf -if
   ./configure
 
diff --git a/jenkins/branch/autest.pipeline b/jenkins/branch/autest.pipeline
index 3b033ff..31be194 100644
--- a/jenkins/branch/autest.pipeline
+++ b/jenkins/branch/autest.pipeline
@@ -87,6 +87,8 @@ pipeline {
 						# depend upon this, so update the PATH accordingly.
 						export PATH=/opt/bin:${PATH}
 
+						NPROC=$(nproc)
+
 						if [ -d cmake ]
 						then
 							echo "Building with CMake"
@@ -95,7 +97,7 @@ pipeline {
 							[ -f "${presetpath}" ] && cp -f "${presetpath}" .
 
 							cmake -B build --preset branch-autest
-							cmake --build build -j`nproc` -v
+							cmake --build build -j${NPROC} -v
 							cmake --install build -v
 
 						else
@@ -113,7 +115,7 @@ pipeline {
 								--enable-wccp \
 								--enable-luajit \
 								--enable-ccache
-							make -j`nproc`
+							make -j${NPROC}
 							make install
 
 						fi
diff --git a/jenkins/branch/cache-tests.pipeline b/jenkins/branch/cache-tests.pipeline
index b89ee03..e06bbab 100644
--- a/jenkins/branch/cache-tests.pipeline
+++ b/jenkins/branch/cache-tests.pipeline
@@ -55,16 +55,17 @@ pipeline {
 							export PATH=/opt/bin:${PATH}
 							chmod -R o+r .
 
+							NPROC=$(nproc)
+
 							if [ -d cmake ]
 							then
-								cmake -B build \
-									-DCMAKE_INSTALL_PREFIX=/opt/ats
-								cmake --build build -j`nproc` -v
+								cmake -B build -DCMAKE_INSTALL_PREFIX=/opt/ats
+								cmake --build build -j${NPROC} -v
 								cmake --install build
 							else
 								autoreconf -fiv
 								./configure --prefix=/opt/ats --enable-ccache
-								make -j`nproc`
+								make -j${NPROC}
 								make install
 							fi
 
diff --git a/jenkins/branch/coverage.pipeline b/jenkins/branch/coverage.pipeline
index 1346935..e51afbb 100644
--- a/jenkins/branch/coverage.pipeline
+++ b/jenkins/branch/coverage.pipeline
@@ -80,15 +80,17 @@ pipeline {
 						# (default user umask may change and make these unreadable)
 						sudo chmod -R o+r .
 
+						NPROC=$(nproc)
+
 						if [ -d cmake ]
 						then
 							echo "Building with CMake"	
 
 							presetpath="../ci/jenkins/branch/CMakePresets.json"
-              [ -f "${presetpath}" ] && /bin/cp -f "${presetpath}" .
+							[ -f "${presetpath}" ] && /bin/cp -f "${presetpath}" .
 
-							cmake -B build --preset branch-coverage -DCMAKE_INSTALL_PREFIX="/tmp/ats"
-							cmake --build build -j`nproc` -v
+							cmake -B build --preset branch-coverage
+							cmake --build build -j${NPROC} -v
 							cmake --install build -v
 
 						else
@@ -105,7 +107,7 @@ pipeline {
 								--enable-luajit \
 								--enable-ccache \
 								--enable-coverage
-							make -j`nproc` V=1 Q=
+							make -j${NPROC} V=1 Q=
 							make install
 						fi
 					'''
diff --git a/jenkins/branch/coverity.pipeline b/jenkins/branch/coverity.pipeline
index 5e72cf6..0c59a89 100644
--- a/jenkins/branch/coverity.pipeline
+++ b/jenkins/branch/coverity.pipeline
@@ -38,20 +38,27 @@ pipeline {
 						tar -xvzf coverity_tool.tgz -C cov_tools --strip-components 1
 						set -x
 
+						NPROC=$(nproc)
+
 						if [ -d cmake ]
 						then
+							echo "Building with CMake"
+
 							presetpath="../ci/jenkins/branch/CMakePresets.json"
 							[ -f "${presetpath}" ] && /bin/cp -f "${presetpath}" .
+
 							cmake -B build --preset branch-coverity
 							pushd build
-						  ../cov_tools/bin/cov-build --dir ../cov-int make -j`nproc`
+						  ../cov_tools/bin/cov-build --dir ../cov-int make -j${NPROC}
 							popd
 						else
+							echo "Building with autotools"
+
 							autoreconf -fiv
 							./configure \
 								--enable-experimental-plugins \
 								--enable-example-plugins
-						  ./cov_tools/bin/cov-build --dir cov-int make -j`nproc`
+						  ./cov_tools/bin/cov-build --dir cov-int make -j${NPROC}
 						fi
 
 						tar czvf trafficserver.tgz cov-int
diff --git a/jenkins/branch/freebsd.pipeline b/jenkins/branch/freebsd.pipeline
index 1344880..415482d 100644
--- a/jenkins/branch/freebsd.pipeline
+++ b/jenkins/branch/freebsd.pipeline
@@ -28,14 +28,23 @@ pipeline {
 						set -x
 						set -e
 
+						NPROC=$(nproc)
+
 						if [ -d cmake ]
 						then
+							echo "Building with CMake"
+
+							presetpath="../ci/jenkins/branch/CMakePresets.json"
+							[ -f "${presetpath}" ] && cp -f "${presetpath}" .
+
 							cmake -B build --preset=branch-freebsd
-							cmake --build build -j`nproc` -v
+							cmake --build build -j${NPROC} -v
 						else
+							echo "Building with autotools"
+
 							autoreconf -fiv
 							./configure --enable-experimental-plugins
-							gmake -j3
+							gmake -j${NPROC}
 						fi
 					'''
 				}
diff --git a/jenkins/branch/osx-m1.pipeline b/jenkins/branch/osx-m1.pipeline
index 84e743b..07764a9 100644
--- a/jenkins/branch/osx-m1.pipeline
+++ b/jenkins/branch/osx-m1.pipeline
@@ -28,23 +28,31 @@ pipeline {
 						set -x
 						set -e
 
+						NPROC=3
+
 						if [ -d cmake ]
 						then
+							echo "Building with CMake"
+
+							presetpath="../ci/jenkins/branch/CMakePresets.json"
+							[ -f "${presetpath}" ] && cp -f "${presetpath}" .
+
 							CC="clang" \
 								CXX="clang++" \
 								CXXFLAGS="-Qunused-arguments" \
 								WITH_LIBCPLUSPLUS="yes" \
 								cmake -B build --preset=branch-osx-m1
-							cmake --build build -j3 -v
+							cmake --build build -j${NPROC} -v
 						else
+							echo "Building with autotools"
+
 							autoreconf -fiv
 							CC="clang" \
 							CXX="clang++" \
 							CXXFLAGS="-Qunused-arguments" \
 							WITH_LIBCPLUSPLUS="yes" \
-							./configure \
-								--with-openssl=/opt/homebrew/opt/openssl
-							make -j3
+							./configure --with-openssl=/opt/homebrew/opt/openssl
+							make -j${NPROC}
 						fi
 					'''
 				}
diff --git a/jenkins/branch/osx.pipeline b/jenkins/branch/osx.pipeline
index 97cb67e..bff0f65 100644
--- a/jenkins/branch/osx.pipeline
+++ b/jenkins/branch/osx.pipeline
@@ -28,15 +28,24 @@ pipeline {
 						set -x
 						set -e
 
+						NPROC=3
+
 						if [ -d cmake ]
 						then
+							echo "Building with CMake"
+
+							presetpath="../ci/jenkins/branch/CMakePresets.json"
+							[ -f "${presetpath}" ] && cp -f "${presetpath}" .
+
 							CC="clang" \
 								CXX="clang++" \
 								CXXFLAGS="-Qunused-arguments" \
 								WITH_LIBCPLUSPLUS="yes" \
 								cmake -B build --preset branch-osx
-								cmake --build build -j3 -v
+							cmake --build build -j${NPROC} -v
 						else
+							echo "Building with autotools"
+
 							autoreconf -fiv
 							CC="clang" \
 								CXX="clang++" \
@@ -45,7 +54,7 @@ pipeline {
 								./configure \
 								--enable-experimental-plugins \
 								--with-openssl=/usr/local/opt/openssl
-							make -j3
+							make -j${NPROC}
 						fi
 					'''
 				}