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:
Loïc Blot 2020-04-20 20:18:40 +02:00 committed by GitHub
parent 338195ff25
commit 27a485a472
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 296 additions and 274 deletions

171
.github/workflows/build.yml vendored Normal file

@ -0,0 +1,171 @@
name: build
# build on c/cpp changes or workflow changes
on:
push:
paths:
- 'lib/**.[ch]'
- 'lib/**.cpp'
- 'src/**.[ch]'
- 'src/**.cpp'
- '**/CMakeLists.txt'
- 'cmake/Modules/**'
- 'util/buildbot/**'
- 'util/ci/**'
- '.github/workflows/**.yml'
pull_request:
paths:
- 'lib/**.[ch]'
- 'lib/**.cpp'
- 'src/**.[ch]'
- 'src/**.cpp'
- '**/CMakeLists.txt'
- 'cmake/Modules/**'
- 'util/buildbot/**'
- 'util/ci/**'
- '.github/workflows/**.yml'
jobs:
# This is our minor gcc compiler
gcc_6:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Install compiler
run: |
sudo apt-get install g++-6 gcc-6 -qyy
source ./util/ci/common.sh
install_linux_deps
- name: Build
run: |
./util/ci/build.sh
env:
CMAKE_FLAGS: "-DCMAKE_C_COMPILER=gcc-6 -DCMAKE_CXX_COMPILER=g++-6"
- name: Test
run: |
./bin/minetest --run-unittests
# This is the current gcc compiler (available in bionic)
gcc_8:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Install compiler
run: |
sudo apt-get install g++-8 gcc-8 -qyy
source ./util/ci/common.sh
install_linux_deps
- name: Build
run: |
./util/ci/build.sh
env:
CMAKE_FLAGS: "-DCMAKE_C_COMPILER=gcc-8 -DCMAKE_CXX_COMPILER=g++-8"
- name: Test
run: |
./bin/minetest --run-unittests
# This is our minor clang compiler
clang_3_9:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Install compiler
run: |
sudo apt-get install clang-3.9 -qyy
source ./util/ci/common.sh
install_linux_deps
- name: Build
run: |
./util/ci/build.sh
env:
CMAKE_FLAGS: "-DCMAKE_C_COMPILER=clang-3.9 -DCMAKE_CXX_COMPILER=clang++-3.9"
- name: Test
run: |
./bin/minetest --run-unittests
# This is the current clang version
clang_9:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Install compiler
run: |
sudo apt-get install clang-9 valgrind -qyy
source ./util/ci/common.sh
install_linux_deps
env:
WITH_LUAJIT: 1
- name: Build
run: |
./util/ci/build.sh
env:
CMAKE_FLAGS: "-DCMAKE_C_COMPILER=clang-9 -DCMAKE_CXX_COMPILER=clang++-9"
- name: Test
run: |
./bin/minetest --run-unittests
- name: Valgrind
run: |
valgrind --leak-check=full --leak-check-heuristics=all --undef-value-errors=no --error-exitcode=9 ./bin/minetest --run-unittests
# Some builds doesn't require freetype, ensure it compiled properly
clang_9_no_freetype:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Install compiler
run: |
sudo apt-get install clang-9 -qyy
source ./util/ci/common.sh
install_linux_deps
- name: Build
run: |
./util/ci/build.sh
env:
CMAKE_FLAGS: "-DCMAKE_C_COMPILER=clang-9 -DCMAKE_CXX_COMPILER=clang++-9 -DENABLE_FREETYPE=0"
- name: Test
run: |
./bin/minetest --run-unittests
win32:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Install compiler
run: |
wget http://minetest.kitsunemimi.pw/mingw-w64-i686_9.2.0_ubuntu18.04.tar.xz -O mingw.tar.xz
sudo tar -xaf mingw.tar.xz -C /usr
- name: Build
run: |
EXISTING_MINETEST_DIR=$PWD ./util/buildbot/buildwin32.sh winbuild
env:
NO_MINETEST_GAME: 1
NO_PACKAGE: 1
win64:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Install compiler
run: |
wget http://minetest.kitsunemimi.pw/mingw-w64-x86_64_9.2.0_ubuntu18.04.tar.xz -O mingw.tar.xz
sudo tar -xaf mingw.tar.xz -C /usr
- name: Build
run: |
EXISTING_MINETEST_DIR=$PWD ./util/buildbot/buildwin64.sh winbuild
env:
NO_MINETEST_GAME: 1
NO_PACKAGE: 1

53
.github/workflows/cpp_lint.yml vendored Normal file

@ -0,0 +1,53 @@
name: cpp_lint
# lint on c/cpp changes or workflow changes
on:
push:
paths:
- 'lib/**.[ch]'
- 'lib/**.cpp'
- 'src/**.[ch]'
- 'src/**.cpp'
- '**/CMakeLists.txt'
- 'cmake/Modules/**'
- 'util/ci/**'
- '.github/workflows/**.yml'
pull_request:
paths:
- 'lib/**.[ch]'
- 'lib/**.cpp'
- 'src/**.[ch]'
- 'src/**.cpp'
- '**/CMakeLists.txt'
- 'cmake/Modules/**'
- 'util/ci/**'
- '.github/workflows/**.yml'
jobs:
clang_format:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Install clang-format
run: |
sudo apt-get install ${CLANG_FORMAT} -qyy
env:
CLANG_FORMAT: clang-format-9
- name: Run clang-format
run: |
source ./util/ci/lint.sh
perform_lint
clang_tidy:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Install clang-tidy
run: |
sudo apt-get install clang-tidy-9 -qyy
source ./util/ci/common.sh
install_linux_deps
- name: Run clang-tidy
run: |
./util/ci/clang-tidy.sh

32
.github/workflows/lua_lint.yml vendored Normal file

@ -0,0 +1,32 @@
name: lua_lint
# Lint on lua changes on builtin or if workflow changed
on:
push:
paths:
- 'builtin/**.lua'
- '.github/workflows/**.yml'
pull_request:
paths:
- 'builtin/**.lua'
- '.github/workflows/**.yml'
jobs:
luacheck:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Install luarocks
run: |
sudo apt-get update -qyy
sudo apt-get install luarocks -qyy
- name: Install luarocks tools
run: |
luarocks install --local luacheck
luarocks install --local busted
- name: Run checks
run: |
$HOME/.luarocks/bin/luacheck builtin
$HOME/.luarocks/bin/busted builtin

@ -219,7 +219,6 @@ build:fedora-24:
- apt-get update -y
- apt-get install -y wget xz-utils unzip git cmake gettext
- wget -q http://minetest.kitsunemimi.pw/mingw-w64-${WIN_ARCH}_9.2.0_ubuntu18.04.tar.xz -O mingw.tar.xz
- sed -e "s|%PREFIX%|${WIN_ARCH}-w64-mingw32|" -e "s|%ROOTPATH%|/usr/${WIN_ARCH}-w64-mingw32|" < util/travis/toolchain_mingw.cmake.in > ${TOOLCHAIN_OUTPUT}
- tar -xaf mingw.tar.xz -C /usr
.build_win_template:
@ -256,7 +255,6 @@ build:win32:
variables:
NO_PACKAGE: "1"
WIN_ARCH: "i686"
TOOLCHAIN_OUTPUT: "util/buildbot/toolchain_mingw.cmake"
package:win32:
extends: .package_win_template
@ -265,7 +263,6 @@ package:win32:
variables:
NO_PACKAGE: "1"
WIN_ARCH: "i686"
TOOLCHAIN_OUTPUT: "util/buildbot/toolchain_mingw.cmake"
build:win64:
extends: .build_win_template
@ -274,7 +271,6 @@ build:win64:
variables:
NO_PACKAGE: "1"
WIN_ARCH: "x86_64"
TOOLCHAIN_OUTPUT: "util/buildbot/toolchain_mingw64.cmake"
package:win64:
extends: .package_win_template
@ -283,7 +279,6 @@ package:win64:
variables:
NO_PACKAGE: "1"
WIN_ARCH: "x86_64"
TOOLCHAIN_OUTPUT: "util/buildbot/toolchain_mingw64.cmake"
package:docker:
stage: package

@ -1,98 +0,0 @@
language: cpp
before_install: ./util/travis/before_install.sh
script: ./util/travis/script.sh
os: linux
dist: bionic
group: edge
notifications:
email: false
matrix:
fast_finish: true
include:
- env: CLANG_FORMAT=clang-format-8
compiler: clang
os: linux
addons:
apt:
packages: ['clang-format-8']
- name: "Builtin Luacheck and Unit Tests"
language: generic
compiler: null
os: linux
addons:
apt:
packages:
- luarocks
before_install:
- luarocks install --local luacheck
- luarocks install --local busted
script:
- $HOME/.luarocks/bin/luacheck builtin
- $HOME/.luarocks/bin/busted builtin
- env: CLANG_TIDY=clang-tidy-8
compiler: clang
os: linux
script: ./util/travis/clangtidy.sh
addons:
apt:
packages: ['clang-tidy-8']
- name: "MinGW cross-compiler (32-bit)"
env: PLATFORM=Win32
compiler: gcc
os: linux
- name: "MinGW cross-compiler (64-bit)"
env: PLATFORM=Win64
compiler: gcc
os: linux
# - env: PLATFORM=Unix
# compiler: clang
# os: osx
# osx_image: xcode8
- env: PLATFORM=Unix COMPILER=gcc-6
compiler: gcc
os: linux
addons:
apt:
packages: ['gcc-6', 'g++-6']
- env: PLATFORM=Unix COMPILER=gcc-8
compiler: gcc
os: linux
addons:
apt:
packages: ['gcc-8', 'g++-8']
- env: PLATFORM=Unix COMPILER=clang-3.9
compiler: clang
os: linux
addons:
apt:
packages: ['clang-3.9']
- env: PLATFORM=Unix COMPILER=clang-9
compiler: clang
os: linux
addons:
apt:
packages: ['clang-9']
- env: PLATFORM=Unix COMPILER=clang-9 FREETYPE=0
compiler: clang
os: linux
addons:
apt:
packages: ['clang-9']
- env: PLATFORM=Unix COMPILER=clang-9 VALGRIND=1
compiler: clang
os: linux
addons:
apt:
packages: ['valgrind', 'clang-9']

@ -1,7 +1,7 @@
Minetest
========
[![Build Status](https://travis-ci.org/minetest/minetest.svg?branch=master)](https://travis-ci.org/minetest/minetest)
![Build Status](https://github.com/minetest/minetest/workflows/validate/badge.svg)
[![Translation status](https://hosted.weblate.org/widgets/minetest/-/svg-badge.svg)](https://hosted.weblate.org/engage/minetest/?utm_source=widget)
[![License](https://img.shields.io/badge/license-LGPLv2.1%2B-blue.svg)](https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html)

@ -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

@ -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

@ -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)