add build & tests

This commit is contained in:
Volodymyr Obozhyn 2024-01-21 02:08:41 +00:00
parent 2e312ded55
commit fbfcebb093

View file

@ -1,3 +1,4 @@
# https://open5gs.org/open5gs/docs/guide/02-building-open5gs-from-sources/
variables:
GITLAB_SHARED_RUNNER: rubik
@ -8,6 +9,54 @@ build-job:
script:
- echo "Hello, $GITLAB_USER_LOGIN! The runner with name rubik works fine, without any problems"
# Import the public key used by the package management system.
- apt update
#- cat /etc/os-release
- apt install gnupg
- curl -fsSL https://pgp.mongodb.com/server-7.0.asc | gpg -o /usr/share/keyrings/mongodb-server-7.0.gpg --dearmor
- touch /etc/apt/sources.list.d/mongodb-org-7.0.list # Create a /etc/apt/sources.list.d/mongodb-org-7.0.list file for MongoDB.
# On Debian (Bookworm)
- echo "deb [ signed-by=/usr/share/keyrings/mongodb-server-7.0.gpg ] http://repo.mongodb.org/apt/debian bookworm/mongodb-org/7.0 main" | tee /etc/apt/sources.list.d/mongodb-org-7.0.list
# Install the MongoDB packages
- apt update
- apt install -y mongodb-org
- apt install systemctl
- systemctl start mongod # (if '/usr/bin/mongod' is not running)
- systemctl enable mongod # (ensure to automatically start it on system boot)
# Install ip
- apt install -y iproute2
# fix RTNETLINK answers: Permission denied
- echo "net.ipv6.conf.all.disable_ipv6 = 0" | tee -a /etc/sysctl.conf
- echo "net.ipv6.conf.default.disable_ipv6 = 0" | tee -a /etc/sysctl.conf
- echo "net.ipv6.conf.lo.disable_ipv6 = 0" | tee -a /etc/sysctl.conf
- sysctl -p
# Create the TUN device with the interface name ogstun.
- ip tuntap add name ogstun mode tun
- ip addr add 10.45.0.1/16 dev ogstun
- ip addr add 2001:db8:cafe::1/48 dev ogstun
- ip link set ogstun up
# Install the dependencies for building the source code.
- apt install -y python3-pip python3-setuptools python3-wheel ninja-build build-essential flex bison git cmake libsctp-dev libgnutls28-dev libgcrypt-dev libssl-dev libidn11-dev libmongoc-dev libbson-dev libyaml-dev libnghttp2-dev libmicrohttpd-dev libcurl4-gnutls-dev libnghttp2-dev libtins-dev libtalloc-dev meson
# To compile with meson:
- cd $CI_PROJECT_DIR
- meson build --prefix=`pwd`/install
- ninja -C build
- ./build/tests/attach/attach ## EPC Only
- ./build/tests/registration/registration ## 5G Core Only
- cd build
- meson test -v
artifacts:
paths:
- $CI_PROJECT_DIR/
test-job1:
tags:
- $GITLAB_SHARED_RUNNER
@ -15,6 +64,13 @@ test-job1:
script:
- echo "This job tests something. The runner with name rubik works fine, without any problems"
- cd $CI_PROJECT_DIR
# Check whether the compilation is correct.
- ./build/tests/attach/attach ## EPC Only
- ./build/tests/registration/registration ## 5G Core Only
- cd build
- meson test -v
job_small:
script:
- echo "this job runs on the default (small) Linux instance. This runner wors fine. Without any problems"