mirror of https://github.com/axmolengine/axmol.git
Add cocos new tests to travis CI (#18703)
* Fix win32 cpp-template, speedup appveyor, add cocos new CI configuration * fix cocos new for win32 * Add cocos new test to travis CI * Remove mac_cocos_new_test * install_linux_environment, gradlew build * unify android setup * Install andorid to android-ndk * Set NDK_ROOT * lua-tests set proper path * Android build only debug * Refactoring * Linux verbose output * Linux verbose output * Clean up appveyor CI * Fix gen-bindings * pyenv install latest python * pyenv init * eval pyenv init * split android to cpp and lua
This commit is contained in:
parent
86ea3a8aee
commit
883d501d18
17
.travis.yml
17
.travis.yml
|
@ -15,10 +15,11 @@ matrix:
|
||||||
env: BUILD_TARGET=android
|
env: BUILD_TARGET=android
|
||||||
language: android
|
language: android
|
||||||
sudo: required
|
sudo: required
|
||||||
android:
|
# android_lua
|
||||||
components:
|
- os: linux
|
||||||
- android-14
|
env: BUILD_TARGET=android_lua
|
||||||
- build-tools-27.0.1
|
language: android
|
||||||
|
sudo: required
|
||||||
# mac
|
# mac
|
||||||
- os: osx
|
- os: osx
|
||||||
env: BUILD_TARGET=mac
|
env: BUILD_TARGET=mac
|
||||||
|
@ -31,6 +32,14 @@ matrix:
|
||||||
language: cpp
|
language: cpp
|
||||||
osx_image: xcode8.3
|
osx_image: xcode8.3
|
||||||
sudo: required
|
sudo: required
|
||||||
|
- os: linux
|
||||||
|
env: BUILD_TARGET=android_cocos_new_test
|
||||||
|
language: cpp
|
||||||
|
sudo: required
|
||||||
|
- os: linux
|
||||||
|
env: BUILD_TARGET=linux_cocos_new_test
|
||||||
|
language: cpp
|
||||||
|
sudo: required
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- tools/travis-scripts/run-script.sh
|
- tools/travis-scripts/run-script.sh
|
||||||
|
|
|
@ -534,6 +534,8 @@
|
||||||
"cocos/cc_dummy.c",
|
"cocos/cc_dummy.c",
|
||||||
"cocos/cocos2d.cpp",
|
"cocos/cocos2d.cpp",
|
||||||
"cocos/cocos2d.h",
|
"cocos/cocos2d.h",
|
||||||
|
"cocos/precheader.cpp",
|
||||||
|
"cocos/precheader.h",
|
||||||
"cocos/deprecated/CCArray.cpp",
|
"cocos/deprecated/CCArray.cpp",
|
||||||
"cocos/deprecated/CCArray.h",
|
"cocos/deprecated/CCArray.h",
|
||||||
"cocos/deprecated/CCBool.h",
|
"cocos/deprecated/CCBool.h",
|
||||||
|
|
|
@ -7,26 +7,9 @@ function Download-Deps
|
||||||
& $python $env:APPVEYOR_BUILD_FOLDER\download-deps.py --remove-download=False
|
& $python $env:APPVEYOR_BUILD_FOLDER\download-deps.py --remove-download=False
|
||||||
}
|
}
|
||||||
|
|
||||||
function Download-NDK
|
|
||||||
{
|
|
||||||
$url = "https://dl.google.com/android/repository/android-ndk-r16-windows-x86.zip"
|
|
||||||
$output = "$env:APPVEYOR_BUILD_FOLDER/../android-ndk-r16-windows-x86.zip"
|
|
||||||
Write-Host "downloading $url"
|
|
||||||
Start-FileDownload $url $output
|
|
||||||
Write-Host "finish downloading $url"
|
|
||||||
|
|
||||||
Write-Host "installing NDK"
|
|
||||||
Push-Location $env:APPVEYOR_BUILD_FOLDER/../
|
|
||||||
$zipfile = $output
|
|
||||||
Invoke-Expression "7z.exe x $zipfile"
|
|
||||||
Write-Host "finish installing NDK"
|
|
||||||
Pop-Location
|
|
||||||
$env:NDK_ROOT = "$env:APPVEYOR_BUILD_FOLDER/../android-ndk-r16"
|
|
||||||
Write-Host "set environment NDK_ROOT to $env:NDK_ROOT"
|
|
||||||
}
|
|
||||||
|
|
||||||
function Generate-Binding-Codes
|
function Generate-Binding-Codes
|
||||||
{
|
{
|
||||||
|
$env:NDK_ROOT=$env:APPVEYOR_BUILD_FOLDER + "\..\android-ndk-r16b"
|
||||||
|
|
||||||
# install python module
|
# install python module
|
||||||
& pip install PyYAML Cheetah
|
& pip install PyYAML Cheetah
|
||||||
|
@ -58,7 +41,7 @@ $python = "C:\\Python27\\python.exe"
|
||||||
|
|
||||||
If ($env:build_type -eq "windows32") {
|
If ($env:build_type -eq "windows32") {
|
||||||
Download-Deps
|
Download-Deps
|
||||||
Download-NDK
|
& $python -u .\tools\appveyor-scripts\setup_android.py --ndk_only
|
||||||
Generate-Binding-Codes
|
Generate-Binding-Codes
|
||||||
} elseif ($env:build_type -like "android*") {
|
} elseif ($env:build_type -like "android*") {
|
||||||
& $python -u .\tools\appveyor-scripts\setup_android.py
|
& $python -u .\tools\appveyor-scripts\setup_android.py
|
||||||
|
|
|
@ -9,6 +9,8 @@ import platform
|
||||||
import sys
|
import sys
|
||||||
import subprocess
|
import subprocess
|
||||||
import tempfile
|
import tempfile
|
||||||
|
import argparse
|
||||||
|
|
||||||
|
|
||||||
DIR_PATH = os.path.dirname(os.path.realpath(__file__))
|
DIR_PATH = os.path.dirname(os.path.realpath(__file__))
|
||||||
|
|
||||||
|
@ -90,34 +92,33 @@ def install_android_sdk():
|
||||||
run_with_yes(cmd)
|
run_with_yes(cmd)
|
||||||
|
|
||||||
|
|
||||||
def export_environment():
|
def export_environment(ndk_only):
|
||||||
# gradle
|
|
||||||
# os.environ["ANDROID_HOME"] = ANDROID_SDK
|
|
||||||
# os.environ["ANDROID_NDK_HOME"] = ANDROID_NDK
|
|
||||||
# # cocos gen-libs
|
|
||||||
# os.environ["ANDROID_SDK_ROOT"] = ANDROID_SDK
|
|
||||||
# os.environ["NDK_ROOT"] = ANDROID_NDK
|
|
||||||
|
|
||||||
with open(os.path.join(ROOT_DIR, "environment.sh"), "a") as myfile:
|
with open(os.path.join(ROOT_DIR, "environment.sh"), "a") as myfile:
|
||||||
myfile.write("export ANDROID_HOME=" + ANDROID_SDK + "\n")
|
if not ndk_only:
|
||||||
|
myfile.write("export ANDROID_HOME=" + ANDROID_SDK + "\n")
|
||||||
|
myfile.write("export ANDROID_SDK_ROOT=" + ANDROID_SDK + "\n")
|
||||||
myfile.write("export ANDROID_NDK_HOME=" + ANDROID_NDK + "\n")
|
myfile.write("export ANDROID_NDK_HOME=" + ANDROID_NDK + "\n")
|
||||||
myfile.write("export ANDROID_SDK_ROOT=" + ANDROID_SDK + "\n")
|
|
||||||
myfile.write("export NDK_ROOT=" + ANDROID_NDK + "\n")
|
myfile.write("export NDK_ROOT=" + ANDROID_NDK + "\n")
|
||||||
|
|
||||||
with open(os.path.join(ROOT_DIR, "environment.ps1"), "a") as myfile:
|
with open(os.path.join(ROOT_DIR, "environment.ps1"), "a") as myfile:
|
||||||
myfile.write("$env:ANDROID_HOME=\"" + ANDROID_SDK + "\"\n")
|
if not ndk_only:
|
||||||
|
myfile.write("$env:ANDROID_HOME=\"" + ANDROID_SDK + "\"\n")
|
||||||
|
myfile.write("$env:ANDROID_SDK_ROOT=\"" + ANDROID_SDK + "\"\n")
|
||||||
myfile.write("$env:ANDROID_NDK_HOME=\"" + ANDROID_NDK + "\"\n")
|
myfile.write("$env:ANDROID_NDK_HOME=\"" + ANDROID_NDK + "\"\n")
|
||||||
myfile.write("$env:ANDROID_SDK_ROOT=\"" + ANDROID_SDK + "\"\n")
|
|
||||||
myfile.write("$env:NDK_ROOT=\"" + ANDROID_NDK + "\"\n")
|
myfile.write("$env:NDK_ROOT=\"" + ANDROID_NDK + "\"\n")
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main(ndk_only):
|
||||||
run(sys.executable + " " + os.path.join(COCOS2D_X, "download-deps.py") + " --remove-download=False")
|
if not ndk_only:
|
||||||
|
run(sys.executable + " " + os.path.join(COCOS2D_X, "download-deps.py") + " --remove-download=False")
|
||||||
|
install_android_sdk_tools()
|
||||||
|
install_android_sdk()
|
||||||
install_android_ndk()
|
install_android_ndk()
|
||||||
install_android_sdk_tools()
|
export_environment(ndk_only)
|
||||||
install_android_sdk()
|
|
||||||
export_environment()
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
parser = argparse.ArgumentParser(description='Install android sdk/ndk')
|
||||||
|
parser.add_argument("--ndk_only", help="increase output verbosity", action="store_true")
|
||||||
|
args = parser.parse_args()
|
||||||
|
main(args.ndk_only)
|
||||||
|
|
|
@ -9,26 +9,11 @@ HOST_NAME=""
|
||||||
|
|
||||||
function install_android_ndk()
|
function install_android_ndk()
|
||||||
{
|
{
|
||||||
mkdir -p $HOME/bin
|
if [ "$BUILD_TARGET" == "android" ] || [ "$BUILD_TARGET" == "android_lua" ] ; then
|
||||||
cd $HOME/bin
|
python $COCOS2DX_ROOT/tools/appveyor-scripts/setup_android.py
|
||||||
|
|
||||||
# Download android ndk
|
|
||||||
if [ "$TRAVIS_OS_NAME" = "osx" ]; then
|
|
||||||
HOST_NAME="darwin"
|
|
||||||
else
|
else
|
||||||
HOST_NAME="linux"
|
python $COCOS2DX_ROOT/tools/appveyor-scripts/setup_android.py --ndk_only
|
||||||
fi
|
fi
|
||||||
|
|
||||||
FILE_NAME=android-ndk-r16-${HOST_NAME}-x86_64.zip
|
|
||||||
|
|
||||||
# the NDK is used to generate binding codes, should use r16 when fix binding codes with r16
|
|
||||||
echo "Download ${FILE_NAME} ..."
|
|
||||||
curl -O https://dl.google.com/android/repository/${FILE_NAME}
|
|
||||||
echo "Decompress ${FILE_NAME} ..."
|
|
||||||
unzip ./${FILE_NAME} > /dev/null
|
|
||||||
|
|
||||||
# Rename ndk
|
|
||||||
mv android-ndk-r16 android-ndk
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function install_linux_environment()
|
function install_linux_environment()
|
||||||
|
@ -120,7 +105,7 @@ function install_environement_for_pull_request()
|
||||||
install_linux_environment
|
install_linux_environment
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$BUILD_TARGET" == "android" ]; then
|
if [ "$BUILD_TARGET" == "android" ] || [ "$BUILD_TARGET" == "android_lua" ] ; then
|
||||||
install_android_environment
|
install_android_environment
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -138,16 +123,27 @@ function install_environement_for_pull_request()
|
||||||
# should generate binding codes & cocos_files.json after merging
|
# should generate binding codes & cocos_files.json after merging
|
||||||
function install_environement_for_after_merge()
|
function install_environement_for_after_merge()
|
||||||
{
|
{
|
||||||
echo "Building merge commit ..."
|
|
||||||
install_android_ndk
|
|
||||||
download_deps
|
|
||||||
|
|
||||||
if [ "$TRAVIS_OS_NAME" == "osx" ]; then
|
if [ "$TRAVIS_OS_NAME" == "osx" ]; then
|
||||||
upgrade_openssl_for_osx
|
upgrade_openssl_for_osx
|
||||||
install_python_module_for_osx
|
install_python_module_for_osx
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "Building merge commit ..."
|
||||||
|
install_android_ndk
|
||||||
|
download_deps
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if [ "$BUILD_TARGET" == "android_cocos_new_test" ]; then
|
||||||
|
python $COCOS2DX_ROOT/tools/appveyor-scripts/setup_android.py
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$BUILD_TARGET" == "linux_cocos_new_test" ]; then
|
||||||
|
download_deps
|
||||||
|
install_linux_environment
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
# build pull request
|
# build pull request
|
||||||
if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
|
if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
|
||||||
install_environement_for_pull_request
|
install_environement_for_pull_request
|
||||||
|
|
|
@ -16,7 +16,7 @@ function build_linux()
|
||||||
cd linux-build
|
cd linux-build
|
||||||
cmake ../..
|
cmake ../..
|
||||||
echo "cpu cores: ${CPU_CORES}"
|
echo "cpu cores: ${CPU_CORES}"
|
||||||
make -j${CPU_CORES}
|
make -j${CPU_CORES} VERBOSE=1
|
||||||
}
|
}
|
||||||
|
|
||||||
function build_mac()
|
function build_mac()
|
||||||
|
@ -41,10 +41,7 @@ function build_android()
|
||||||
{
|
{
|
||||||
# Build all samples
|
# Build all samples
|
||||||
echo "Building Android samples ..."
|
echo "Building Android samples ..."
|
||||||
export COCOS_CONSOLE_ROOT=$COCOS2DX_ROOT/tools/cocos2d-console/bin
|
source ../environment.sh
|
||||||
export ANDROID_SDK_ROOT=/usr/local/android-sdk
|
|
||||||
export COCOS_X_ROOT=$COCOS2DX_ROOT
|
|
||||||
export PATH=$ANDROID_SDK_ROOT:$COCOS_CONSOLE_ROOT:$PATH
|
|
||||||
|
|
||||||
# build cpp-empty-test
|
# build cpp-empty-test
|
||||||
# pushd $COCOS2DX_ROOT/tests/cpp-empty-test
|
# pushd $COCOS2DX_ROOT/tests/cpp-empty-test
|
||||||
|
@ -52,13 +49,8 @@ function build_android()
|
||||||
# popd
|
# popd
|
||||||
|
|
||||||
# build cpp-tests
|
# build cpp-tests
|
||||||
pushd $COCOS2DX_ROOT/tests/cpp-tests
|
pushd $COCOS2DX_ROOT/tests/cpp-tests/proj.android
|
||||||
cocos compile -p android
|
./gradlew assembleDebug
|
||||||
popd
|
|
||||||
|
|
||||||
# build lua-tests
|
|
||||||
pushd $COCOS2DX_ROOT/tests/lua-tests
|
|
||||||
cocos compile -p android
|
|
||||||
popd
|
popd
|
||||||
|
|
||||||
# build js-tests
|
# build js-tests
|
||||||
|
@ -68,6 +60,19 @@ function build_android()
|
||||||
# popd
|
# popd
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function build_android_lua()
|
||||||
|
{
|
||||||
|
# Build all samples
|
||||||
|
echo "Building Android samples lua ..."
|
||||||
|
source ../environment.sh
|
||||||
|
|
||||||
|
# build lua-tests
|
||||||
|
pushd $COCOS2DX_ROOT/tests/lua-tests/project/proj.android
|
||||||
|
./gradlew assembleDebug
|
||||||
|
popd
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
function genernate_binding_codes()
|
function genernate_binding_codes()
|
||||||
{
|
{
|
||||||
if [ $TRAVIS_OS_NAME == "linux" ]; then
|
if [ $TRAVIS_OS_NAME == "linux" ]; then
|
||||||
|
@ -82,7 +87,7 @@ function genernate_binding_codes()
|
||||||
|
|
||||||
which python
|
which python
|
||||||
|
|
||||||
export NDK_ROOT=$HOME/bin/android-ndk
|
source ../environment.sh
|
||||||
export PYTHON_BIN=/usr/bin/python
|
export PYTHON_BIN=/usr/bin/python
|
||||||
if [ "$TRAVIS_OS_NAME" == "osx" ]; then
|
if [ "$TRAVIS_OS_NAME" == "osx" ]; then
|
||||||
export PYTHON_BIN=/usr/local/bin/python
|
export PYTHON_BIN=/usr/local/bin/python
|
||||||
|
@ -191,6 +196,11 @@ function run_pull_request()
|
||||||
build_android
|
build_android
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# android_lua
|
||||||
|
if [ $BUILD_TARGET == 'android_lua' ]; then
|
||||||
|
build_android_lua
|
||||||
|
fi
|
||||||
|
|
||||||
if [ $BUILD_TARGET == 'mac' ]; then
|
if [ $BUILD_TARGET == 'mac' ]; then
|
||||||
build_mac
|
build_mac
|
||||||
fi
|
fi
|
||||||
|
@ -225,6 +235,32 @@ function run_after_merge()
|
||||||
generate_pull_request_for_binding_codes_and_cocosfiles
|
generate_pull_request_for_binding_codes_and_cocosfiles
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if [ "$BUILD_TARGET" == "android_cocos_new_test" ]; then
|
||||||
|
source ../environment.sh
|
||||||
|
pushd $COCOS2DX_ROOT
|
||||||
|
python -u tools/cocos2d-console/bin/cocos.py --agreement n new -l cpp -p my.pack.qqqq cocos_new_test
|
||||||
|
popd
|
||||||
|
pushd $COCOS2DX_ROOT/cocos_new_test/proj.android
|
||||||
|
./gradlew build
|
||||||
|
popd
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$BUILD_TARGET" == "linux_cocos_new_test" ]; then
|
||||||
|
pushd $COCOS2DX_ROOT
|
||||||
|
python -u tools/cocos2d-console/bin/cocos.py --agreement n new -l cpp -p my.pack.qqqq cocos_new_test
|
||||||
|
popd
|
||||||
|
CPU_CORES=`grep -c ^processor /proc/cpuinfo`
|
||||||
|
echo "Building tests ..."
|
||||||
|
cd $COCOS2DX_ROOT/cocos_new_test
|
||||||
|
mkdir -p linux-build
|
||||||
|
cd linux-build
|
||||||
|
cmake ..
|
||||||
|
echo "cpu cores: ${CPU_CORES}"
|
||||||
|
make -j${CPU_CORES} VERBOSE=1
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
# build pull request
|
# build pull request
|
||||||
if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
|
if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
|
||||||
run_pull_request
|
run_pull_request
|
||||||
|
|
Loading…
Reference in New Issue