Skip to content

Commit

Permalink
Added a CI script (#2423).
Browse files Browse the repository at this point in the history
Indeed, we can't currently CI test on Linux since we are running Ubuntu 18.04 LTS while we need Ubuntu 20.04 LTS.
  • Loading branch information
agarny committed Dec 6, 2020
1 parent b208b78 commit 7e84748
Show file tree
Hide file tree
Showing 4 changed files with 102 additions and 14 deletions.
29 changes: 29 additions & 0 deletions ci
@@ -0,0 +1,29 @@
#!/bin/sh

$(cd $(dirname $0); pwd)/clean
$(cd $(dirname $0); pwd)/scripts/genericmake CIRelease "$@"

exitCode=$?

if [ $exitCode -ne 0 ]; then
exit $exitCode
fi

$(cd $(dirname $0); pwd)/runtests

exitCode=$?

if [ $exitCode -ne 0 ]; then
exit $exitCode
fi

$(cd $(dirname $0); pwd)/clean
$(cd $(dirname $0); pwd)/scripts/genericmake CIDebug "$@"

exitCode=$?

if [ $exitCode -ne 0 ]; then
exit $exitCode
fi

$(cd $(dirname $0); pwd)/runtests
29 changes: 29 additions & 0 deletions ci.bat
@@ -0,0 +1,29 @@
@ECHO OFF

CALL %~dp0clean
CALL %~dp0scripts\genericmake CIRelease

SET ExitCode=!ERRORLEVEL!

IF !ExitCode! NEQ 0 (
EXIT /B !ExitCode!
)

CALL %~dp0runtests

SET ExitCode=!ERRORLEVEL!

IF !ExitCode! NEQ 0 (
EXIT /B !ExitCode!
)

CALL %~dp0clean
CALL %~dp0scripts\genericmake CIDebug

SET ExitCode=!ERRORLEVEL!

IF !ExitCode! NEQ 0 (
EXIT /B !ExitCode!
)

CALL %~dp0runtests
33 changes: 25 additions & 8 deletions scripts/genericmake
Expand Up @@ -3,12 +3,25 @@
appDir="$(cd "$(dirname "$0")"; pwd)"/..

if [ -d "${appDir}/build" ]; then
cmakeBuildType=$1

if [ "$cmakeBuildType" = "Release" ]; then
if [ "$1" = "Release" ]; then
cmakeBuildType=Release
enableSamplePlugins=OFF
enableTestPlugins=OFF
enableTests=OFF
else
elif [ "$1" = "Debug" ]; then
cmakeBuildType=Debug
enableSamplePlugins=OFF
enableTestPlugins=OFF
enableTests=ON
elif [ "$1" = "CIRelease" ]; then
cmakeBuildType=Release
enableSamplePlugins=ON
enableTestPlugins=ON
enableTests=ON
elif [ "$1" = "CIDebug" ]; then
cmakeBuildType=Debug
enableSamplePlugins=ON
enableTestPlugins=ON
enableTests=ON
fi

Expand All @@ -22,17 +35,21 @@ if [ -d "${appDir}/build" ]; then
cmakeGenerator="Unix Makefiles"
fi

if [ "$cmakeBuildType" = "Debug" ]; then
titleTests=" and its tests"
if [ "$1" = "Debug" ]; then
extraTitleInfo=" for testing"
elif [ "$1" = "CIRelease" ]; then
extraTitleInfo=" for CI release"
elif [ "$1" = "CIDebug" ]; then
extraTitleInfo=" for CI debug"
fi

echo "\033[44;37;1mMaking OpenCOR$titleTests (using $generator)...\033[0m"
echo "\033[44;37;1mMaking OpenCOR$extraTitleInfo (using $generator)...\033[0m"

origDir=`pwd`

cd ${appDir}/build

cmake -G "$cmakeGenerator" -DCMAKE_BUILD_TYPE=$cmakeBuildType -DENABLE_TESTS=$enableTests ..
cmake -G "$cmakeGenerator" -DCMAKE_BUILD_TYPE=$cmakeBuildType -DENABLE_SAMPLE_PLUGINS=$enableSamplePlugins -DENABLE_TEST_PLUGINS=$enableTestPlugins -DENABLE_TESTS=$enableTests ..

exitCode=$?

Expand Down
25 changes: 19 additions & 6 deletions scripts/genericmake.bat
Expand Up @@ -3,12 +3,25 @@ SETLOCAL ENABLEDELAYEDEXPANSION
SET AppDir=%~dp0..\

IF EXIST "%AppDir%build" (
SET CMakeBuildType=%1

IF "!CMakeBuildType!" == "Release" (
IF "%1" == "Release" (
SET CMakeBuildType=Release
SET EnableSamplePlugins=OFF
SET EnableTestPlugins=OFF
SET EnableTests=OFF
) ELSE (
) ELSE IF "%1" == "Debug" (
SET CMakeBuildType=Debug
SET EnableSamplePlugins=OFF
SET EnableTestPlugins=OFF
SET EnableTests=ON
) ELSE IF "%1" == "CIRelease" (
SET CMakeBuildType=Release
SET EnableSamplePlugins=ON
SET EnableTestPlugins=ON
SET EnableTests=ON
) ELSE IF "%1" == "CIDebug" (
SET CMakeBuildType=Debug
SET EnableSamplePlugins=ON
SET EnableTestPlugins=ON
SET EnableTests=ON
)

Expand All @@ -22,7 +35,7 @@ IF EXIST "%AppDir%build" (
SET Generator=JOM
)

IF "!CMakeBuildType!" == "Release" (
IF "%1" == "Release" (
SET TitleTests=
) ELSE (
SET TitleTests= and its tests
Expand All @@ -42,7 +55,7 @@ IF EXIST "%AppDir%build" (
SET CMakeGenerator=NMake Makefiles JOM
)

cmake -G "!CMakeGenerator!" -DCMAKE_BUILD_TYPE=!CMakeBuildType! -DENABLE_TESTS=!EnableTests! ..
cmake -G "!CMakeGenerator!" -DCMAKE_BUILD_TYPE=!CMakeBuildType! -DENABLE_SAMPLE_PLUGINS=!EnableSamplePlugins! -DENABLE_TEST_PLUGINS=!EnableTestPlugins! -DENABLE_TESTS=!EnableTests! ..

SET ExitCode=!ERRORLEVEL!

Expand Down

0 comments on commit 7e84748

Please sign in to comment.