Skip to content

Commit

Permalink
Merge pull request #430 from Karm/quarkus-upgrade-and-gradle
Browse files Browse the repository at this point in the history
Quarkus 1.7.0.Final -> 1.7.6.Final , Gradle support, CI, WildFly versions match MP versions
  • Loading branch information
Karm authored Jul 30, 2021
2 parents 3982219 + 7674374 commit 1ce86d8
Show file tree
Hide file tree
Showing 33 changed files with 501 additions and 287 deletions.
62 changes: 34 additions & 28 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: MicroProfile Starter Tests
name: Tests

on:
push:
Expand Down Expand Up @@ -27,50 +27,56 @@ on:

env:
LANG: en_US.UTF-8
JAVA_HOME: ${{ github.workspace }}/openjdk
GRADLE_USER_HOME: ~/.gradle

jobs:
run-starter:
name: MicroProfile Starter build and test - ${{ matrix.jdk }}
runs-on: ubuntu-18.04
name: ${{ matrix.runtime }} MicroProfile Starter
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
jdk: ['OpenJDK11-latest-GA']
include:
- jdk: 'OpenJDK11-latest-GA'
release_type: 'ga'
runtime: [ 'helidon',
'kumuluzee',
'liberty',
'payara',
'quarkus',
'thorntail',
'tomee',
'wildfly' ]
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
with:
fetch-depth: 1
path: starter
- uses: actions/cache@v1
- uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
key: ${{ runner.os }}-${{ matrix.runtime }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Get OpenJDK 11
run: |
curl -sL https://api.adoptopenjdk.net/v3/binary/latest/11/${{ matrix.release_type }}/linux/x64/jdk/hotspot/normal/openjdk -o jdk.tar.gz
mkdir -p ${JAVA_HOME}
tar xf jdk.tar.gz -C ${JAVA_HOME} --strip-components=1
echo ${JAVA_HOME}
${JAVA_HOME}/bin/java --version
${{ runner.os }}-${{ matrix.runtime }}-maven-
- uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-${{ matrix.runtime }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-${{ matrix.runtime }}-gradle-
- uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '11'
check-latest: true
- name: Build and run tests for Starter
run: |
cd ${{ github.workspace }}
export PATH=${JAVA_HOME}/bin:${PATH}
mvn clean verify -Pthorntail
mvn clean verify -Pthorntail -Dtest=TestMatrixTest#${{ matrix.runtime }}* -DSTARTER_TS_WORKSPACE=$RUNNER_TEMP
- name: Prepare failure archive (if maven failed)
if: failure()
shell: bash
run: find . -type d -name '*-reports' -o -wholename '*/build/reports/tests/functionalTest' -o -name "*.log" | tar -czf test-reports.tgz -T -
run: find . -type d -name '*-reports' -o -name "*.log" | tar -czf test-reports-${{ matrix.runtime }}.tgz -T -
- name: Upload failure Archive (if maven failed)
uses: actions/upload-artifact@v2
if: failure()
with:
name: test-reports
path: 'test-reports.tgz'

name: test-reports-${{ matrix.runtime }}
path: 'test-reports-${{ matrix.runtime }}.tgz'
7 changes: 0 additions & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -328,13 +328,6 @@
<scope>test</scope>
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>

</dependencies>

<dependencyManagement>
Expand Down
21 changes: 19 additions & 2 deletions src/it/java/org/eclipse/microprofile/starter/TestMatrixTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,12 @@
import static org.eclipse.microprofile.starter.utils.Commands.cleanWorkspace;
import static org.eclipse.microprofile.starter.utils.Commands.download;
import static org.eclipse.microprofile.starter.utils.Commands.getWorkspaceDir;
import static org.eclipse.microprofile.starter.utils.Commands.isThisWindows;
import static org.eclipse.microprofile.starter.utils.Commands.linuxCmdCleaner;
import static org.eclipse.microprofile.starter.utils.Commands.processStopper;
import static org.eclipse.microprofile.starter.utils.Commands.runCommand;
import static org.eclipse.microprofile.starter.utils.Commands.unzip;
import static org.eclipse.microprofile.starter.utils.Commands.windowsCmdCleaner;
import static org.eclipse.microprofile.starter.utils.Logs.archiveLog;
import static org.eclipse.microprofile.starter.utils.Logs.checkLog;
import static org.eclipse.microprofile.starter.utils.ReadmeParser.parseReadme;
Expand Down Expand Up @@ -178,6 +181,13 @@ public void testRuntime(String supportedServer, String artifactId, SpecSelection
Commands.runCommand(new String[]{"./gradlew", "libertyStop"}, directoryB, runLogB);
}
}
if (buildTool == BuildTool.GRADLE && supportedServer.equalsIgnoreCase("LIBERTY")) {
if (isThisWindows()) {
windowsCmdCleaner("defaultServer");
} else {
linuxCmdCleaner("defaultServer");
}
}

checkLog(this.getClass().getCanonicalName(), testName.getMethodName(), "Runtime log", runLogA);
if (specSelection.hasServiceB) {
Expand All @@ -186,11 +196,11 @@ public void testRuntime(String supportedServer, String artifactId, SpecSelection
LOGGER.info("Gonna wait for ports closed...");
// Release ports
assertTrue("Main ports are still open",
Commands.waitForTcpClosed("localhost", Commands.parsePort(urlBase), 60));
Commands.waitForTcpClosed("localhost", Commands.parsePort(urlBase), 90));
if (additionalPortsToCheck != null) {
for (int port : additionalPortsToCheck) {
assertTrue("Ports are still open",
Commands.waitForTcpClosed("localhost", port, 30));
Commands.waitForTcpClosed("localhost", port, 60));
}
}
} finally {
Expand Down Expand Up @@ -513,6 +523,13 @@ public void quarkusEmpty() throws IOException, InterruptedException {
SpecSelection.EMPTY, new int[]{9990}, BuildTool.MAVEN);
}

@Test
@RunAsClient
public void quarkusAllGradle() throws IOException, InterruptedException {
testRuntime("QUARKUS", "quarkus",
SpecSelection.ALL, new int[]{9990, 8180, 10090}, BuildTool.GRADLE);
}

@Test
@RunAsClient
public void quarkusAll() throws IOException, InterruptedException {
Expand Down
37 changes: 35 additions & 2 deletions src/it/java/org/eclipse/microprofile/starter/utils/Commands.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
import java.util.Objects;
import java.util.concurrent.TimeUnit;
import java.util.logging.Logger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import static org.eclipse.microprofile.starter.TestMatrixTest.API_URL;
import static org.eclipse.microprofile.starter.TestMatrixTest.TMP;
Expand All @@ -55,6 +57,8 @@ public class Commands {

private static final String STARTER_TS_WORKSPACE = "STARTER_TS_WORKSPACE";

private static final Pattern LINUX_PS_AUX_PID = Pattern.compile("\\w*\\s*(\\d*).*");

public static String getWorkspaceDir() {
String env = System.getenv().get(STARTER_TS_WORKSPACE);
if (StringUtils.isNotBlank(env)) {
Expand Down Expand Up @@ -197,11 +201,11 @@ public static void processStopper(Process p, String artifactId) throws Interrupt
}
}

public static void windowsCmdCleaner(String artifactId) throws IOException, InterruptedException {
public static void windowsCmdCleaner(String appName) throws IOException, InterruptedException {
List<Long> pidsToKill = new ArrayList<>(2);
String[] wmicPIDcmd = new String[]{
"wmic", "process", "where", "(",
"commandline", "like", "\"%\\\\" + artifactId + "\\\\%\"", "and", "name", "=", "\"java.exe\"", "and",
"commandline", "like", "\"%\\\\" + appName + "\\\\%\"", "and", "name", "=", "\"java.exe\"", "and",
"not", "commandline", "like", "\"%wmic%\"", "and",
"not", "commandline", "like", "\"%maven%\"",
")", "get", "Processid", "/format:list"};
Expand Down Expand Up @@ -229,6 +233,35 @@ public static void windowsCmdCleaner(String artifactId) throws IOException, Inte
pidsToKill.forEach(Commands::pidKiller);
}

public static void linuxCmdCleaner(String appName) throws IOException, InterruptedException {
List<Long> pidsToKill = new ArrayList<>(2);
ProcessBuilder pbA = new ProcessBuilder("ps", "aux");
pbA.redirectErrorStream(true);
Process p = pbA.start();
try (BufferedReader processOutputReader = new BufferedReader(new InputStreamReader(p.getInputStream()))) {
String l;
while ((l = processOutputReader.readLine()) != null) {
if (l.contains(appName)) {
Matcher m = LINUX_PS_AUX_PID.matcher(l);
if (m.lookingAt()) {
try {
pidsToKill.add(Long.parseLong(m.group(1)));
} catch (NumberFormatException ex) {
//Silence is golden. We don't care about ps output glitches. This is a best effort.
}
}
}
}
p.waitFor();
}
if (pidsToKill.isEmpty()) {
LOGGER.warning("ps didn't find any additional PIDs to kill.");
} else {
LOGGER.info(String.format("ps found %d additional pids to kill", pidsToKill.size()));
}
pidsToKill.forEach(Commands::pidKiller);
}

public static boolean isThisWindows() {
return System.getProperty("os.name").matches(".*[Ww]indows.*");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,20 @@ public enum Whitelist {
}),
TOMEE("tomee", new Pattern[]{}),
QUARKUS("quarkus", new Pattern[]{
Pattern.compile(".*error_prone_annotations.*"),
Pattern.compile(".*error_prone_parent.*"),
Pattern.compile(".*\\[org.jboss.threads.errors] Thread Thread\\[build.*"),
Pattern.compile(".*org/jboss/threads/EnhancedQueueExecutor.*"),
// If there is nobody to receive traces, there is a log about it.
Pattern.compile(".*io.jaegertracing.internal.exceptions.SenderException.*"),
}),
WILDFLY("wildfly", new Pattern[]{
Pattern.compile(".*error_prone_annotations.*"),
Pattern.compile(".*error_prone_parent.*"),
Pattern.compile(".*wildfly-domain-http-error-context.*"),
// Known warning, needs WF update
Pattern.compile(".*io/netty/util/internal/logging/Log4J2Logger.*"),
Pattern.compile(".*io.undertow.servlet.handlers.SendErrorPageHandler.*"),
});

public final String name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public class MicroprofileServersAddon extends AbstractMicroprofileAddon {
private List<MicroprofileSpec> microprofileSpecs;
private List<StandaloneMPSpec> microprofileStandaloneSpecs;

private static final String VERTX_JWT_VERSION = "3.9.2";
public static final String VERTX_JWT_VERSION = "3.9.5";

@PostConstruct
public void init() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public void init() {
fillJavaSEVersion(data, SupportedServer.THORNTAIL_V2, JavaSEVersion.SE11, MicroProfileVersion.MP22, null); // Supported from MP 2.2

fillJavaSEVersion(data, SupportedServer.QUARKUS, JavaSEVersion.SE8, null, null); // Supported for all MPVersions
fillJavaSEVersion(data, SupportedServer.QUARKUS, JavaSEVersion.SE11, MicroProfileVersion.MP32, null); // Supported from MP 3.2

fillJavaSEVersion(data, SupportedServer.WILDFLY, JavaSEVersion.SE8, null, null); // Supported for all MPVersions
fillJavaSEVersion(data, SupportedServer.WILDFLY, JavaSEVersion.SE11, MicroProfileVersion.MP32, null); // Supported from MP 3.2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ public enum SupportedServer {
, "8080" //portServiceA
, "8180" //portServiceB
, "https://quarkus.io/"
, false) // GradleSupport
, true) // GradleSupport
, WILDFLY("wildfly", "WildFly",
Arrays.asList(MicroProfileVersion.MP32, MicroProfileVersion.MP33, MicroProfileVersion.MP40)
, "%s-wildfly.jar" //jarFileName
, "%s-bootable.jar" //jarFileName
, "-Djboss.socket.binding.port-offset=100" //jarParameters
, "8080" //portServiceA
, "8180" //portServiceB
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@
import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.HashSet;

@ApplicationScoped
public class HelidonServer extends AbstractMicroprofileAddon {
Expand Down Expand Up @@ -94,7 +94,7 @@ public void createFiles(JessieModel model) {
Set<String> tempAlternative = new HashSet<>(alternatives);
tempAlternative.add(JessieModel.SECONDARY_INDICATOR);
templateEngine.processTemplateFile(viewDirectory,
"RestApplication.java",variables.get("application") + "RestApplication.java", tempAlternative, variables);
"RestApplication.java", variables.get("application") + "RestApplication.java", tempAlternative, variables);

String bResourcesDir = model.getDirectory(false) + "/" + MavenCreator.SRC_MAIN_RESOURCES;
String bResourcesMETAINFDir = bResourcesDir + "/META-INF";
Expand Down
Loading

0 comments on commit 1ce86d8

Please sign in to comment.