mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-12 16:15:20 +02:00
Replace travis with github actions (#9641)
* Move outside of travis to Github actions This will permit to have better integrated CI workflow than the previous travis one.
This commit is contained in:
@@ -86,22 +86,21 @@ cd $libdir
|
||||
# Get minetest
|
||||
cd $builddir
|
||||
if [ ! "x$EXISTING_MINETEST_DIR" = "x" ]; then
|
||||
ln -s $EXISTING_MINETEST_DIR $CORE_NAME
|
||||
cd /$EXISTING_MINETEST_DIR # must be absolute path
|
||||
else
|
||||
[ -d $CORE_NAME ] && (cd $CORE_NAME && git pull) || (git clone -b $CORE_BRANCH $CORE_GIT)
|
||||
cd $CORE_NAME
|
||||
fi
|
||||
cd $CORE_NAME
|
||||
git_hash=$(git rev-parse --short HEAD)
|
||||
|
||||
# Get minetest_game
|
||||
cd games
|
||||
if [ "x$NO_MINETEST_GAME" = "x" ]; then
|
||||
cd games
|
||||
[ -d $GAME_NAME ] && (cd $GAME_NAME && git pull) || (git clone -b $GAME_BRANCH $GAME_GIT)
|
||||
cd ..
|
||||
fi
|
||||
cd ../..
|
||||
|
||||
# Build the thing
|
||||
cd $CORE_NAME
|
||||
[ -d _build ] && rm -Rf _build/
|
||||
mkdir _build
|
||||
cd _build
|
||||
|
@@ -78,22 +78,21 @@ cd $libdir
|
||||
# Get minetest
|
||||
cd $builddir
|
||||
if [ ! "x$EXISTING_MINETEST_DIR" = "x" ]; then
|
||||
ln -s $EXISTING_MINETEST_DIR $CORE_NAME
|
||||
cd /$EXISTING_MINETEST_DIR # must be absolute path
|
||||
else
|
||||
[ -d $CORE_NAME ] && (cd $CORE_NAME && git pull) || (git clone -b $CORE_BRANCH $CORE_GIT)
|
||||
cd $CORE_NAME
|
||||
fi
|
||||
cd $CORE_NAME
|
||||
git_hash=$(git rev-parse --short HEAD)
|
||||
|
||||
# Get minetest_game
|
||||
cd games
|
||||
if [ "x$NO_MINETEST_GAME" = "x" ]; then
|
||||
cd games
|
||||
[ -d $GAME_NAME ] && (cd $GAME_NAME && git pull) || (git clone -b $GAME_BRANCH $GAME_GIT)
|
||||
cd ..
|
||||
fi
|
||||
cd ../..
|
||||
|
||||
# Build the thing
|
||||
cd $CORE_NAME
|
||||
[ -d _build ] && rm -Rf _build/
|
||||
mkdir _build
|
||||
cd _build
|
||||
|
8
util/ci/build.sh
Executable file
8
util/ci/build.sh
Executable file
@@ -0,0 +1,8 @@
|
||||
#! /bin/bash -eu
|
||||
|
||||
mkdir cmakebuild
|
||||
cd cmakebuild
|
||||
cmake -DCMAKE_BUILD_TYPE=Debug \
|
||||
-DRUN_IN_PLACE=TRUE -DENABLE_GETTEXT=TRUE \
|
||||
-DBUILD_SERVER=TRUE ${CMAKE_FLAGS} ..
|
||||
make -j2
|
@@ -434,6 +434,7 @@ src/threading/thread.cpp
|
||||
src/threading/thread.h
|
||||
src/threads.h
|
||||
src/tileanimation.cpp
|
||||
src/tileanimation.h
|
||||
src/tool.cpp
|
||||
src/tool.h
|
||||
src/translation.cpp
|
18
util/ci/clang-tidy.sh
Executable file
18
util/ci/clang-tidy.sh
Executable file
@@ -0,0 +1,18 @@
|
||||
#! /bin/bash -eu
|
||||
|
||||
mkdir -p cmakebuild
|
||||
cd cmakebuild
|
||||
cmake -DCMAKE_BUILD_TYPE=Debug \
|
||||
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
|
||||
-DRUN_IN_PLACE=TRUE \
|
||||
-DENABLE_GETTEXT=TRUE \
|
||||
-DENABLE_SOUND=FALSE \
|
||||
-DBUILD_SERVER=TRUE ..
|
||||
make GenerateVersion
|
||||
|
||||
cd ..
|
||||
|
||||
./util/ci/run-clang-tidy.py \
|
||||
-clang-tidy-binary=clang-tidy-9 -p cmakebuild \
|
||||
-quiet -config="$(cat .clang-tidy)" \
|
||||
'src/.*'
|
@@ -21,9 +21,10 @@ install_linux_deps() {
|
||||
local pkgs=(libirrlicht-dev cmake libbz2-dev libpng-dev \
|
||||
libjpeg-dev libxxf86vm-dev libgl1-mesa-dev libsqlite3-dev \
|
||||
libhiredis-dev libogg-dev libgmp-dev libvorbis-dev libopenal-dev \
|
||||
gettext libpq-dev postgresql-server-dev-all libleveldb-dev)
|
||||
gettext libpq-dev postgresql-server-dev-all libleveldb-dev \
|
||||
libcurl4-openssl-dev)
|
||||
# for better coverage, build some jobs with luajit
|
||||
if [[ "$CC" == "clang"* && -z "$VALGRIND$FREETYPE" ]]; then
|
||||
if [ -n "$WITH_LUAJIT" ]; then
|
||||
pkgs+=(libluajit-5.1-dev)
|
||||
fi
|
||||
|
||||
@@ -42,16 +43,3 @@ install_macosx_deps() {
|
||||
fi
|
||||
#brew upgrade postgresql
|
||||
}
|
||||
|
||||
# Relative to git-repository root:
|
||||
TRIGGER_COMPILE_PATHS="src/.*\.(c|cpp|h)|CMakeLists.txt|cmake/Modules/|util/travis/|util/buildbot/"
|
||||
|
||||
needs_compile() {
|
||||
RANGE="$TRAVIS_COMMIT_RANGE"
|
||||
if [[ "$(git diff --name-only $RANGE -- 2>/dev/null)" == "" ]]; then
|
||||
RANGE="$TRAVIS_COMMIT^...$TRAVIS_COMMIT"
|
||||
echo "Fixed range: $RANGE"
|
||||
fi
|
||||
git diff --name-only $RANGE -- | egrep -q "^($TRIGGER_COMPILE_PATHS)"
|
||||
}
|
||||
|
@@ -5,7 +5,7 @@ function perform_lint() {
|
||||
CLANG_FORMAT=clang-format
|
||||
fi
|
||||
echo "LINT: Using binary $CLANG_FORMAT"
|
||||
CLANG_FORMAT_WHITELIST="util/travis/clang-format-whitelist.txt"
|
||||
CLANG_FORMAT_WHITELIST="util/ci/clang-format-whitelist.txt"
|
||||
|
||||
files_to_lint="$(find src/ -name '*.cpp' -or -name '*.h')"
|
||||
|
@@ -1,29 +0,0 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
echo "Preparing for $TRAVIS_COMMIT_RANGE"
|
||||
|
||||
. util/travis/common.sh
|
||||
|
||||
if [[ ! -z "${CLANG_FORMAT}" ]]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
needs_compile || exit 0
|
||||
|
||||
if [[ $PLATFORM == "Unix" ]] || [[ ! -z "${CLANG_TIDY}" ]]; then
|
||||
if [[ $TRAVIS_OS_NAME == "linux" ]] || [[ ! -z "${CLANG_TIDY}" ]]; then
|
||||
install_linux_deps
|
||||
else
|
||||
install_macosx_deps
|
||||
fi
|
||||
elif [[ $PLATFORM == "Win32" ]]; then
|
||||
wget http://minetest.kitsunemimi.pw/mingw-w64-i686_9.2.0_ubuntu18.04.tar.xz -O mingw.tar.xz
|
||||
# buildwin32.sh detects the installed toolchain automatically
|
||||
sudo tar -xaf mingw.tar.xz -C /usr
|
||||
elif [[ $PLATFORM == "Win64" ]]; then
|
||||
wget http://minetest.kitsunemimi.pw/mingw-w64-x86_64_9.2.0_ubuntu18.04.tar.xz -O mingw.tar.xz
|
||||
sed -e "s|%PREFIX%|x86_64-w64-mingw32|" \
|
||||
-e "s|%ROOTPATH%|/usr/x86_64-w64-mingw32|" \
|
||||
< util/travis/toolchain_mingw.cmake.in > util/buildbot/toolchain_mingw64.cmake
|
||||
sudo tar -xaf mingw.tar.xz -C /usr
|
||||
fi
|
@@ -1,28 +0,0 @@
|
||||
#!/bin/bash -e
|
||||
. util/travis/common.sh
|
||||
|
||||
needs_compile || exit 0
|
||||
|
||||
if [ -z "${CLANG_TIDY}" ]; then
|
||||
CLANG_TIDY=clang-tidy
|
||||
fi
|
||||
|
||||
mkdir -p cmakebuild && cd cmakebuild
|
||||
cmake -DCMAKE_BUILD_TYPE=Debug \
|
||||
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
|
||||
-DRUN_IN_PLACE=TRUE \
|
||||
-DENABLE_GETTEXT=TRUE \
|
||||
-DENABLE_SOUND=FALSE \
|
||||
-DBUILD_SERVER=TRUE ..
|
||||
make GenerateVersion
|
||||
cd ..
|
||||
|
||||
echo "Performing clang-tidy checks..."
|
||||
./util/travis/run-clang-tidy.py \
|
||||
-clang-tidy-binary=${CLANG_TIDY} -p cmakebuild \
|
||||
-quiet -config="$(cat .clang-tidy)" \
|
||||
'src/.*'
|
||||
|
||||
RET=$?
|
||||
echo "Clang tidy returned $RET"
|
||||
exit $RET
|
@@ -1,69 +0,0 @@
|
||||
#!/bin/bash -e
|
||||
. util/travis/common.sh
|
||||
. util/travis/lint.sh
|
||||
|
||||
needs_compile || exit 0
|
||||
|
||||
if [[ ! -z "${CLANG_FORMAT}" ]]; then
|
||||
# Lint and exit CI
|
||||
perform_lint
|
||||
exit 0
|
||||
fi
|
||||
|
||||
set_linux_compiler_env
|
||||
|
||||
if [[ ${PLATFORM} == "Unix" ]]; then
|
||||
mkdir -p travisbuild
|
||||
cd travisbuild || exit 1
|
||||
|
||||
CMAKE_FLAGS=''
|
||||
|
||||
if [[ ${TRAVIS_OS_NAME} == "osx" ]]; then
|
||||
CMAKE_FLAGS+=' -DCUSTOM_GETTEXT_PATH=/usr/local/opt/gettext'
|
||||
fi
|
||||
|
||||
if [[ -n "${FREETYPE}" ]] && [[ "${FREETYPE}" == "0" ]]; then
|
||||
CMAKE_FLAGS+=' -DENABLE_FREETYPE=0'
|
||||
fi
|
||||
|
||||
cmake -DCMAKE_BUILD_TYPE=Debug \
|
||||
-DRUN_IN_PLACE=TRUE \
|
||||
-DENABLE_GETTEXT=TRUE \
|
||||
-DBUILD_SERVER=TRUE \
|
||||
${CMAKE_FLAGS} ..
|
||||
make -j2
|
||||
|
||||
echo "Running unit tests."
|
||||
CMD="../bin/minetest --run-unittests"
|
||||
if [[ "${VALGRIND}" == "1" ]]; then
|
||||
valgrind --leak-check=full --leak-check-heuristics=all --undef-value-errors=no --error-exitcode=9 ${CMD} && exit 0
|
||||
else
|
||||
${CMD} && exit 0
|
||||
fi
|
||||
|
||||
elif [[ $PLATFORM == Win* ]]; then
|
||||
[[ $CC == "clang" ]] && exit 1 # Not supposed to happen
|
||||
# We need to have our build directory outside of the minetest directory because
|
||||
# CMake will otherwise get very very confused with symlinks and complain that
|
||||
# something is not a subdirectory of something even if it actually is.
|
||||
# e.g.:
|
||||
# /home/travis/minetest/minetest/travisbuild/minetest
|
||||
# \/ \/ \/
|
||||
# /home/travis/minetest/minetest/travisbuild/minetest/travisbuild/minetest
|
||||
# \/ \/ \/
|
||||
# /home/travis/minetest/minetest/travisbuild/minetest/travisbuild/minetest/travisbuild/minetest
|
||||
# You get the idea.
|
||||
OLDDIR=$(pwd)
|
||||
cd ..
|
||||
export EXISTING_MINETEST_DIR=$OLDDIR
|
||||
export NO_MINETEST_GAME=1
|
||||
if [[ $PLATFORM == "Win32" ]]; then
|
||||
"$OLDDIR/util/buildbot/buildwin32.sh" travisbuild && exit 0
|
||||
elif [[ $PLATFORM == "Win64" ]]; then
|
||||
"$OLDDIR/util/buildbot/buildwin64.sh" travisbuild && exit 0
|
||||
fi
|
||||
else
|
||||
echo "Unknown platform \"${PLATFORM}\"."
|
||||
exit 1
|
||||
fi
|
||||
|
@@ -1,18 +0,0 @@
|
||||
# Target operating system name
|
||||
set(CMAKE_SYSTEM_NAME Windows)
|
||||
|
||||
# Compilers to use
|
||||
set(CMAKE_C_COMPILER %PREFIX%-gcc)
|
||||
set(CMAKE_CXX_COMPILER %PREFIX%-g++)
|
||||
set(CMAKE_RC_COMPILER %PREFIX%-windres)
|
||||
|
||||
# Location of the target environment
|
||||
set(CMAKE_FIND_ROOT_PATH %ROOTPATH%)
|
||||
|
||||
# Adjust the default behaviour of the FIND_XXX() commands:
|
||||
# search for headers and libraries in the target environment,
|
||||
# search for programs in the host environment
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||
|
Reference in New Issue
Block a user