Commit 0f2b3338 authored by Steffen Vogel's avatar Steffen Vogel 🎅🏼 Committed by Steffen Vogel

ci: multiplatform builds

parent bd6482e3
......@@ -8,6 +8,7 @@ variables:
DOCKER_IMAGE: registry.git.rwth-aachen.de/acs/public/villas/node
DOCKER_IMAGE_DEV: ${DOCKER_IMAGE}/dev-${DISTRO}
DOCKER_CLI_EXPERIMENTAL: enabled
DOCKER_PLATFORMS: amd64 armv7 arm64
MAKE_OPTS: "-j16"
RELEASEVER: "33"
......@@ -17,10 +18,7 @@ stages:
- test
- packaging
- deploy
# For some reason, GitLab CI prunes the contents of the submodules so we need to restore them.
before_script:
- git submodule foreach git checkout .
- deploy2
# Stage: prepare
##############################################################################
......@@ -28,14 +26,14 @@ before_script:
# Build docker image which is used to build & test VILLASnode
.prepare:docker-dev: &prepare_docker_dev
stage: prepare
image: docker:19.03
script:
- docker buildx build ${DOCKER_OPTS}
- docker build ${DOCKER_OPTS}
--file ${DOCKER_FILE}
--tag ${DOCKER_IMAGE_DEV}:${DOCKER_TAG}
--target dev .
tags:
- shell
- linux
- docker
prepare:fedora:x86_64:
<<: *prepare_docker_dev
......@@ -188,105 +186,128 @@ build:docs:
# Stage: test
##############################################################################
test:flake8:
stage: test
script:
- flake8 python/
image: ${DOCKER_IMAGE}/dev:${DOCKER_TAG}
tags:
- docker
# test:flake8:
# stage: test
# script:
# - flake8 python/
# image: ${DOCKER_IMAGE}/dev:${DOCKER_TAG}
# tags:
# - docker
# test:cppcheck:
# stage: test
# script:
# - cppcheck -j $(nproc)
# --max-configs=32
# --error-exitcode=1
# --quiet
# --inline-suppr
# --enable=warning,performance,portability,information,missingInclude
# --std=c++11
# --suppress=noValidConfiguration
# -I include
# -I common/include
# src/ lib/ tests/unit/ | tee cppcheck.log
# image: ${DOCKER_IMAGE}/dev:${DOCKER_TAG}
# needs:
# - job: build:fedora:x86_64
# tags:
# - docker
# artifacts:
# when: on_failure
# paths:
# - cppcheck.log
# expose_as: cppcheck
# test:unit:
# stage: test
# needs:
# - job: build:fedora:x86_64
# variables:
# LD_PRELOAD: /usr/lib64/libSegFault.so
# SEGFAULT_SIGNALS: all
# SEGFAULT_SIGNALS: bus abrt
# script:
# - mkdir -p build && cd build
# - cmake ${CMAKE_OPTS} ..
# - make ${MAKE_OPTS} run-unit-tests
# image: ${DOCKER_IMAGE}/dev:${DOCKER_TAG}
# tags:
# - docker
# test:integration:
# stage: test
# allow_failure: true
# needs:
# - job: build:fedora:x86_64
# script:
# - mkdir -p build && cd build
# - cmake ${CMAKE_OPTS} ..
# - make ${MAKE_OPTS} run-integration-tests
# artifacts:
# name: ${CI_PROJECT_NAME}-integration-tests-${CI_BUILD_REF}
# when: always
# paths:
# - build/tests/integration/
# image: ${DOCKER_IMAGE}/dev:${DOCKER_TAG}
# tags:
# - docker
test:cppcheck:
stage: test
script:
- cppcheck -j $(nproc)
--max-configs=32
--error-exitcode=1
--quiet
--inline-suppr
--enable=warning,performance,portability,information,missingInclude
--std=c++11
--suppress=noValidConfiguration
-I include
-I common/include
src/ lib/ tests/unit/ | tee cppcheck.log
image: ${DOCKER_IMAGE}/dev:${DOCKER_TAG}
needs:
- job: build:fedora:x86_64
tags:
- docker
artifacts:
when: on_failure
paths:
- cppcheck.log
expose_as: cppcheck
# Stage: packaging
##############################################################################
test:unit:
stage: test
needs:
- job: build:fedora:x86_64
variables:
LD_PRELOAD: /usr/lib64/libSegFault.so
SEGFAULT_SIGNALS: all
SEGFAULT_SIGNALS: bus abrt
script:
- mkdir -p build && cd build
- cmake ${CMAKE_OPTS} ..
- make ${MAKE_OPTS} run-unit-tests
packaging:rpm:
stage: packaging
image: ${DOCKER_IMAGE}/dev:${DOCKER_TAG}
tags:
- docker
test:integration:
stage: test
allow_failure: true
needs:
- job: build:fedora:x86_64
script:
- mkdir -p build && cd build
- cmake ${CMAKE_OPTS} ..
- make ${MAKE_OPTS} run-integration-tests
- cmake -DWITH_NODE_ETHERCAT=OFF ..
- make ${MAKE_OPTS} doc
- make ${MAKE_OPTS} package
artifacts:
name: ${CI_PROJECT_NAME}-integration-tests-${CI_BUILD_REF}
when: always
expire_in: 1 week
name: ${CI_PROJECT_NAME}-packages-${CI_BUILD_REF}
paths:
- build/tests/integration/
image: ${DOCKER_IMAGE}/dev:${DOCKER_TAG}
- build/*.tar.gz
- build/*.rpm
tags:
- docker
# Stage: packaging
##############################################################################
packaging:docker:
.packaging:docker: &packaging_docker
stage: packaging
image: docker:19.03
script:
- mkdir -p ~/.docker/cli-plugins/
- wget -O ~/.docker/cli-plugins/docker-buildx https://github.com/docker/buildx/releases/download/v0.4.2/buildx-v0.4.2.linux-amd64
- chmod a+x ~/.docker/cli-plugins/docker-buildx
- docker buildx build
--target app
--platform ${PLATFORM}
--file packaging/docker/Dockerfile.alpine
--tag ${DOCKER_IMAGE}:${DOCKER_TAG} .
tags:
- docker
needs: []
packaging:rpm:
stage: packaging
needs:
- job: build:fedora:x86_64
script:
- mkdir -p build && cd build
- cmake -DWITH_NODE_ETHERCAT=OFF ..
- make ${MAKE_OPTS} doc
- make ${MAKE_OPTS} package
artifacts:
expire_in: 1 week
name: ${CI_PROJECT_NAME}-packages-${CI_BUILD_REF}
paths:
- build/*.tar.gz
- build/*.rpm
image: ${DOCKER_IMAGE}/dev:${DOCKER_TAG}
tags:
- docker
packaging:docker:amd64:
<<: *packaging_docker
variables:
PLATFORM: linux/amd64
DOCKER_TAG: ${CI_COMMIT_REF_NAME}-amd64
packaging:docker:arm64:
<<: *packaging_docker
variables:
PLATFORM: linux/arm64
DOCKER_TAG: ${CI_COMMIT_REF_NAME}-arm64
packaging:docker:armv7:
<<: *packaging_docker
variables:
PLATFORM: linux/arm/v7
DOCKER_TAG: ${CI_COMMIT_REF_NAME}-armv7
# Stage: deploy
##############################################################################
......@@ -335,39 +356,47 @@ deploy:packages:tags:
# Only on version tags
- "/^v\\d+(\\.\\d+)+$/"
.deploy:docker: &deploy_docker
deploy:docker:
stage: deploy
image: docker:19.03
variables:
DOCKER_CLI_EXPERIMENTAL: enabled
before_script:
- docker login -u ${CI_REGISTRY_USER} -p ${CI_REGISTRY_PASSWORD} ${CI_REGISTRY}
.deploy:docker:latest: &deploy_docker_latest
<<: *deploy_docker
needs:
- packaging:docker:amd64
- packaging:docker:armv7
- packaging:docker:arm64
script:
- docker tag ${DOCKER_IMAGE}:${DOCKER_TAG} ${DOCKER_IMAGE}:latest
- docker tag ${DOCKER_IMAGE}/dev:${DOCKER_TAG} ${DOCKER_IMAGE}/dev:latest
- docker push ${DOCKER_IMAGE}:latest
- docker push ${DOCKER_IMAGE}/dev:latest
- docker push ${DOCKER_IMAGE}/dev:${DOCKER_TAG}
- for PF in ${DOCKER_PLATFORMS}; do
docker push ${DOCKER_IMAGE}:${DOCKER_TAG}-${PF};
done
- docker manifest create ${DOCKER_IMAGE}:${DOCKER_TAG}
${DOCKER_IMAGE}:${DOCKER_TAG}-amd64
${DOCKER_IMAGE}:${DOCKER_TAG}-arm64
${DOCKER_IMAGE}:${DOCKER_TAG}-armv7
- docker manifest push ${DOCKER_IMAGE}:${DOCKER_TAG}
tags:
- docker
deploy:docker:manual:
<<: *deploy_docker_latest
when: manual
deploy:docker:tags:
<<: *deploy_docker_latest
only:
# Only on version tags
- "/^v\\d+(\\.\\d+)+$/"
# Stage: deploy2
##############################################################################
deploy:docker:tags:
<<: *deploy_docker
deploy:docker:latest:
stage: deploy2
image: docker:19.03
before_script:
- docker login -u ${CI_REGISTRY_USER} -p ${CI_REGISTRY_PASSWORD} ${CI_REGISTRY}
needs:
- deploy:docker
script:
- docker push ${DOCKER_IMAGE}:${DOCKER_TAG}
- docker push ${DOCKER_IMAGE}/dev:${DOCKER_TAG}
- docker tag ${DOCKER_IMAGE}:${DOCKER_TAG} ${DOCKER_IMAGE}:latest
- docker push ${DOCKER_IMAGE}:latest
- docker tag ${DOCKER_IMAGE}/dev:${DOCKER_TAG} ${DOCKER_IMAGE}/dev:latest
- docker push ${DOCKER_IMAGE}/dev:latest
tags:
- docker
only:
# Only on version tags
- "/^v\\d+(\\.\\d+)+$/"
- master
......@@ -125,7 +125,12 @@ if(NOT RE_FOUND)
endif()
# Check if libwebsockets is build with deflate extension
FindSymbol(${LIBWEBSOCKETS_LINK_LIBRARIES} lws_extension_callback_pm_deflate LWS_DEFLATE_FOUND)
if(${CMAKE_VERSION} VERSION_LESS "3.12.4")
set(LWS_LOCATION "${LIBWEBSOCKETS_LIBRARY_DIRS}/lib${LIBWEBSOCKETS_LIBRARIES}.so")
else()
set(LWS_LOCATION ${LIBWEBSOCKETS_LINK_LIBRARIES})
endif()
FindSymbol(${LWS_LOCATION} lws_extension_callback_pm_deflate LWS_DEFLATE_FOUND)
# Build options
cmake_dependent_option(WITH_HOOKS "Build with support for processing hook plugins" ON "" OFF)
......
......@@ -125,8 +125,7 @@ endif()
if(WITH_NODE_COMEDI)
list(APPEND NODE_SRC comedi.cpp)
list(APPEND INCLUDE_DIRS ${COMEDILIB_INCLUDE_DIRS})
list(APPEND LIBRARY_DIRS ${COMEDILIB_LIBDIR})
list(APPEND LIBRARIES ${COMEDILIB_LIBRARIES})
list(APPEND LIBRARIES ${COMEDILIB_LDFLAGS})
endif()
# Enable Infiniband support
......@@ -170,5 +169,4 @@ endif()
add_library(nodes STATIC ${NODE_SRC})
target_include_directories(nodes PUBLIC ${INCLUDE_DIRS})
target_link_directories(nodes PUBLIC ${LIBRARY_DIRS})
target_link_libraries(nodes PUBLIC ${LIBRARIES})
......@@ -8,6 +8,9 @@ TRIPLET=${TRIPLET:-x86_64-linux-gnu}
CONFIGURE_OPTS+=" --host=${TRIPLET} --prefix=${PREFIX}"
CMAKE_OPTS+=" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${PREFIX}"
git config --global http.postBuffer 524288000
git config --global core.compression 0
if [ -n "${PACKAGE}" ]; then
TARGET="package"
CMAKE_OPTS+=" -DCPACK_GENERATOR=RPM"
......@@ -30,10 +33,9 @@ pushd ${DIR}
if ! pkg-config "criterion >= 2.3.1" && \
[ "${ARCH}" == "x86_64" ] && \
[ -z "${SKIP_CRITERION}" ]; then
git clone --recursive https://github.com/Snaipe/Criterion
git clone --branch v2.3.3 --depth 1 --recursive https://github.com/Snaipe/Criterion
mkdir -p Criterion/build
pushd Criterion/build
git checkout v2.3.3
cmake ${CMAKE_OPTS} ..
if [ -z "${PACKAGE}" ]; then
make -j$(nproc) install
......@@ -60,10 +62,9 @@ fi
# Build & Install Fmtlib
if ! pkg-config "fmt >= 6.1.2" && \
[ -z "${SKIP_FMTLIB}" ]; then
git clone --recursive https://github.com/fmtlib/fmt.git
git clone --branch 6.1.2 --depth 1 --recursive https://github.com/fmtlib/fmt.git
mkdir -p fmt/build
pushd fmt/build
git checkout 6.1.2
cmake -DBUILD_SHARED_LIBS=1 ${CMAKE_OPTS} ..
make -j$(nproc) ${TARGET}
if [ -n "${PACKAGE}" ]; then
......@@ -75,10 +76,9 @@ fi
# Build & Install spdlog
if ! pkg-config "spdlog >= 1.5.0" && \
[ -z "${SKIP_SPDLOG}" ]; then
git clone --recursive https://github.com/gabime/spdlog.git
git clone --branch v1.5.0 --depth 1 --recursive https://github.com/gabime/spdlog.git
mkdir -p spdlog/build
pushd spdlog/build
git checkout v1.5.0
cmake -DSPDLOG_FMT_EXTERNAL=ON -DSPDLOG_BUILD_BENCH=OFF -DSPDLOG_BUILD_SHARED=ON ${CMAKE_OPTS} ..
make -j$(nproc) ${TARGET}
if [ -n "${PACKAGE}" ]; then
......@@ -90,10 +90,9 @@ fi
# Build & Install libiec61850
if ! pkg-config "libiec61850 >= 1.3.1" && \
[ -z "${SKIP_LIBIEC61850}" ]; then
git clone https://github.com/mz-automation/libiec61850
git clone --branch v1.4 --depth 1 https://github.com/mz-automation/libiec61850
mkdir -p libiec61850/build
pushd libiec61850/build
git checkout v1.4
cmake ${CMAKE_OPTS} ..
make -j$(nproc) ${TARGET}
if [ -n "${PACKAGE}" ]; then
......@@ -105,10 +104,9 @@ fi
# Build & Install libwebsockets
if ! pkg-config "libwebsockets >= 2.3.0" && \
[ -z "${SKIP_WEBSOCKETS}" ]; then
git clone https://libwebsockets.org/repo/libwebsockets
git clone --branch v4.0-stable --depth 1 https://libwebsockets.org/repo/libwebsockets
mkdir -p libwebsockets/build
pushd libwebsockets/build
git checkout v4.0-stable
cmake -DLWS_WITHOUT_TESTAPPS=ON -DLWS_WITHOUT_EXTENSIONS=OFF -DLWS_WITH_SERVER_STATUS=ON ${CMAKE_OPTS} ..
make -j$(nproc) ${TARGET}
popd
......@@ -118,9 +116,8 @@ fi
if ! pkg-config "libuldaq >= 1.0.0" && \
[ "${DISTRO}" != "debian-multiarch" ] && \
[ -z "${SKIP_ULDAQ}" ]; then
git clone https://github.com/stv0g/uldaq
git clone --branch rpmbuild --depth 1 https://github.com/stv0g/uldaq
pushd uldaq
git checkout rpmbuild
autoreconf -i
./configure --enable-examples=no ${CONFIGURE_OPTS}
if [ -z "${PACKAGE}" ]; then
......@@ -136,9 +133,8 @@ fi
# Build & Install comedilib
if ! pkg-config "comedilib >= 0.11.0" && \
[ -z "${SKIP_COMEDILIB}" ]; then
git clone https://github.com/Linux-Comedi/comedilib.git
git clone --branch r0_12_0 --depth 1 https://github.com/Linux-Comedi/comedilib.git
pushd comedilib
git checkout r0_12_0
./autogen.sh
./configure ${CONFIGURE_OPTS}
if [ -z "${PACKAGE}" ]; then
......@@ -155,9 +151,8 @@ fi
# Build & Install libre
if ! pkg-config "libre >= 0.5.6" && \
[ -z "${SKIP_LIBRE}" ]; then
git clone https://github.com/creytiv/re.git
git clone --branch v0.6.1 --depth 1 https://github.com/creytiv/re.git
pushd re
git checkout v0.6.1
if [ -z "${PACKAGE}" ]; then
make -j$(nproc) install
else
......@@ -170,7 +165,7 @@ fi
# Build & Install nanomsg
if ! pkg-config "nanomsg >= 1.0.0" && \
[ -z "${SKIP_NANOMSG}" ]; then
git clone https://github.com/nanomsg/nanomsg.git
git clone --branch 1.1.5 --depth 1 https://github.com/nanomsg/nanomsg.git
mkdir -p nanomsg/build
pushd nanomsg/build
cmake ${CMAKE_OPTS} ..
......@@ -183,10 +178,9 @@ fi
# Build & Install libxil
if ! pkg-config "libxil >= 1.0.0" && \
[ -z "${SKIP_LIBXIL}" ]; then
git clone https://git.rwth-aachen.de/acs/public/villas/fpga/libxil.git
git clone --branch v0.1.0 --depth 1 https://git.rwth-aachen.de/acs/public/villas/fpga/libxil.git
mkdir -p libxil/build
pushd libxil/build
git checkout b622ddef4315b7e8a56637d07aa2b26ba480d53a
cmake ${CMAKE_OPTS} ..
if [ -z "${PACKAGE}" ]; then
make -j$(nproc) install
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment