Skip to content

Commit

Permalink
Merge branch 'travis' into development
Browse files Browse the repository at this point in the history
  • Loading branch information
andyli committed May 20, 2014
2 parents 23f1659 + a739cd8 commit 9ed42c9
Show file tree
Hide file tree
Showing 2 changed files with 98 additions and 24 deletions.
15 changes: 10 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
language: node_js
language: cpp

os:
- linux
- osx

env:
global:
Expand All @@ -24,12 +28,13 @@ matrix:
fast_finish: true
allow_failures:
- env: TEST=flash8
- os: osx

install:
- travis_retry sudo apt-get update
- travis_retry sudo apt-get install ocaml zlib1g-dev libgc-dev -y
- travis_retry git clone https://github.com/HaxeFoundation/neko.git ~/neko
- cd ~/neko && make && sudo make install && cd $TRAVIS_BUILD_DIR
- if [ "${TRAVIS_OS_NAME}" = "linux" ]; then travis_retry sudo apt-get update; travis_retry sudo apt-get install ocaml zlib1g-dev libgc-dev -y; fi
- if [ "${TRAVIS_OS_NAME}" = "osx" ]; then travis_retry brew update; travis_retry brew install phinze/cask/brew-cask && travis_retry brew cask install xquartz; travis_retry brew install ocaml; fi
- if [ "${TRAVIS_OS_NAME}" = "linux" ]; then travis_retry git clone https://github.com/HaxeFoundation/neko.git ~/neko && cd ~/neko && make os=${TRAVIS_OS_NAME} && sudo make install && cd $TRAVIS_BUILD_DIR; fi
- if [ "${TRAVIS_OS_NAME}" = "osx" ]; then travis_retry brew install neko --HEAD; fi

script:
- make
Expand Down
107 changes: 88 additions & 19 deletions tests/RunTravis.hx
Original file line number Diff line number Diff line change
Expand Up @@ -127,21 +127,50 @@ class RunTravis {
}

static function setupFlashPlayerDebugger():Void {
Sys.putEnv("DISPLAY", ":99.0");
runCommand("sh", ["-e", "/etc/init.d/xvfb", "start"]);
Sys.putEnv("AUDIODEV", "null");
runCommand("sudo", ["apt-get", "install", "-qq", "libgd2-xpm", "ia32-libs", "ia32-libs-multiarch", "-y"], true);
runCommand("wget", ["-nv", "http://fpdownload.macromedia.com/pub/flashplayer/updaters/11/flashplayer_11_sa_debug.i386.tar.gz"], true);
runCommand("tar", ["-xf", "flashplayer_11_sa_debug.i386.tar.gz", "-C", Sys.getEnv("HOME")]);
File.saveContent(Sys.getEnv("HOME") + "/mm.cfg", "ErrorReportingEnable=1\nTraceOutputFileEnable=1");
runCommand(Sys.getEnv("HOME") + "/flashplayerdebugger", ["-v"]);
var mmcfgPath = switch (systemName) {
case "Linux":
Sys.getEnv("HOME") + "/mm.cfg";
case "Mac":
"/Library/Application Support/Macromedia/mm.cfg";
case _:
throw "unsupported system";
}

switch (systemName) {
case "Linux":
Sys.putEnv("DISPLAY", ":99.0");
runCommand("sh", ["-e", "/etc/init.d/xvfb", "start"]);
Sys.putEnv("AUDIODEV", "null");
runCommand("sudo", ["apt-get", "install", "-qq", "libgd2-xpm", "ia32-libs", "ia32-libs-multiarch", "-y"], true);
runCommand("wget", ["-nv", "http://fpdownload.macromedia.com/pub/flashplayer/updaters/11/flashplayer_11_sa_debug.i386.tar.gz"], true);
runCommand("tar", ["-xf", "flashplayer_11_sa_debug.i386.tar.gz", "-C", Sys.getEnv("HOME")]);
File.saveContent(mmcfgPath, "ErrorReportingEnable=1\nTraceOutputFileEnable=1");
runCommand(Sys.getEnv("HOME") + "/flashplayerdebugger", ["-v"]);
case "Mac":
runCommand("brew", ["cask", "install", "flash-player-debugger"]);
runCommand("sudo", ["mkdir", "-p", Path.directory(mmcfgPath)]);
runCommand("printf", ["ErrorReportingEnable=1\nTraceOutputFileEnable=1" , "|", "sudo", "tee", mmcfgPath, ">", "/dev/null"]);
}
}

static function runFlash(swf:String):Void {
Sys.command(Sys.getEnv("HOME") + "/flashplayerdebugger", [swf, "&"]);
switch (systemName) {
case "Linux":
Sys.command(Sys.getEnv("HOME") + "/flashplayerdebugger", [swf, "&"]);
case "Mac":
Sys.command("open", ["-a", Sys.getEnv("HOME") + "/Applications/Flash Player Debugger.app", swf]);
}

//wait a little until flashlog.txt is created
var flashlogPath = Sys.getEnv("HOME") + "/.macromedia/Flash_Player/Logs/flashlog.txt";
var flashlogPath = switch (systemName) {
case "Linux":
Sys.getEnv("HOME") + "/.macromedia/Flash_Player/Logs/flashlog.txt";
case "Mac":
Sys.getEnv("HOME") + "/Library/Preferences/Macromedia/Flash Player/Logs/flashlog.txt";
case _:
throw "unsupported system";
}

for (t in 0...5) {
runCommand("sleep", ["2"]);
if (FileSystem.exists(flashlogPath))
Expand All @@ -153,7 +182,7 @@ class RunTravis {
}

//read flashlog.txt continously
var traceProcess = new Process("tail", ["-f", "-v", flashlogPath]);
var traceProcess = new Process("tail", ["-f", flashlogPath]);
var line = "";
while (true) {
try {
Expand Down Expand Up @@ -231,15 +260,26 @@ class RunTravis {
}

static function getPhpDependencies() {
runCommand("sudo", ["apt-get", "install", "php5", "-y"], true);
switch (systemName) {
case "Linux":
runCommand("sudo", ["apt-get", "install", "php5", "-y"], true);
case "Mac":
//pass
}
}

static var gotCppDependencies = false;
static function getCppDependencies() {
if (gotCppDependencies) return;

//hxcpp dependencies
runCommand("sudo", ["apt-get", "install", "gcc-multilib", "g++-multilib", "-y"], true);
switch (systemName) {
case "Linux":
runCommand("sudo", ["apt-get", "install", "gcc-multilib", "g++-multilib", "-y"], true);
case "Mac":
//pass
}


//install and build hxcpp
haxelibInstallGit("HaxeFoundation", "hxcpp", true);
Expand All @@ -255,8 +295,23 @@ class RunTravis {
haxelibInstallGit("HaxeFoundation", "hxjava", true);
}

static function getJSDependencies() {
switch (systemName) {
case "Linux":
runCommand("sudo", ["apt-get", "install", "nodejs", "-y"], true);
case "Mac":
//pass
}
}

static function getCsDependencies() {
runCommand("sudo", ["apt-get", "install", "mono-devel", "mono-mcs", "-y"], true);
switch (systemName) {
case "Linux":
runCommand("sudo", ["apt-get", "install", "mono-devel", "mono-mcs", "-y"], true);
case "Mac":
runCommand("brew", ["install", "mono"], true);
}

haxelibInstallGit("HaxeFoundation", "hxcs", true);
}

Expand All @@ -276,18 +331,30 @@ class RunTravis {
haxelibInstallGit("openfl", "openfl-html5");
haxelibInstallGit("openfl", "openfl");

haxelibRun(["openfl", "rebuild", "linux"]);
switch (systemName) {
case "Linux":
haxelibRun(["openfl", "rebuild", "linux"]);
case "Mac":
haxelibRun(["openfl", "rebuild", "mac"]);
}
haxelibRun(["openfl", "rebuild", "tools"]);

gotOpenFLDependencies = true;
}

static function getPythonDependencies() {
runCommand("sudo", ["apt-get", "install", "python3", "-y"], true);
runCommand("python", ["-V"]);
switch (systemName) {
case "Linux":
runCommand("sudo", ["apt-get", "install", "python3", "-y"], true);
case "Mac":
runCommand("brew", ["install", "python3"], true);
}

runCommand("python3", ["-V"]);
}

static var test(default, never):TEST = Sys.getEnv("TEST");
static var systemName(default, never) = Sys.systemName();
static var repoDir(default, never) = Sys.getEnv("TRAVIS_BUILD_DIR");
static var cwd(default, never) = Sys.getCwd();
static var unitDir(default, never) = cwd + "unit/";
Expand Down Expand Up @@ -364,10 +431,11 @@ class RunTravis {
changeDirectory("bin/cpp");
runCommand("./Main-debug", ["foo", "12", "a b c\\\\"]);
case Js:
getJSDependencies();
runCommand("haxe", ["compile-js.hxml"]);
runCommand("node", ["-e", "var unit = require('./unit.js').unit; unit.Test.main(); process.exit(unit.Test.success ? 0 : 1);"]);

if (Sys.getEnv("TRAVIS_SECURE_ENV_VARS") == "true") {
if (Sys.getEnv("TRAVIS_SECURE_ENV_VARS") == "true" && systemName == "Linux") {
//https://saucelabs.com/opensource/travis
runCommand("npm", ["install", "wd"], true);
runCommand("curl", ["https://gist.github.com/santiycr/5139565/raw/sauce_connect_setup.sh", "-L", "|", "bash"], true);
Expand Down Expand Up @@ -419,13 +487,14 @@ class RunTravis {
case ThirdParty:
getPhpDependencies();
getJavaDependencies();
getJSDependencies();
getCsDependencies();
getPythonDependencies();
getCppDependencies();
getOpenFLDependencies();

testPolygonalDs();
testFlambe();
if (systemName == "Linux") testFlambe();
testHxTemplo();
testMUnit();
//testOpenflSamples();
Expand Down

0 comments on commit 9ed42c9

Please sign in to comment.