Skip to content

Commit

Permalink
Update gitlab-ci.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
zinccyy committed Dec 14, 2022
1 parent 418d5ab commit 1d3d99d
Showing 1 changed file with 25 additions and 92 deletions.
117 changes: 25 additions & 92 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,103 +1,36 @@
image: "debian:sid"
image: debian

before_script:
- apt-get update
- apt-get -y install git clang cmake libcmocka0 libcmocka-dev valgrind libsystemd-dev libpcre2-dev

# prepare for building debian packages
#- apt-get -y install git build-essential fakeroot devscripts

# TODO: when libyang2 is available in Debian unstable
- git clone --depth=1 https://github.com/CESNET/libyang -b devel && cd libyang
- mkdir build && cd build
- cmake .. && make
- make install
#- mk-build-deps --install --tool 'apt-get --yes --no-install-recommends' --remove
#- dpkg-buildpackage -j$(nproc) --build=binary --root-command=fakeroot --unsigned-source --unsigned-changes
#- (dpkg -i ../libyang2*.deb || apt-get -y install -f) && cd ..

# TODO: when libyang2 is available in Debian unstable
- git clone --depth=1 https://github.com/sysrepo/sysrepo -b devel && cd sysrepo
- mkdir build && cd build
- cmake .. && make
- make install
#- mk-build-deps --install --tool 'apt-get --yes --no-install-recommends' --remove
#- dpkg-buildpackage -j$(nproc) --build=binary --root-command=fakeroot --unsigned-source --unsigned-changes
#- (dpkg -i ../sysrepo*.deb ../libsysrepo*.deb || apt-get -y install -f) && cd ..

# resolve time issues
- ln -snf /usr/share/zoneinfo/Europe/Zagreb /etc/localtime && echo 'Europe/Zagreb' > /etc/timezone
variables:
GIT_SUBMODULE_STRATEGY: recursive

stages:
- build
- test

build:default:
stage: build
script:
- mkdir build && cd build
- CC=clang cmake -DENABLE_BUILD_TESTS=ON -DSYSTEMD_IFINDEX=1 ..
- make
artifacts:
paths:
- build/

build:sanitized:
stage: build
script:
- mkdir build_sanitized && cd build_sanitized
- CC=clang cmake -DCMAKE_C_FLAGS=\"-fsanitize=address,undefined\" -DENABLE_SANITIZER=ON -DSYSTEMD_IFINDEX=1 ..
- make
artifacts:
paths:
- build_sanitized/

build:sanitized_memory:
# install libraries
before_script:
- apt-get update
- apt-get -y install clang cmake git libpcre2-dev libsystemd-dev
- apt-get -y install python3 python3-pip
- git clone https://github.com/CESNET/libyang.git
- git clone https://github.com/sysrepo/sysrepo.git
- git clone https://github.com/sartura/sysrepo-plugins-common.git
- git clone https://github.com/sartura/umgmt.git
- cd libyang; git checkout devel; mkdir build; cd build; cmake .. -DCMAKE_C_COMPILER=clang; make -j install; cd ../../
- cd sysrepo; git checkout devel; mkdir build; cd build; cmake .. -DCMAKE_C_COMPILER=clang; make -j install; cd ../../
- cd sysrepo-plugins-common; mkdir build; cd build; cmake .. -DCMAKE_C_COMPILER=clang; make -j install; cd ../..
- cd umgmt; mkdir build; cd build; cmake .. -DCMAKE_C_COMPILER=clang; make -j install; cd ../..
- pip3 install libyang
- pip3 install Jinja2

build:
stage: build
script:
- mkdir build_sanitized_memory && cd build_sanitized_memory
- CC=clang cmake -DCMAKE_C_FLAGS=\"-fsanitize=memory\" -DENABLE_SANITIZER=ON -DSYSTEMD_IFINDEX=1 ..
- make
artifacts:
paths:
- build_sanitized_memory/

test:default:
stage: test
needs: ["build:default"]
script:
- cd build
- ctest -T test --output-on-failure
artifacts:
paths:
- build/

test:sanitized:
stage: test
needs: ["build:sanitized"]
script:
- cd build_sanitized
- ctest -T test --output-on-failure
artifacts:
paths:
- build_sanitized/

test:sanitized_memory:
stage: test
needs: ["build:sanitized_memory"]
script:
- cd build_sanitized_memory
- ctest -T test --output-on-failure
artifacts:
paths:
- build_sanitized_memory/

test:valgrind:
stage: test
needs: ["build:default"]
script:
- cd build
- ctest -T memcheck
# build system plugin
- mkdir build
- cmake -DSYSTEMD_IFINDEX=1 -DCMAKE_C_COMPILER=clang -S . -B build/
- make -j

artifacts:
paths:
- build/

0 comments on commit 1d3d99d

Please sign in to comment.