Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure Github CI to run tests on Windows #75

Merged
merged 1 commit into from
Apr 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 91 additions & 5 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ on:
schedule:
- cron: '0 23 * * *'
jobs:
build-released-jvm:
name: JVM build - released Quarkus
linux-build-released-jvm:
name: Linux - JVM build - released Quarkus
runs-on: ubuntu-latest
strategy:
matrix:
Expand Down Expand Up @@ -35,8 +35,8 @@ jobs:
with:
name: ci-artifacts
path: artifacts-jvm${{ matrix.java }}.zip
build-released-native:
name: Native build - released Quarkus
linux-build-released-native:
name: Linux - Native build - released Quarkus
runs-on: ubuntu-latest
strategy:
matrix:
Expand Down Expand Up @@ -96,4 +96,90 @@ jobs:
if: failure()
with:
name: ci-artifacts
path: artifacts-code-start${{ matrix.java }}.zip
path: artifacts-code-start${{ matrix.java }}.zip
windows-build-released-jvm:
name: Windows - JVM build - released Quarkus
runs-on: windows-latest
strategy:
matrix:
java: [ 11 ]
steps:
- uses: actions/checkout@v1
- uses: actions/cache@v1
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Install JDK {{ matrix.java }}
uses: joschi/setup-jdk@e87a7cec853d2dd7066adf837fe12bf0f3d45e52
with:
java-version: ${{ matrix.java }}
- name: Build with Maven
shell: bash
run: |
mvn -V -B -s .github/mvn-settings.xml clean verify -DexcludeTags='product,native,codequarkus'
- name: Zip Artifacts
if: failure()
shell: bash
run: |
# Disambiguate windows find from cygwin find
/usr/bin/find . -name '*-reports' -o -name 'archived-logs' -type d | tar -czf artifacts-windows-jvm${{ matrix.java }}.tar -T -
- name: Archive artifacts
uses: actions/upload-artifact@v1
if: failure()
with:
name: ci-artifacts
path: artifacts-windows-jvm${{ matrix.java }}.tar
windows-build-released-native:
name: Windows - Native build - released Quarkus
runs-on: windows-latest
strategy:
matrix:
java: [ 11 ]
# Version 21.1 is not working due to https://github.com/quarkusio/quarkus/issues/14904
graalvm-version: [ "21.0.0.2.java11" ]
steps:
- uses: actions/checkout@v1
- uses: actions/cache@v1
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Install JDK {{ matrix.java }}
uses: joschi/setup-jdk@e87a7cec853d2dd7066adf837fe12bf0f3d45e52
with:
java-version: ${{ matrix.java }}
- name: Install cl.exe
uses: ilammy/msvc-dev-cmd@v1
- uses: microsoft/setup-msbuild@v1
- name: Setup GraalVM
id: setup-graalvm
uses: DeLaGuardo/setup-graalvm@master
with:
graalvm-version: ${{ matrix.graalvm-version }}
java: java${{ matrix.graalvm-version }}
- name: Install native-image component
run: |
gu.cmd install native-image
- name: Configure Pagefile
# Increased the page-file size due to memory-consumption of native-image command
# For details see https://github.com/actions/virtual-environments/issues/785
uses: al-cheb/[email protected]
- name: Build with Maven
run: |
mvn -V -B -s .github/mvn-settings.xml clean verify -DexcludeTags="product,codequarkus" -Dquarkus.native.native-image-xmx=6g
shell: cmd
- name: Zip Artifacts
if: failure()
shell: bash
run: |
# Disambiguate windows find from cygwin find
/usr/bin/find . -name '*-reports' -o -name 'archived-logs' -type d | tar -czf artifacts-windows-native${{ matrix.java }}.tar -T -
- name: Archive artifacts
uses: actions/upload-artifact@v1
if: failure()
with:
name: ci-artifacts
path: artifacts-windows-native${{ matrix.java }}.tar
6 changes: 4 additions & 2 deletions app-full-microprofile/threshold.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@ linux.jvm.time.to.first.ok.request.threshold.ms=2600
linux.jvm.RSS.threshold.kB=550000
linux.native.time.to.first.ok.request.threshold.ms=60
linux.native.RSS.threshold.kB=120000
windows.jvm.time.to.first.ok.request.threshold.ms=2500
windows.jvm.RSS.threshold.kB=4000
windows.jvm.time.to.first.ok.request.threshold.ms=4500
windows.jvm.RSS.threshold.kB=4600
windows.native.time.to.first.ok.request.threshold.ms=1600
windows.native.RSS.threshold.kB=120000
6 changes: 4 additions & 2 deletions app-jax-rs-minimal/threshold.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@ linux.jvm.time.to.first.ok.request.threshold.ms=2000
linux.jvm.RSS.threshold.kB=380000
linux.native.time.to.first.ok.request.threshold.ms=35
linux.native.RSS.threshold.kB=90000
windows.jvm.time.to.first.ok.request.threshold.ms=2000
windows.jvm.RSS.threshold.kB=4000
windows.jvm.time.to.first.ok.request.threshold.ms=4500
windows.jvm.RSS.threshold.kB=4500
windows.native.time.to.first.ok.request.threshold.ms=800
windows.native.RSS.threshold.kB=90000
33 changes: 21 additions & 12 deletions testsuite/src/it/java/io/quarkus/ts/startstop/SpecialCharsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,7 @@ public void testRuntime(TestInfo testInfo, Apps app, MvnCmds mvnCmds, String sub
// Clean target directory
cleanTarget(app);

// Delete dir with special chars
if (appDestDir.exists()) {
FileUtils.deleteDirectory(appDestDir);
}
removeDirWithSpecialCharacters(appDestDir);

// Make dir with special chars
if (!appDestDir.mkdir()) {
Expand Down Expand Up @@ -155,28 +152,24 @@ public void testRuntime(TestInfo testInfo, Apps app, MvnCmds mvnCmds, String sub
}
writeReport(cn, mn, whatIDidReport.toString());

// Remove dir with special chars
if (appDestDir.exists()) {
FileUtils.deleteDirectory(appDestDir);
}
removeDirWithSpecialCharacters(appDestDir);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Explanation about this change in PR description

}
}


@Test
public void spacesJVM(TestInfo testInfo) throws IOException, InterruptedException {
testRuntime(testInfo, Apps.JAX_RS_MINIMAL, MvnCmds.JVM, "s p a c e s");
testRuntime(testInfo, Apps.JAX_RS_MINIMAL, MvnCmds.JVM, "s p a c e s j v m");
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Explanation about this change in PR description

}

@Test
public void spacesDEV(TestInfo testInfo) throws IOException, InterruptedException {
testRuntime(testInfo, Apps.JAX_RS_MINIMAL, MvnCmds.DEV, "s p a c e s");
testRuntime(testInfo, Apps.JAX_RS_MINIMAL, MvnCmds.DEV, "s p a c e s d e v");
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Explanation about this change in PR description

}

@Test
@Tag("native")
public void spacesNative(TestInfo testInfo) throws IOException, InterruptedException {
testRuntime(testInfo, Apps.JAX_RS_MINIMAL, MvnCmds.NATIVE, "s p a c e s");
testRuntime(testInfo, Apps.JAX_RS_MINIMAL, MvnCmds.NATIVE, "s p a c e s n a t i v e");
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Explanation about this change in PR description

}

@Test
Expand All @@ -193,6 +186,7 @@ public void specialDEV(TestInfo testInfo) throws IOException, InterruptedExcepti

@Test
@Tag("native")
@DisabledOnOs({OS.WINDOWS}) // https://github.com/quarkusio/quarkus/issues/9707
public void specialNative(TestInfo testInfo) throws IOException, InterruptedException {
testRuntime(testInfo, Apps.JAX_RS_MINIMAL, MvnCmds.NATIVE, ",;~!@#$%^&()");
}
Expand All @@ -203,12 +197,14 @@ public void diacriticsJVM(TestInfo testInfo) throws IOException, InterruptedExce
}

@Test
@DisabledOnOs({OS.WINDOWS}) // https://github.com/quarkusio/quarkus/issues/9707
public void diacriticsDEV(TestInfo testInfo) throws IOException, InterruptedException {
testRuntime(testInfo, Apps.JAX_RS_MINIMAL, MvnCmds.DEV, "ěščřžýáíéůú");
}

@Test
@Tag("native")
@DisabledOnOs({OS.WINDOWS}) // https://github.com/quarkusio/quarkus/issues/9707
public void diacriticsNative(TestInfo testInfo) throws IOException, InterruptedException {
testRuntime(testInfo, Apps.JAX_RS_MINIMAL, MvnCmds.NATIVE, "ěščřžýáíéůú");
}
Expand All @@ -226,6 +222,7 @@ public void japaneseDEV(TestInfo testInfo) throws IOException, InterruptedExcept

@Test
@Tag("native")
@DisabledOnOs({OS.WINDOWS}) // https://github.com/quarkusio/quarkus/issues/9707
public void japaneseNative(TestInfo testInfo) throws IOException, InterruptedException {
testRuntime(testInfo, Apps.JAX_RS_MINIMAL, MvnCmds.NATIVE, "元気かい");
}
Expand All @@ -243,8 +240,20 @@ public void otherDEV(TestInfo testInfo) throws IOException, InterruptedException

@Test
@Tag("native")
@DisabledOnOs({OS.WINDOWS}) // https://github.com/quarkusio/quarkus/issues/9707
public void otherNative(TestInfo testInfo) throws IOException, InterruptedException {
testRuntime(testInfo, Apps.JAX_RS_MINIMAL, MvnCmds.NATIVE, "Îñţérñåţîöñåļîžåţîờñ");
}

private void removeDirWithSpecialCharacters(File appDestDir) {
// Remove dir with special chars
try {
if (appDestDir.exists()) {
FileUtils.deleteDirectory(appDestDir);
}
} catch (IOException ignored) {
// ignored when the folder could not be deleted.
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,13 @@ public LogBuilder startedInMs(long startedInMs) {
}

public LogBuilder stoppedInMs(long stoppedInMs) {
// Quarkus is not being gratefully shutdown in Windows when running in Dev mode.
// Reported by https://github.com/quarkusio/quarkus/issues/14647.
if (stoppedInMs <= 0 && Commands.isThisWindows) {
// do nothing in Windows
return this;
}

if (stoppedInMs <= 0) {
throw new IllegalArgumentException("stoppedInMs must be a positive long, was: " + stoppedInMs);
}
Expand Down
13 changes: 13 additions & 0 deletions testsuite/src/it/java/io/quarkus/ts/startstop/utils/Logs.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import static io.quarkus.ts.startstop.StartStopTest.BASE_DIR;
import static io.quarkus.ts.startstop.utils.Commands.isThisWindows;
Expand Down Expand Up @@ -72,6 +73,7 @@ public class Logs {
private static final Pattern stoppedPatternControlSymbols = Pattern.compile(".* stopped in .*188m([0-9\\.]+).*", Pattern.DOTALL);

private static final Pattern warnErrorDetectionPattern = Pattern.compile("(?i:.*(ERROR|WARN|SLF4J:).*)");
private static final Pattern devModeError = Pattern.compile(".*Failed to run: Dev mode process did not complete successfully.*");
private static final Pattern listeningOnDetectionPattern = Pattern.compile("(?i:.*Listening on:.*)");
private static final Pattern devExpectedHostPattern = Pattern.compile("(?i:.*localhost:.*)");
private static final Pattern defaultExpectedHostPattern = Pattern.compile("(?i:.*0.0.0.0:.*)");
Expand All @@ -94,6 +96,13 @@ public static void checkLog(String testClass, String testMethod, Apps app, MvnCm
}
}
}

// Randomly fails when vertx-cache temporary directory exists. Related to https://github.com/quarkusio/quarkus/issues/7678
// And https://github.com/quarkusio/quarkus/pull/15541/files#diff-a38e0d86cf6a637c19b6e0a0e23959f644886bdcc0f0e5615ce7cfa0e6bc9909R244
if (Commands.isThisWindows && isDevModeError(offendingLines)) {
Stream.of(WhitelistLogLines.WINDOWS_DEV_MODE_ERRORS.errs).forEach(lineToIgnore -> offendingLines.removeIf(line -> lineToIgnore.matcher(line).matches()));
}

assertTrue(offendingLines.isEmpty(),
cmd.name() + " log should not contain error or warning lines that are not whitelisted. " +
"See testsuite" + File.separator + "target" + File.separator + "archived-logs" +
Expand Down Expand Up @@ -125,6 +134,10 @@ public static void checkListeningHost(String testClass, String testMethod, MvnCm
" and check the listening host.");
}

private static boolean isDevModeError(Set<String> offendingLines) {
return offendingLines.stream().anyMatch(line -> devModeError.matcher(line).matches());
}

private static boolean isWhiteListed(Pattern[] patterns, String line) {
for (Pattern p : patterns) {
if (p.matcher(line).matches()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,24 @@ public enum WhitelistLogLines {
// (no explicit configuration, none or multiple JDBC driver extensions)
// Result of DevServices support https://github.com/quarkusio/quarkus/pull/14960
Pattern.compile(".*Unable to determine a database type for default datasource.*"),
}),
// Quarkus is not being gratefully shutdown in Windows when running in Dev mode.
// Reported by https://github.com/quarkusio/quarkus/issues/14647.
WINDOWS_DEV_MODE_ERRORS(new Pattern[]{
Pattern.compile(".*Re-run Maven using the -X switch to enable full debug logging.*"),
Sgitario marked this conversation as resolved.
Show resolved Hide resolved
Pattern.compile(".*For more information about the errors and possible solutions, please read the following articles.*"),
Pattern.compile(".*Failed to run: Dev mode process did not complete successfully.*"),
Pattern.compile(".*http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException.*"),
Pattern.compile(".*To see the full stack trace of the errors, re-run Maven with the -e switch.*"),
Pattern.compile("\\[ERROR\\] *"),
});

// Depending to the OS and also on the Quarkus extensions, the Native build might print some warnings about duplicate entries
private static final Pattern COMMON_WARNING_DUPLICATE_ENTRY_NATIVE = Pattern.compile(".*Duplicate entry about.html entry.*");
private static final Pattern COMMON_WARNING_DUPLICATE_ENTRIES_NATIVE = Pattern.compile(".*Dependencies with duplicate files detected.*");
// When
private static final Pattern WARNING_MISSING_OBJCOPY_NATIVE = Pattern.compile(".*objcopy executable not found in PATH. Debug symbols will not be separated from executable.*");
private static final Pattern WARNING_MISSING_OBJCOPY_RESULT_NATIVE = Pattern.compile(".*That will result in a larger native image with debug symbols embedded in it.*");

public final Pattern[] errs;

Expand All @@ -89,8 +106,27 @@ public final Pattern[] platformErrs() {
switch (OS.current()) {
case MAC:
return new Pattern[] {
Pattern.compile(".*objcopy executable not found in PATH. Debug symbols will not be separated from executable.*"),
Pattern.compile(".*That will result in a larger native image with debug symbols embedded in it.*"),
COMMON_WARNING_DUPLICATE_ENTRY_NATIVE,
COMMON_WARNING_DUPLICATE_ENTRIES_NATIVE,
WARNING_MISSING_OBJCOPY_NATIVE,
WARNING_MISSING_OBJCOPY_RESULT_NATIVE,
};
case WINDOWS:
return new Pattern[] {
COMMON_WARNING_DUPLICATE_ENTRY_NATIVE,
COMMON_WARNING_DUPLICATE_ENTRIES_NATIVE,
WARNING_MISSING_OBJCOPY_NATIVE,
WARNING_MISSING_OBJCOPY_RESULT_NATIVE,
Pattern.compile(".*Uber JAR strategy is used for native image source JAR generation on Windows.*"),
// Randomly fails when vertx-cache temporary directory exists. Reported by https://github.com/quarkusio/quarkus/issues/16895
Pattern.compile(".*Unable to make the Vert.x cache directory.*"),
// Randomly prints some SLF4J traces. Reported by https://github.com/quarkusio/quarkus/issues/16896
Pattern.compile(".*SLF4J:.*"),
};
case LINUX:
return new Pattern[] {
COMMON_WARNING_DUPLICATE_ENTRY_NATIVE,
COMMON_WARNING_DUPLICATE_ENTRIES_NATIVE,
};
}
return new Pattern[] {};
Expand Down