Skip to content

Commit 6c4cc1c

Browse files
committed
ci: builders refactor and auxiliar scripts improved
1 parent cd214b5 commit 6c4cc1c

File tree

7 files changed

+70
-30
lines changed

7 files changed

+70
-30
lines changed

.gitlab/ci/build.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ variables:
5757
description: It will be passed to cmake
5858
value: ""
5959
MAKE_ARGS:
60-
description: It will be passed to make/ninja
60+
description: It will be passed to make
6161
value: ""
6262
UHD_VERSION:
6363
description: must be one version supported in the specified OS
@@ -179,7 +179,6 @@ variables:
179179
echo "${BUILD_CMD}"
180180
echo "============================================================================================="
181181
$BUILD_CMD
182-
cd build && ninja install && cd ..
183182
184183
if [[ -n "$OUTPUT_FINGERPRINT" ]]; then
185184
echo "Storing fingerprints of all executables to $OUTPUT_FINGERPRINT"

.gitlab/ci/builders/archlinux/Dockerfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ RUN pacman-key --init \
1111
&& pacman -Syu --noconfirm
1212
RUN install_dependencies.sh && pacman -Syu --noconfirm \
1313
git git-lfs \
14-
ninja clang \
15-
zeromq libuhd boost \
14+
clang \
1615
ccache valgrind libelf libdwarf \
1716
python-pip
1817
RUN git lfs install && pip install --break-system-packages gcovr==5.0

.gitlab/ci/builders/builder.sh

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ FOLDER=""
2626
BUILD_FOLDER="build"
2727
CACHE_FOLDER="ccache"
2828
CLEAN_BUILD="True"
29-
MAKE_EXTRA=""
29+
MAKE_EXTRA="-j $(nproc)"
3030
COMPILER="gcc"
3131
UHD_VERSION=""
3232

@@ -147,14 +147,18 @@ export CCACHE_BASEDIR=${PWD}
147147
export CCACHE_DIR=${PWD}/${CACHE_FOLDER}
148148
export CCACHE_COMPILERCHECK=content
149149

150-
# Build process
150+
# Clean build dir
151151
if [[ "$CLEAN_BUILD" == "True" ]]; then
152152
echo "Cleaning build directory: $BUILD_FOLDER"
153153
rm -Rf "$BUILD_FOLDER"
154154
else
155155
echo "Skip cleaning of build directory: $BUILD_FOLDER"
156156
fi
157+
# Use ccache if available
158+
(which ccache >/dev/null) && CCACHE_CMAKE_ARGS="-DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache" || CCACHE_CMAKE_ARGS=""
159+
160+
# Build process
157161
mkdir -p "$BUILD_FOLDER"
158162
cd "$BUILD_FOLDER" || exit
159-
cmake -G Ninja -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache "$@" ..
160-
ninja $MAKE_EXTRA
163+
cmake $CCACHE_CMAKE_ARGS "$@" ..
164+
make $MAKE_EXTRA

.gitlab/ci/builders/debian/Dockerfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ RUN chmod +x /usr/local/bin/install_dependencies.sh
88
RUN TZ=Europe/Madrid && ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
99
RUN install_dependencies.sh && apt-get install -y --no-install-recommends \
1010
git git-lfs \
11-
ninja-build clang llvm \
12-
libzmq3-dev libuhd-dev uhd-host libboost-program-options-dev \
11+
clang llvm \
1312
ccache gcovr valgrind libelf-dev libdwarf-dev \
1413
python3-dev python3-venv \
1514
&& apt-get autoremove && apt-get clean && rm -rf /var/lib/apt/lists/* && git lfs install

.gitlab/ci/builders/install_dependencies.sh

Lines changed: 49 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,65 @@
33
#
44
# This script will install srsran dependencies
55
#
6-
# Run like this: ./install_dependencies.sh
6+
# Run like this: ./install_dependencies.sh [<mode>]
77
# E.g.: ./install_dependencies
8+
# E.g.: ./install_dependencies build
9+
# E.g.: ./install_dependencies run
10+
# E.g.: ./install_dependencies extra
811
#
912

1013
main() {
1114

15+
# Check number of args
16+
if [ $# != 0 ] && [ $# != 1 ]; then
17+
echo >&2 "Illegal number of parameters"
18+
echo >&2 "Run like this: \"./install_dependencies.sh [<mode>]\" where mode could be: build, run and extra"
19+
echo >&2 "If mode is not specified, all dependencies will be installed"
20+
exit 1
21+
fi
22+
23+
local mode="${1:-all}"
24+
1225
. /etc/os-release
1326

27+
echo "== Installing srsRAN dependencies, mode $mode =="
28+
1429
if [[ "$ID" == "debian" || "$ID" == "ubuntu" ]]; then
15-
DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y --no-install-recommends \
16-
cmake make gcc g++ pkg-config libfftw3-dev libmbedtls-dev libsctp-dev libyaml-cpp-dev libgtest-dev
30+
if [[ "$mode" == "all" || "$mode" == "build" ]]; then
31+
DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y --no-install-recommends \
32+
cmake make gcc g++ pkg-config libfftw3-dev libmbedtls-dev libsctp-dev libyaml-cpp-dev libgtest-dev
33+
fi
34+
if [[ "$mode" == "all" || "$mode" == "run" ]]; then
35+
DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y --no-install-recommends \
36+
libfftw3-dev libmbedtls-dev libsctp-dev libyaml-cpp-dev libgtest-dev
37+
fi
38+
if [[ "$mode" == "all" || "$mode" == "extra" ]]; then
39+
DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y --no-install-recommends \
40+
libzmq3-dev libuhd-dev uhd-host libboost-program-options-dev
41+
fi
42+
1743
elif [[ "$ID" == "arch" ]]; then
18-
pacman -Syu --noconfirm cmake make base-devel fftw mbedtls yaml-cpp lksctp-tools gtest pkgconf
44+
if [[ "$mode" == "all" || "$mode" == "build" ]]; then
45+
pacman -Syu --noconfirm cmake make base-devel fftw mbedtls yaml-cpp lksctp-tools gtest pkgconf
46+
fi
47+
if [[ "$mode" == "all" || "$mode" == "run" ]]; then
48+
pacman -Syu --noconfirm fftw mbedtls yaml-cpp lksctp-tools gtest
49+
fi
50+
if [[ "$mode" == "all" || "$mode" == "extra" ]]; then
51+
pacman -Syu --noconfirm zeromq libuhd boost
52+
fi
53+
1954
elif [[ "$ID" == "rhel" ]]; then
20-
dnf -y install cmake fftw-devel lksctp-tools-devel yaml-cpp-devel mbedtls-devel gcc-toolset-11 gcc-toolset-11-gcc-c++
21-
cd /tmp && git clone https://github.com/google/googletest.git &&
22-
cd googletest &&
23-
mkdir build &&
24-
cd build &&
25-
cmake .. &&
26-
make -j $(nproc) && make -j $(nproc) install &&
27-
cd ../../ && rm -rf googletest
55+
if [[ "$mode" == "all" || "$mode" == "build" ]]; then
56+
dnf -y install cmake fftw-devel lksctp-tools-devel yaml-cpp-devel mbedtls-devel gcc-toolset-11 gcc-toolset-11-gcc-c++
57+
fi
58+
if [[ "$mode" == "all" || "$mode" == "run" ]]; then
59+
dnf -y install fftw-devel lksctp-tools-devel yaml-cpp-devel mbedtls-devel
60+
fi
61+
if [[ "$mode" == "all" || "$mode" == "extra" ]]; then
62+
dnf -y install cppzmq-devel libusb1-devel boost-devel
63+
fi
64+
2865
fi
2966

3067
}

.gitlab/ci/builders/rhel/Dockerfile

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,14 @@ RUN install_dependencies.sh && \
1313
ln -s /opt/rh/gcc-toolset-12/root/usr/bin/gcc /usr/bin/gcc && \
1414
ln -s /opt/rh/gcc-toolset-12/root/usr/bin/g++ /usr/bin/g++
1515

16-
# Install ninja
17-
RUN git clone https://github.com/ninja-build/ninja && \
18-
cd ninja && \
19-
cmake -Bbuild-cmake && cd ./build-cmake && \
20-
make -j `nproc` && make -j `nproc` install && \
21-
cd ../.. && rm -rf ninja
16+
# Install gtest
17+
RUN cd /tmp && git clone https://github.com/google/googletest.git && \
18+
cd googletest && \
19+
mkdir build && \
20+
cd build && \
21+
cmake .. && \
22+
make -j $(nproc) && make -j $(nproc) install && \
23+
cd ../../ && rm -rf googletest
2224

2325
# TODO: install python (including venv) to support changed_tests and ram_reporter scripts
2426

.gitlab/ci/trx.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ build trx driver:
5353
rm -Rf build
5454
mkdir build
5555
cd build
56-
cmake -G Ninja -DENABLE_TRX_DRIVER=True -DTRX_DRIVER_DIR=${CI_PROJECT_DIR}/amarisoft/trx_uhd-linux -DENABLE_EXPORT=True -DENABLE_UHD=False -DENABLE_ZEROMQ=True -DAUTO_DETECT_ISA=True -DENABLE_AVX512=False ..
57-
ninja trx_srsran_test
56+
cmake -DENABLE_TRX_DRIVER=True -DTRX_DRIVER_DIR=${CI_PROJECT_DIR}/amarisoft/trx_uhd-linux -DENABLE_EXPORT=True -DENABLE_UHD=False -DENABLE_ZEROMQ=True -DAUTO_DETECT_ISA=True -DENABLE_AVX512=False ..
57+
make trx_srsran_test
5858
}
5959
- |
6060
test_srsran_trx() {

0 commit comments

Comments
 (0)