Skip to content
Snippets Groups Projects
Commit dd7128fd authored by Reinhard Biegel's avatar Reinhard Biegel Committed by Andreas Rauschert
Browse files

feat: Integration into Eclipse CI

parent 8f47d2e9
No related branches found
No related tags found
1 merge request!98Intergration into Eclipse CI
/********************************************************************************
* Copyright (c) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* SPDX-License-Identifier: EPL-2.0
********************************************************************************/
pipeline {
agent none
options {
checkoutToSubdirectory('repo')
timeout(time: 5, unit: 'HOURS')
timestamps()
}
stages {
stage('Linux and Windows build') {
parallel {
stage('Linux') {
agent {
kubernetes {
label 'openpass-agent-pod-' + env.BUILD_NUMBER
yaml """
apiVersion: v1
kind: Pod
spec:
containers:
- name: mantleapi-build
image: nmraghu/mantleapi:latest
tty: true
resources:
limits:
memory: "16Gi"
cpu: "4"
requests:
memory: "16Gi"
cpu: "4"
- name: jnlp
volumeMounts:
- name: volume-known-hosts
mountPath: /home/jenkins/.ssh
volumes:
- name: volume-known-hosts
configMap:
name: known-hosts
"""
}
}
stages {
stage('Linux: Setup environment') {
steps {
container('mantleapi-build') {
sh 'bash repo/utils/ci/scripts/10_build_prepare.sh'
sh 'bash repo/utils/ci/scripts/20_configure.sh'
}
}
}
stage('Linux: Build MantleAPI') {
steps {
container('mantleapi-build') {
sh 'bash repo/utils/ci/scripts/30_build.sh'
}
}
}
stage('Linux: Run Unittest') {
steps {
container('mantleapi-build') {
sh 'bash repo/utils/ci/scripts/40_test.sh'
}
}
}
}
}
stage('Windows') {
agent {
label 'windows'
}
environment {
MSYSTEM = 'MINGW64'
CHERE_INVOKING = 'yes'
}
stages {
stage('Windows: Setup environment') {
steps {
bat 'subst M: %WORKSPACE%'
dir('M:/') {
bat 'C:\\msys64\\usr\\bin\\bash -lc repo/utils/ci/scripts/10_build_prepare.sh'
bat 'C:\\msys64\\usr\\bin\\bash -lc repo/utils/ci/scripts/20_configure.sh'
}
}
}
stage('Windows: Build MantleAPI') {
steps {
dir('M:/') {
bat 'C:\\msys64\\usr\\bin\\bash -lc repo/utils/ci/scripts/30_build.sh'
}
}
}
stage('Windows: Run Unittest') {
steps {
dir('M:/') {
bat 'C:\\msys64\\usr\\bin\\bash -lc repo/utils/ci/scripts/40_test.sh'
}
}
}
}
post {
always {
bat 'subst M: /d'
}
}
}
}
}
}
}
#!/bin/bash
################################################################################
# Copyright (c) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License 2.0 which is available at
# http://www.eclipse.org/legal/epl-2.0.
#
# SPDX-License-Identifier: EPL-2.0
################################################################################
################################################################################
# This script prepares building
################################################################################
MYDIR="$(dirname "$(readlink -f $0)")"
cd "$MYDIR/../../../.." || exit 1
if [ ! -d repo ]; then
echo "repo folder doesn't exist as expected. exiting."
exit 1
fi
# wipe build directories and pyOpenPASS results
rm -rf artifacts build dist
# prepare
mkdir build
#!/bin/bash
################################################################################
# Copyright (c) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License 2.0 which is available at
# http://www.eclipse.org/legal/epl-2.0.
#
# SPDX-License-Identifier: EPL-2.0
################################################################################
################################################################################
# This script configures cmake
################################################################################
# joins arguments using the cmake list separator (;)
function join_paths()
{
local IFS=\;
echo "$*"
}
MYDIR="$(dirname "$(readlink -f $0)")"
cd "$MYDIR/../../../../build" || exit 1
# preparations for building on Windows/MSYS
if [[ "${OSTYPE}" = "msys" ]]; then
# set the correct CMake generator
CMAKE_GENERATOR_ARG="-GMSYS Makefiles"
fi
cmake \
"$CMAKE_GENERATOR_ARG" \
-D CMAKE_INSTALL_PREFIX="$PWD/../dist/mantle-api" \
-D CMAKE_BUILD_TYPE=Release \
../repo
#!/bin/bash
################################################################################
# Copyright (c) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License 2.0 which is available at
# http://www.eclipse.org/legal/epl-2.0.
#
# SPDX-License-Identifier: EPL-2.0
################################################################################
################################################################################
# This script executes the build and installs files to destination directory
################################################################################
MYDIR="$(dirname "$(readlink -f $0)")"
cd "$MYDIR/../../../../build" || exit 1
make install
#!/bin/bash
################################################################################
# Copyright (c) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License 2.0 which is available at
# http://www.eclipse.org/legal/epl-2.0.
#
# SPDX-License-Identifier: EPL-2.0
################################################################################
################################################################################
# This script builds and executes unit tests
################################################################################
MYDIR="$(dirname "$(readlink -f $0)")"
cd "$MYDIR/../../../../build" || exit 1
if hash nproc 2>/dev/null; then
MAKE_JOB_COUNT=$(($(nproc)/4))
else
# fallback, if nproc doesn't exist
MAKE_JOB_COUNT=1
fi
if [[ $MAKE_JOB_COUNT -eq 0 ]]; then
# fallback, if nproc == 1
MAKE_JOB_COUNT=1
fi
export MAKEFLAGS=-j${MAKE_JOB_COUNT}
ctest -j1 --output-on-failure
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment