2021-06-17 04:31:29 -04:00
|
|
|
#!/usr/bin/env bash
|
2014-05-10 12:52:46 -04:00
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2021-07-10 16:58:33 -04:00
|
|
|
export CUBERITE_BUILD_SERIES_NAME="CI $CC $CI_CUBERITE_BUILD_TYPE"
|
|
|
|
export CUBERITE_BUILD_ID=$CI_JOB_NUMBER
|
2015-08-26 04:58:51 -04:00
|
|
|
export CUBERITE_BUILD_DATETIME=`date`
|
2014-09-10 11:12:49 -04:00
|
|
|
|
2019-11-10 11:55:24 -05:00
|
|
|
# Use ccache if available
|
|
|
|
if [ `which ccache` ]; then
|
2020-05-16 15:59:10 -04:00
|
|
|
# Re-run compile on pre-processed sources on cache miss
|
|
|
|
# "It's slower actually, but clang builds fail without it."
|
2019-11-10 11:55:24 -05:00
|
|
|
export CCACHE_CPP2=true
|
2020-05-16 15:59:10 -04:00
|
|
|
|
|
|
|
# Tell CMake of ccache's existence
|
2019-11-10 11:55:24 -05:00
|
|
|
CACHE_ARGS="-DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache"
|
2020-05-16 15:59:10 -04:00
|
|
|
|
2019-11-10 11:55:24 -05:00
|
|
|
echo "Using ccache installed at $(which ccache)"
|
2020-05-21 18:52:19 -04:00
|
|
|
ccache --max-size=1G
|
|
|
|
ccache --zero-stats
|
2019-11-10 11:55:24 -05:00
|
|
|
fi
|
|
|
|
|
2021-07-10 16:58:33 -04:00
|
|
|
workdir="$CC"_"$CI_CUBERITE_BUILD_TYPE"
|
2021-06-17 04:31:29 -04:00
|
|
|
mkdir "$workdir"
|
|
|
|
cd "$workdir"
|
|
|
|
|
2020-05-31 15:26:50 -04:00
|
|
|
# Work around a Clang + ccache issue with failing builds by disabling
|
|
|
|
# precompiled headers. Turn off LTO for faster build speeds
|
2021-07-10 16:58:33 -04:00
|
|
|
cmake .. -DCMAKE_BUILD_TYPE=${CI_CUBERITE_BUILD_TYPE} \
|
2020-05-21 18:52:19 -04:00
|
|
|
-DBUILD_TOOLS=Yes \
|
|
|
|
-DPRECOMPILE_HEADERS=No \
|
|
|
|
-DSELF_TEST=Yes \
|
2021-07-10 16:58:33 -04:00
|
|
|
-DUNITY_BUILDS=${CI_CUBERITE_UNITY_BUILDS-Yes} \
|
2020-05-31 15:26:50 -04:00
|
|
|
-DWHOLE_PROGRAM_OPTIMISATION=No \
|
2020-05-16 15:59:10 -04:00
|
|
|
${CACHE_ARGS};
|
2015-05-12 03:21:43 -04:00
|
|
|
|
|
|
|
echo "Building..."
|
2021-06-17 04:31:29 -04:00
|
|
|
cmake --build . --parallel 3;
|
2020-05-16 07:57:14 -04:00
|
|
|
|
|
|
|
if [ `which ccache` ]; then
|
2020-05-16 15:59:10 -04:00
|
|
|
echo "Built with ccache, outputting cache stats..."
|
2020-05-21 18:52:19 -04:00
|
|
|
ccache --show-stats
|
2020-05-16 07:57:14 -04:00
|
|
|
fi
|
2015-09-27 04:24:50 -04:00
|
|
|
|
|
|
|
echo "Testing..."
|
2020-05-16 15:59:10 -04:00
|
|
|
ctest --output-on-failure --parallel 2;
|
2020-05-16 07:57:14 -04:00
|
|
|
|
2015-08-26 04:58:51 -04:00
|
|
|
cd Server/;
|
2016-10-25 12:49:42 -04:00
|
|
|
touch apiCheckFailed.flag
|
2021-07-10 16:58:33 -04:00
|
|
|
if [ "$CI_CUBERITE_BUILD_TYPE" != "COVERAGE" ]; then
|
2019-12-28 06:53:37 -05:00
|
|
|
./Cuberite <<- EOF
|
2017-12-22 13:25:46 -05:00
|
|
|
load APIDump
|
|
|
|
apicheck
|
|
|
|
restart
|
|
|
|
stop
|
|
|
|
EOF
|
2015-09-27 04:24:50 -04:00
|
|
|
if [ -f ./NewlyUndocumented.lua ]; then
|
|
|
|
echo "ERROR: Newly undocumented API symbols found:"
|
|
|
|
cat ./NewlyUndocumented.lua
|
|
|
|
exit 1
|
|
|
|
fi
|
2016-09-12 17:23:45 -04:00
|
|
|
if [ -f ./DuplicateDocs.txt ]; then
|
|
|
|
echo "ERROR: API documentation has duplicate symbol warnings:"
|
|
|
|
cat ./DuplicateDocs.txt
|
|
|
|
exit 1
|
|
|
|
fi
|
2016-10-25 12:49:42 -04:00
|
|
|
if [ -f ./apiCheckFailed.flag ]; then
|
|
|
|
echo "ERROR: API check has failed with an unknown error"
|
|
|
|
exit 1
|
|
|
|
fi
|
2014-05-17 08:04:40 -04:00
|
|
|
fi
|