forked from jasder/antlr
split appveyor ci (#3082)
* split appveyor ci * use appveyor matrix * fix config * analyze failure * fix java test job * troubleshooting * install node * troubleshooting * troubleshooting * troubleshooting * troubleshooting * troubleshooting * troubleshoot * troubleshoot * troubleshoot * troubleshoot * troubleshoot * troubleshoot * troubleshoot * almost there! * full build
This commit is contained in:
parent
5719d3496c
commit
12be1d299d
|
@ -0,0 +1,124 @@
|
||||||
|
environment:
|
||||||
|
matrix:
|
||||||
|
- job_name: java-tool-and-runtime
|
||||||
|
- job_name: csharp-runtime
|
||||||
|
job_depends_on: java-tool-and-runtime
|
||||||
|
- job_name: dart-runtime
|
||||||
|
job_depends_on: java-tool-and-runtime
|
||||||
|
- job_name: go-runtime
|
||||||
|
job_depends_on: java-tool-and-runtime
|
||||||
|
- job_name: javascript-runtime
|
||||||
|
job_depends_on: java-tool-and-runtime
|
||||||
|
- job_name: php-runtime
|
||||||
|
job_depends_on: java-tool-and-runtime
|
||||||
|
- job_name: python2-runtime
|
||||||
|
job_depends_on: java-tool-and-runtime
|
||||||
|
- job_name: python3-runtime
|
||||||
|
job_depends_on: java-tool-and-runtime
|
||||||
|
|
||||||
|
matrix:
|
||||||
|
fast_finish: false
|
||||||
|
|
||||||
|
version: '4.9.1-SNAPSHOT+AppVeyor.{build}'
|
||||||
|
cache:
|
||||||
|
- '%USERPROFILE%\.m2'
|
||||||
|
- '%USERPROFILE%\.nuget\packages -> **\project.json'
|
||||||
|
image: Visual Studio 2019
|
||||||
|
# not using MSBuild
|
||||||
|
build: off
|
||||||
|
|
||||||
|
for:
|
||||||
|
- matrix:
|
||||||
|
only:
|
||||||
|
- job_name: java-tool-and-runtime
|
||||||
|
build_script:
|
||||||
|
- mvn -q -DskipTests install --batch-mode
|
||||||
|
test_script:
|
||||||
|
- cd tool-testsuite
|
||||||
|
- mvn -q test
|
||||||
|
- cd ..\runtime-testsuite
|
||||||
|
- mvn -q -Dtest=java.* test
|
||||||
|
|
||||||
|
- matrix:
|
||||||
|
only:
|
||||||
|
- job_name: csharp-runtime
|
||||||
|
build_script:
|
||||||
|
- mvn -q -DskipTests install --batch-mode
|
||||||
|
- dotnet build runtime/CSharp/src/Antlr4.csproj -c Release
|
||||||
|
after_build:
|
||||||
|
- dotnet pack runtime/CSharp/src/Antlr4.csproj -c Release
|
||||||
|
test_script:
|
||||||
|
- cd runtime-testsuite
|
||||||
|
- mvn -q -Dtest=csharp.* test
|
||||||
|
artifacts:
|
||||||
|
- path: 'runtime\**\*.nupkg'
|
||||||
|
name: NuGet
|
||||||
|
|
||||||
|
- matrix:
|
||||||
|
only:
|
||||||
|
- job_name: dart-runtime
|
||||||
|
install:
|
||||||
|
- cinst -y dart-sdk --version=2.8.4
|
||||||
|
build_script:
|
||||||
|
- mvn -q -DskipTests install --batch-mode
|
||||||
|
test_script:
|
||||||
|
- cd runtime-testsuite
|
||||||
|
- mvn -q -Dtest=dart.* test -Dantlr-dart-dart="C:\tools\dart-sdk\bin\dart.exe" -Dantlr-dart-pub="C:\tools\dart-sdk\bin\pub.bat" -Dantlr-dart-dart2native="C:\tools\dart-sdk\bin\dart2native.bat"
|
||||||
|
|
||||||
|
- matrix:
|
||||||
|
only:
|
||||||
|
- job_name: go-runtime
|
||||||
|
build_script:
|
||||||
|
- mvn -q -DskipTests install --batch-mode
|
||||||
|
test_script:
|
||||||
|
- cd runtime-testsuite
|
||||||
|
- mvn -q -Dtest=go.* test
|
||||||
|
|
||||||
|
- matrix:
|
||||||
|
only:
|
||||||
|
- job_name: javascript-runtime
|
||||||
|
install:
|
||||||
|
- cinst nodejs.install
|
||||||
|
- node --version
|
||||||
|
- npm --version
|
||||||
|
build_script:
|
||||||
|
- cd runtime\JavaScript\
|
||||||
|
- npm install
|
||||||
|
- npm link
|
||||||
|
- cd ..\..
|
||||||
|
- mvn -q -DskipTests install --batch-mode
|
||||||
|
test_script:
|
||||||
|
- cd runtime-testsuite
|
||||||
|
- mvn -q -Dtest=javascript.* test -Dantlr-javascript-npm="C:\Program Files\nodejs\npm.cmd" -Dantlr-javascript-nodejs="C:\Program Files\nodejs\node.exe"
|
||||||
|
|
||||||
|
- matrix:
|
||||||
|
only:
|
||||||
|
- job_name: php-runtime
|
||||||
|
install:
|
||||||
|
- git clone https://github.com/antlr/antlr-php-runtime.git
|
||||||
|
- mv antlr-php-runtime runtime/PHP
|
||||||
|
- cinst -y php --params "/InstallDir:C:\tools\php"
|
||||||
|
- cinst -y composer
|
||||||
|
build_script:
|
||||||
|
- mvn -q -DskipTests install --batch-mode
|
||||||
|
test_script:
|
||||||
|
- cd runtime-testsuite
|
||||||
|
- mvn -q -Dtest=php.* test -Dantlr-php-php="C:\tools\php\php.exe"
|
||||||
|
|
||||||
|
- matrix:
|
||||||
|
only:
|
||||||
|
- job_name: python2-runtime
|
||||||
|
build_script:
|
||||||
|
- mvn -q -DskipTests install --batch-mode
|
||||||
|
test_script:
|
||||||
|
- cd runtime-testsuite
|
||||||
|
- mvn -q -Dtest=python2.* test -Dantlr-python2-python="C:\Python27\python.exe"
|
||||||
|
|
||||||
|
- matrix:
|
||||||
|
only:
|
||||||
|
- job_name: python3-runtime
|
||||||
|
build_script:
|
||||||
|
- mvn -q -DskipTests install --batch-mode
|
||||||
|
test_script:
|
||||||
|
- cd runtime-testsuite
|
||||||
|
- mvn -q -Dtest=python3.* test -Dantlr-python3-python="C:\Python35\python.exe"
|
22
appveyor.yml
22
appveyor.yml
|
@ -1,22 +0,0 @@
|
||||||
version: '4.9.1-SNAPSHOT+AppVeyor.{build}'
|
|
||||||
cache:
|
|
||||||
- '%USERPROFILE%\.m2'
|
|
||||||
- '%USERPROFILE%\.nuget\packages -> **\project.json'
|
|
||||||
image: Visual Studio 2019
|
|
||||||
build: off
|
|
||||||
install:
|
|
||||||
- git clone https://github.com/antlr/antlr-php-runtime.git
|
|
||||||
- mv antlr-php-runtime runtime/PHP
|
|
||||||
- cinst -y php --params "/InstallDir:C:\tools\php"
|
|
||||||
- cinst -y composer
|
|
||||||
- cinst -y dart-sdk --version=2.8.4
|
|
||||||
build_script:
|
|
||||||
- mvn -DskipTests install --batch-mode
|
|
||||||
- dotnet build runtime/CSharp/src/Antlr4.csproj -c Release
|
|
||||||
after_build:
|
|
||||||
- dotnet pack runtime/CSharp/src/Antlr4.csproj -c Release
|
|
||||||
test_script:
|
|
||||||
- mvn install -Dantlr-php-php="C:\tools\php\php.exe" -Dantlr-dart-dart="C:\tools\dart-sdk\bin\dart.exe" -Dantlr-dart-pub="C:\tools\dart-sdk\bin\pub.bat" -Dantlr-dart-dart2native="C:\tools\dart-sdk\bin\dart2native.bat" -Dantlr-python2-python="C:\Python27\python.exe" -Dantlr-python3-python="C:\Python35\python.exe" --batch-mode
|
|
||||||
artifacts:
|
|
||||||
- path: 'runtime\**\*.nupkg'
|
|
||||||
name: NuGet
|
|
|
@ -87,13 +87,13 @@ public abstract class BaseRuntimeTest {
|
||||||
public void run() {
|
public void run() {
|
||||||
heartbeat = true;
|
heartbeat = true;
|
||||||
while (heartbeat) {
|
while (heartbeat) {
|
||||||
System.out.print('.');
|
|
||||||
try {
|
try {
|
||||||
//noinspection BusyWait
|
//noinspection BusyWait
|
||||||
Thread.sleep(5000);
|
Thread.sleep(10000);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
System.out.print('.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -16,6 +16,8 @@ import org.junit.runner.Description;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.LinkOption;
|
||||||
|
import java.nio.file.Path;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
@ -161,14 +163,19 @@ public abstract class BaseRuntimeTestSupport implements RuntimeTestSupport {
|
||||||
|
|
||||||
private static void eraseFile(File dir, String name) throws IOException {
|
private static void eraseFile(File dir, String name) throws IOException {
|
||||||
File file = new File(dir,name);
|
File file = new File(dir,name);
|
||||||
if(Files.isSymbolicLink(file.toPath()))
|
if(Files.isSymbolicLink((file.toPath())))
|
||||||
Files.delete(file.toPath());
|
Files.delete(file.toPath());
|
||||||
else if(file.isDirectory())
|
else if(file.isDirectory()) {
|
||||||
eraseDirectory(file);
|
// work around issue where Files.isSymbolicLink returns false on Windows for node/antlr4 linked package
|
||||||
else
|
if("antlr4".equals(name))
|
||||||
|
; // logger.warning("antlr4 not seen as a symlink");
|
||||||
|
else
|
||||||
|
eraseDirectory(file);
|
||||||
|
} else
|
||||||
file.delete();
|
file.delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static String detectedOS;
|
private static String detectedOS;
|
||||||
|
|
||||||
public static String getOS() {
|
public static String getOS() {
|
||||||
|
|
|
@ -6,6 +6,10 @@ public abstract class TestContext {
|
||||||
return "true".equals(String.valueOf(System.getenv("TRAVIS")).toLowerCase());
|
return "true".equals(String.valueOf(System.getenv("TRAVIS")).toLowerCase());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isGitHubCI() {
|
||||||
|
return "true".equals(String.valueOf(System.getenv("CI")).toLowerCase());
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean isAppVeyorCI() {
|
public static boolean isAppVeyorCI() {
|
||||||
return "true".equals(String.valueOf(System.getenv("APPVEYOR")).toLowerCase());
|
return "true".equals(String.valueOf(System.getenv("APPVEYOR")).toLowerCase());
|
||||||
}
|
}
|
||||||
|
@ -14,9 +18,14 @@ public abstract class TestContext {
|
||||||
return "true".equals(String.valueOf(System.getenv("CIRCLECI")).toLowerCase());
|
return "true".equals(String.valueOf(System.getenv("CIRCLECI")).toLowerCase());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isCI() {
|
||||||
|
return isAppVeyorCI() || isCircleCI() || isGitHubCI() || isTravisCI();
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("BooleanMethodIsAlwaysInverted")
|
||||||
public static boolean isSupportedTarget(String target) {
|
public static boolean isSupportedTarget(String target) {
|
||||||
if(isAppVeyorCI())
|
if(isAppVeyorCI())
|
||||||
return !target.matches("Swift|Node");
|
return !target.matches("Swift");
|
||||||
else
|
else
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
*/
|
*/
|
||||||
package org.antlr.v4.test.runtime.javascript;
|
package org.antlr.v4.test.runtime.javascript;
|
||||||
|
|
||||||
|
import org.antlr.v4.runtime.misc.Utils;
|
||||||
import org.antlr.v4.test.runtime.*;
|
import org.antlr.v4.test.runtime.*;
|
||||||
import org.stringtemplate.v4.ST;
|
import org.stringtemplate.v4.ST;
|
||||||
|
|
||||||
|
@ -121,7 +122,7 @@ public class BaseNodeTest extends BaseRuntimeTestSupport implements RuntimeTestS
|
||||||
public String execModule(String fileName) {
|
public String execModule(String fileName) {
|
||||||
try {
|
try {
|
||||||
String npmPath = locateNpm();
|
String npmPath = locateNpm();
|
||||||
if(!TestContext.isTravisCI() && !TestContext.isCircleCI()) {
|
if(!TestContext.isCI()) {
|
||||||
installRuntime(npmPath);
|
installRuntime(npmPath);
|
||||||
registerRuntime(npmPath);
|
registerRuntime(npmPath);
|
||||||
}
|
}
|
||||||
|
@ -203,7 +204,8 @@ public class BaseNodeTest extends BaseRuntimeTestSupport implements RuntimeTestS
|
||||||
args.addAll(Arrays.asList(npmPath, "link", "antlr4"));
|
args.addAll(Arrays.asList(npmPath, "link", "antlr4"));
|
||||||
ProcessBuilder builder = new ProcessBuilder(args.toArray(new String[0]));
|
ProcessBuilder builder = new ProcessBuilder(args.toArray(new String[0]));
|
||||||
builder.directory(getTempTestDir());
|
builder.directory(getTempTestDir());
|
||||||
builder.redirectError(new File(getTempTestDir(), "error.txt"));
|
File errorFile = new File(getTempTestDir(), "error.txt");
|
||||||
|
builder.redirectError(errorFile);
|
||||||
builder.redirectOutput(new File(getTempTestDir(), "output.txt"));
|
builder.redirectOutput(new File(getTempTestDir(), "output.txt"));
|
||||||
Process process = builder.start();
|
Process process = builder.start();
|
||||||
// TODO switch to jdk 8
|
// TODO switch to jdk 8
|
||||||
|
@ -211,8 +213,10 @@ public class BaseNodeTest extends BaseRuntimeTestSupport implements RuntimeTestS
|
||||||
// if(!process.waitFor(30L, TimeUnit.SECONDS))
|
// if(!process.waitFor(30L, TimeUnit.SECONDS))
|
||||||
// process.destroyForcibly();
|
// process.destroyForcibly();
|
||||||
int error = process.exitValue();
|
int error = process.exitValue();
|
||||||
if(error!=0)
|
if(error!=0) {
|
||||||
throw new IOException("'npm link antlr4' failed");
|
char[] errors = Utils.readFile(errorFile.getAbsolutePath());
|
||||||
|
throw new IOException("'npm link antlr4' failed: " + new String(errors));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean canExecute(String tool) {
|
private boolean canExecute(String tool) {
|
||||||
|
@ -237,6 +241,8 @@ public class BaseNodeTest extends BaseRuntimeTestSupport implements RuntimeTestS
|
||||||
// typically /usr/local/bin/npm
|
// typically /usr/local/bin/npm
|
||||||
String prop = System.getProperty("antlr-javascript-npm");
|
String prop = System.getProperty("antlr-javascript-npm");
|
||||||
if ( prop!=null && prop.length()!=0 ) {
|
if ( prop!=null && prop.length()!=0 ) {
|
||||||
|
if(prop.contains(" "))
|
||||||
|
prop = "\"" + prop + "\"";
|
||||||
return prop;
|
return prop;
|
||||||
}
|
}
|
||||||
return "npm"; // everywhere
|
return "npm"; // everywhere
|
||||||
|
@ -246,6 +252,8 @@ public class BaseNodeTest extends BaseRuntimeTestSupport implements RuntimeTestS
|
||||||
// typically /usr/local/bin/node
|
// typically /usr/local/bin/node
|
||||||
String prop = System.getProperty("antlr-javascript-nodejs");
|
String prop = System.getProperty("antlr-javascript-nodejs");
|
||||||
if ( prop!=null && prop.length()!=0 ) {
|
if ( prop!=null && prop.length()!=0 ) {
|
||||||
|
if(prop.contains(" "))
|
||||||
|
prop = "\"" + prop + "\"";
|
||||||
return prop;
|
return prop;
|
||||||
}
|
}
|
||||||
if (canExecute("nodejs")) {
|
if (canExecute("nodejs")) {
|
||||||
|
|
Loading…
Reference in New Issue