Skip to content
Snippets Groups Projects
Commit 8f010758 authored by Raphael Defosseux's avatar Raphael Defosseux
Browse files

chore(ci): adding CTests run

parent 7c424e88
No related branches found
No related tags found
No related merge requests found
Pipeline #42586 passed
#/*
# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
# * contributor license agreements. See the NOTICE file distributed with
# * this work for additional information regarding copyright ownership.
# * The OpenAirInterface Software Alliance licenses this file to You under
# * the OAI Public License, Version 1.1 (the "License"); you may not use this file
# * except in compliance with the License.
# * You may obtain a copy of the License at
# *
# * http://www.openairinterface.org/?page_id=698
# *
# * Unless required by applicable law or agreed to in writing, software
# * distributed under the License is distributed on an "AS IS" BASIS,
# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# * See the License for the specific language governing permissions and
# * limitations under the License.
# *-------------------------------------------------------------------------------
# * For more information about the OpenAirInterface (OAI) Software Alliance:
# * contact@openairinterface.org
# */
#
#---------------------------------------------------------------------
#
# Dockerfile for the Open-Air-Interface AMF service
# Valid for Ubuntu-22.04 (jammy)
#
#---------------------------------------------------------------------
# BUILDER IMAGE
#---------------------------------------------------------------------
ARG BASE_IMAGE=ubuntu:jammy
FROM $BASE_IMAGE AS oai-flexric-base
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Europe/Paris
#install developers pkg/repo
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get upgrade --yes && \
DEBIAN_FRONTEND=noninteractive apt-get install --yes \
build-essential \
libsctp-dev \
git \
wget \
tar \
m4 \
automake \
libtool \
python3 \
cmake \
cmake-curses-gui \
bison \
flex \
gdb \
libpcre2-dev \
python3-dev \
python3-pip \
gcc-12 \
g++-12 \
mold \
ninja-build && \
apt-get clean
RUN git clone https://github.com/swig/swig.git && \
cd swig && \
git checkout release-4.1 && \
./autogen.sh && \
./configure --prefix=/usr/ && \
make -j8 && \
make install && \
ldconfig
FROM oai-flexric-base as oai-flexric-builder
WORKDIR /flexric
COPY . .
RUN mkdir build && \
cd build && \
cmake -GNinja \
-DCMAKE_C_COMPILER=gcc-12 \
-DCMAKE_CXX_COMPILER=g++-12 \
-DCMAKE_EXE_LINKER_FLAGS="-fuse-ld=mold -z execstack" \
-DCMAKE_SHARED_LINKER_FLAGS="-fuse-ld=mold -z execstack" \
.. && \
ninja && \
ninja install && \
ctest -j8 --output-on-failure
......@@ -155,6 +155,26 @@ pipeline {
}
}
stage ('Running CTests') {
steps {
lock(ubuntuBuildResource) {
script {
gitlabCommitStatus(name: "Running CTests") {
sh "docker image rm oai-flexric-ctest:${flexric_tag} || true"
sh "docker buildx build --target oai-flexric-builder --tag oai-flexric-ctest:${flexric_tag} --file ci-scripts/Dockerfile.ctest . > archives/flexric_ctests.log 2>&1"
}
}
}
}
post {
cleanup {
script {
sh "docker image rm oai-flexric-ctest:${flexric_tag} || true"
}
}
}
}
// We are only publishing the Ubuntu image to Docker-Hub
// For Post-Merge events.
// Temporary Images from Merge-Request Runs are kept in local private registry
......
......@@ -33,6 +33,10 @@ from common.python.generate_html import (
generate_header,
generate_footer,
generate_git_info,
generate_chapter,
generate_list_header,
generate_list_footer,
generate_list_row,
)
from common.python.code_format_checker import (
......@@ -49,6 +53,40 @@ from common.python.building_report import (
REPORT_NAME = 'test_results_oai_flexric.html'
def ctest_summary(args, reportName):
cwd = os.getcwd()
status = True
chapterName = 'CTests Summary'
summary = ''
if os.path.isfile(f'{cwd}/archives/{reportName}'):
status = True
section_start_pattern = 'Test project /flexric/build'
section_end_pattern = 'Total Test time'
section_status = False
summary = generate_list_header()
with open(f'{cwd}/archives/{reportName}', 'r') as logfile:
for line in logfile:
if re.search(section_start_pattern, line) is not None and not section_status:
section_status = True
if section_status and re.search(section_end_pattern, line) is not None:
section_status = False
if section_status:
result = re.search('(Test *#[0-9]+: Unit_test_[A-Za-z0-9_]+) [\.]+', line)
passed = re.search('Passed', line)
if result is not None and passed is not None:
summary += generate_list_row(result.group(1), 'thumbs-up')
elif result is not None:
summary += generate_list_row(result.group(1), 'thumbs-down')
summary += generate_list_footer()
else:
summary = generate_chapter(chapterName, 'CTests report file not found! Not run?', False)
return summary
if status:
summary = generate_chapter(chapterName, 'All CTests passed', True) + summary
else:
summary = generate_chapter(chapterName, 'Some CTests failed', False) + summary
return summary
class HtmlReport():
def __init__(self):
pass
......@@ -59,6 +97,7 @@ class HtmlReport():
wfile.write(generate_header(args))
wfile.write(generate_git_info(args))
wfile.write(build_summary(args, 'flexric', '22', 'N/A'))
wfile.write(ctest_summary(args, 'flexric_ctests.log'))
wfile.write(generate_footer())
if __name__ == '__main__':
......
......@@ -54,7 +54,10 @@ RUN apt-get update && \
libpcre2-dev \
python3-dev \
python3-pip \
gcc-12 && \
gcc-12 \
g++-12 \
mold \
ninja-build && \
apt-get clean
RUN git clone https://github.com/swig/swig.git && \
......@@ -73,9 +76,9 @@ COPY . .
RUN mkdir build && \
cd build && \
cmake -DCMAKE_C_COMPILER=gcc-12 .. && \
make -j8 && \
make install && \
cmake -GNinja -DCMAKE_C_COMPILER=gcc-12 .. && \
ninja && \
ninja install && \
echo "--- Check shared objects dependencies for executable nearRT-RIC ---" && \
ldd /flexric/build/examples/ric/nearRT-RIC && \
echo "--- Check shared objects dependencies for xApp shared library ---" && \
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment