Skip to content

Commit

Permalink
Updates GitHub Actions (#298)
Browse files Browse the repository at this point in the history
Co-authored-by: Kyle Aure <[email protected]>
  • Loading branch information
appiepollo14 and KyleAure committed Nov 7, 2023
1 parent 4115b0f commit b712c1f
Show file tree
Hide file tree
Showing 10 changed files with 69 additions and 153 deletions.
113 changes: 45 additions & 68 deletions .github/workflows/microshed-ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: MicroShed CI

on:
push:
pull_request:
branches:
- main
Expand All @@ -17,33 +18,31 @@ env:
LANG: en_US.UTF-8
jobs:
build:
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest ]
java: [ 11 ]
fail-fast: false
max-parallel: 4
name: Build ${{ matrix.java }}, ${{ matrix.os }}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Set up Java
uses: joschi/setup-jdk@v2
with:
java-version: 11
openjdk_impl: openj9
- name: Apply repository caches
uses: actions/cache@v2
uses: actions/setup-java@0ab4596768b603586c0de567f2430c30f5b0d2b0 # v3.13.0
with:
path: |
~/.gradle/caches/modules-2
!~/.gradle/caches/modules-2/org.microshed*
~/.gradle/wrapper
~/.m2/repository/
!~/.m2/repository/org/microshed/
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-gradle-
java-version: ${{ matrix.java }}
distribution: 'temurin'
cache: gradle
- name: Build with Gradle
run: |
chmod +x gradlew
./gradlew assemble testClasses
integration_tests:
name: Tests - ${{matrix.category}}
runs-on: ubuntu-latest
needs: build
timeout-minutes: 20
strategy:
fail-fast: false
Expand Down Expand Up @@ -71,54 +70,32 @@ jobs:
quarkus-app
wildfly-app
steps:
- uses: actions/checkout@v2
- name: Set up Java
uses: joschi/setup-jdk@v2
with:
java-version: 11
openjdk_impl: openj9
- uses: testspace-com/setup-testspace@v1
with:
domain: ${{ github.repository_owner }}
- name: Apply repository caches
uses: actions/cache@v2
with:
path: |
~/.gradle/caches/modules-2
!~/.gradle/caches/modules-2/org.microshed*
~/.gradle/wrapper
~/.m2/repository/
!~/.m2/repository/org/microshed/
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Run integration tests
shell: bash
env:
TEST_PROJECTS: ${{matrix.projects}}
CATEGORY: ${{matrix.category}}
run: |
chmod +x gradlew
echo "org.gradle.daemon=false" >> gradle.properties
echo "Will be running projects $TEST_PROJECTS"
for TEST_PROJECT in $TEST_PROJECTS
do
if [[ ! -d "sample-apps/$TEST_PROJECT" ]]; then
echo "::error::Test project $TEST_PROJECT does not exist.";
exit 1;
fi
done
for TEST_PROJECT in $TEST_PROJECTS
do
echo "### BEGIN running test project $TEST_PROJECT"
./gradlew :microshed-testing-$TEST_PROJECT:test
echo "### END running test project $TEST_PROJECT";
done
echo "Done running all tests."
- name: Upload test results
if: always()
run: |
testspace [${{matrix.category}}]sample-apps/*/build/test-results/**/*.xml
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Set up Java
uses: actions/setup-java@0ab4596768b603586c0de567f2430c30f5b0d2b0 # v3.13.0
with:
java-version: 11
distribution: 'temurin'
cache: gradle
- name: Run integration tests
shell: bash
env:
TEST_PROJECTS: ${{matrix.projects}}
CATEGORY: ${{matrix.category}}
run: |
chmod +x gradlew
echo "org.gradle.daemon=false" >> gradle.properties
echo "Will be running projects $TEST_PROJECTS"
for TEST_PROJECT in $TEST_PROJECTS
do
if [[ ! -d "sample-apps/$TEST_PROJECT" ]]; then
echo "::error::Test project $TEST_PROJECT does not exist.";
exit 1;
fi
echo "### BEGIN running test project $TEST_PROJECT"
./gradlew :microshed-testing-$TEST_PROJECT:test
echo "### END running test project $TEST_PROJECT";
done

echo "Done running all tests."
1 change: 0 additions & 1 deletion sample-apps/everything-app/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# OpenLiberty
FROM openliberty/open-liberty:full-java8-openj9-ubi
COPY src/main/liberty/config /config/
ADD build/libs/myservice.war /config/dropins/
Expand Down
16 changes: 1 addition & 15 deletions sample-apps/jaxrs-basicauth/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,3 @@
# OpenLiberty
FROM openliberty/open-liberty:full-java8-openj9-ubi
COPY src/main/liberty/config /config/
ADD build/libs/myservice.war /config/apps/

# Wildfly
#FROM jboss/wildfly
#ADD build/libs/myservice.war /opt/jboss/wildfly/standalone/deployments/

# Payara
#FROM payara/micro:5.193
#CMD ["--deploymentDir", "/opt/payara/deployments", "--noCluster"]
#ADD build/libs/myservice.war /opt/payara/deployments

# TomEE
#FROM tomee:8-jre-8.0.0-M2-microprofile
#COPY build/libs/myservice.war /usr/local/tomee/webapps/
ADD build/libs/myservice.war /config/apps/
16 changes: 1 addition & 15 deletions sample-apps/jaxrs-json/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,3 @@
# OpenLiberty
FROM openliberty/open-liberty:full-java8-openj9-ubi
COPY src/main/liberty/config /config/
ADD build/libs/myservice.war /config/dropins/

# Wildfly
#FROM jboss/wildfly
#ADD build/libs/myservice.war /opt/jboss/wildfly/standalone/deployments/

# Payara
#FROM payara/micro:5.193
#CMD ["--deploymentDir", "/opt/payara/deployments", "--noCluster"]
#ADD build/libs/myservice.war /opt/payara/deployments

# TomEE
#FROM tomee:8-jre-8.0.0-M2-microprofile
#COPY build/libs/myservice.war /usr/local/tomee/webapps/
ADD build/libs/myservice.war /config/dropins/
Original file line number Diff line number Diff line change
Expand Up @@ -18,34 +18,30 @@
*/
package org.example.app;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.util.Collection;

import javax.ws.rs.BadRequestException;
import javax.ws.rs.NotFoundException;
import javax.ws.rs.ProcessingException;

import org.junit.jupiter.api.Test;
import org.microshed.testing.jaxrs.RESTClient;
import org.microshed.testing.jupiter.MicroShedTest;
import org.microshed.testing.testcontainers.ApplicationContainer;
import org.testcontainers.junit.jupiter.Container;

import javax.ws.rs.BadRequestException;
import javax.ws.rs.NotFoundException;
import javax.ws.rs.ProcessingException;
import java.util.Collection;

import static org.junit.jupiter.api.Assertions.*;

@MicroShedTest
public class JaxrsJsonIT {

@Container
public static ApplicationContainer app = new ApplicationContainer()
.withAppContextRoot("/myservice")
.withReadinessPath("/myservice/app/people");
.withAppContextRoot("/myservice")
.withReadinessPath("/myservice/app/people");

@RESTClient
public static PersonService personSvc;

@Test
public void testCreatePerson() {
Long createId = personSvc.createPerson("Hank", 42);
Expand All @@ -56,14 +52,14 @@ public void testCreatePerson() {
public void testMinSizeName() {
Long minSizeNameId = personSvc.createPerson("Ha", 42);
assertEquals(new Person("Ha", 42, minSizeNameId),
personSvc.getPerson(minSizeNameId));
personSvc.getPerson(minSizeNameId));
}

@Test
public void testMinAge() {
Long minAgeId = personSvc.createPerson("Newborn", 0);
assertEquals(new Person("Newborn", 0, minAgeId),
personSvc.getPerson(minAgeId));
personSvc.getPerson(minAgeId));
}

@Test
Expand Down Expand Up @@ -127,7 +123,7 @@ public void testCreateBadPersonNegativeAge() {
public void testCreateBadPersonNameTooLong() {
assertThrows(BadRequestException.class, () -> personSvc.createPerson("NameTooLongPersonNameTooLongPersonNameTooLongPerson", 5));
}

@Test
public void testNonJaxrsMethod() {
assertThrows(ProcessingException.class, () -> personSvc.nonJaxrsMethod());
Expand Down
16 changes: 1 addition & 15 deletions sample-apps/jaxrs-mpjwt/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,3 @@
# OpenLiberty
FROM openliberty/open-liberty:full-java8-openj9-ubi
COPY src/main/liberty/config /config/
ADD build/libs/myservice.war /config/dropins/

# Wildfly
#FROM jboss/wildfly
#ADD build/libs/myservice.war /opt/jboss/wildfly/standalone/deployments/

# Payara
#FROM payara/micro:5.193
#CMD ["--deploymentDir", "/opt/payara/deployments", "--noCluster"]
#ADD build/libs/myservice.war /opt/payara/deployments

# TomEE
#FROM tomee:8-jre-8.0.0-M2-microprofile
#COPY build/libs/myservice.war /usr/local/tomee/webapps/
ADD build/libs/myservice.war /config/dropins/
1 change: 0 additions & 1 deletion sample-apps/kafka-app/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# OpenLiberty
FROM openliberty/open-liberty:full-java8-openj9-ubi
COPY src/main/liberty/config /config/
ADD build/libs/myservice.war /config/apps/
Expand Down
13 changes: 0 additions & 13 deletions sample-apps/maven-app/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,3 @@
FROM openliberty/open-liberty:full-java8-openj9-ubi
COPY src/main/liberty/config /config/
ADD target/myservice.war /config/dropins/

# Wildfly
#FROM jboss/wildfly
#ADD target/myservice.war /opt/jboss/wildfly/standalone/deployments/

# Payara
#FROM payara/micro:5.193
#CMD ["--deploymentDir", "/opt/payara/deployments", "--noCluster"]
#ADD target/myservice.war /opt/payara/deployments

# TomEE
#FROM tomee:8-jre-8.0.0-M2-microprofile
#COPY target/myservice.war /usr/local/tomee/webapps/
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,16 @@
import org.testcontainers.junit.jupiter.Container;

@MicroShedTest
public class JaxrsJsonIT {
public class PayaraIT {

@Container
public static ApplicationContainer app = new ApplicationContainer()
.withAppContextRoot("/myservice")
.withReadinessPath("/myservice/app/people");

@RESTClient
public static PersonService personSvc;

@Test
public void testCreatePerson() {
Long createId = personSvc.createPerson("Hank", 42);
Expand Down Expand Up @@ -127,7 +127,7 @@ public void testCreateBadPersonNegativeAge() {
public void testCreateBadPersonNameTooLong() {
assertThrows(BadRequestException.class, () -> personSvc.createPerson("NameTooLongPersonNameTooLongPersonNameTooLongPerson", 5));
}

@Test
public void testNonJaxrsMethod() {
assertThrows(ProcessingException.class, () -> personSvc.nonJaxrsMethod());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
import org.testcontainers.junit.jupiter.Container;

@MicroShedTest
public class JaxrsJsonIT {
public class WildFlyIT {

@Container
public static ApplicationContainer app = new ApplicationContainer()
Expand Down

0 comments on commit b712c1f

Please sign in to comment.