Explorar el Código

try different php versions (#9523)

Aleksandr Kuzmenko hace 5 años
padre
commit
94f9490773
Se han modificado 1 ficheros con 16 adiciones y 11 borrados
  1. 16 11
      tests/runci/targets/Php.hx

+ 16 - 11
tests/runci/targets/Php.hx

@@ -47,7 +47,7 @@ class Php {
 		getPhpDependencies();
 
 		changeDirectory(miscPhpDir);
-		runThroughPhpVersions(runCommand.bind("haxe", ["run.hxml"]));
+		runCommand("haxe", ["run.hxml"]);
 
 		var binDir = "bin/php";
 
@@ -64,25 +64,30 @@ class Php {
 			}
 
 			runCommand("haxe", ["compile-php.hxml"].concat(prefix).concat(args));
-			runThroughPhpVersions(runCommand.bind("php", [binDir + "/index.php"]));
+			runThroughPhpVersions(runCommand.bind(_, [binDir + "/index.php"]));
 
 			changeDirectory(sysDir);
 			if(isCi()) {
 				deleteDirectoryRecursively(binDir);
 			}
 			runCommand("haxe", ["compile-php.hxml"].concat(prefix).concat(args));
-			runThroughPhpVersions(runCommand.bind("php", ["bin/php/Main/index.php"]));
+			runThroughPhpVersions(runCommand.bind(_, ["bin/php/Main/index.php"]));
 		}
 	}
 
-	static function runThroughPhpVersions(fn:()->Void) {
-		if(ci == TravisCI && systemName == "Linux") {
-			for(version in ['7.0', '7.1'/*, '7.2', '7.3'*/]) { //7.2 and 7.3 are not available on travis Ubuntu trusty
-				runCommand("phpenv", ["global", version]);
-				fn();
-			}
-		} else {
-			fn();
+	static function runThroughPhpVersions(fn:(phpCmd:String)->Void) {
+		switch [ci, systemName] {
+			case [TravisCI, "Linux"]:
+				for(version in ['7.0', '7.1'/*, '7.2', '7.3'*/]) { //7.2 and 7.3 are not available on travis Ubuntu trusty
+					runCommand("phpenv", ["global", version]);
+					fn('php');
+				}
+			case [GithubActions, "Linux"]:
+				for(version in ['7.1', '7.2', '7.3', '7.4']) {
+					fn('php$version');
+				}
+			case _:
+				fn('php');
 		}
 	}
 }