Prechádzať zdrojové kódy

TravisCI: Move RunTravis to /tests

Andy Li 11 rokov pred
rodič
commit
f98d5a3b30
2 zmenil súbory, kde vykonal 11 pridanie a 4 odobranie
  1. 1 1
      .travis.yml
  2. 10 3
      tests/RunTravis.hx

+ 1 - 1
.travis.yml

@@ -29,7 +29,7 @@ script:
   - make
   - make tools
   - sudo make install
-  - cd tests/unit/
+  - cd tests/
   - mkdir ~/haxelib && haxelib setup ~/haxelib
   - haxe -version
   - haxe -main RunTravis --interp

+ 10 - 3
tests/unit/RunTravis.hx → tests/RunTravis.hx

@@ -1,6 +1,10 @@
 import sys.*;
 import sys.io.*;
 
+/**
+	Will be run by TravisCI.
+	See ".travis.yml" at project root for TravisCI settings.
+*/
 class RunTravis {
 	static function runCommand(cmd:String, args:Array<String>):Void {
 		var exitCode = Sys.command(cmd, args);
@@ -57,6 +61,10 @@ class RunTravis {
 
 	static function main():Void {
 		var cwd = Sys.getCwd();
+		var unitDir = cwd + "unit/";
+		var optDir = cwd + "optimization/";
+
+		Sys.setCwd(unitDir);
 		switch (Sys.getEnv("TARGET")) {
 			case "macro", null:
 				runCommand("haxe", ["compile-macro.hxml"]);
@@ -75,7 +83,7 @@ class RunTravis {
 				runCommand("haxelib", ["git", "hxcpp", "https://github.com/HaxeFoundation/hxcpp.git"]);
 				Sys.setCwd(Sys.getEnv("HOME") + "/haxelib/hxcpp/git/runtime/");
 				runCommand("haxelib", ["run", "hxcpp", "BuildLibs.xml"]);
-				Sys.setCwd(cwd);
+				Sys.setCwd(unitDir);
 				
 				runCommand("haxe", ["compile-cpp.hxml"]);
 				runCommand("./cpp/Test-debug", []);
@@ -84,9 +92,8 @@ class RunTravis {
 				runCommand("node", ["-e", "var unit = require('./unit.js').unit; unit.Test.main(); process.exit(unit.Test.success ? 0 : 1);"]);
 
 				Sys.println("Test optimization:");
-				Sys.setCwd("../optimization/");
+				Sys.setCwd(optDir);
 				runCommand("haxe", ["run.hxml"]);
-				Sys.setCwd(cwd);
 			case "java":
 				runCommand("haxelib", ["git", "hxjava", "https://github.com/HaxeFoundation/hxjava.git"]);
 				runCommand("haxe", ["compile-java.hxml"]);