Skip to content

Commit

Permalink
Format the source and enable the check on CI.
Browse files Browse the repository at this point in the history
Signed-off-by: James R. Perkins <jperkins@redhat.com>
  • Loading branch information
jamezp committed Jun 28, 2024
1 parent 73c012f commit a0a5e88
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 6 deletions.
19 changes: 18 additions & 1 deletion .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,23 @@ concurrency:
cancel-in-progress: true

jobs:
format-check:
runs-on: ubuntu-latest
timeout-minutes: 30

steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'temurin'
cache: 'maven'
- name: Validate Formatting
run: |
mvn -B -ntp validate -Pformat-check
build:
needs: format-check
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
Expand All @@ -47,6 +63,7 @@ jobs:
name: surefire-reports-${{ matrix.os }}-${{ matrix.java }}
path: '**/surefire-reports/*'
test-java11:
needs: format-check
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
Expand All @@ -69,4 +86,4 @@ jobs:
if: failure()
with:
name: surefire-reports-${{ matrix.os }}-${{ matrix.java }}
path: '**/surefire-reports/*'
path: '**/surefire-reports/*'
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@
@Inherited
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE})
@Target({ ElementType.TYPE })
public @interface TestContainer {
Class<? extends GenericContainer<?>> value();

boolean failIfNoDocker() default true;
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@

import java.lang.annotation.Annotation;

import org.jboss.arquillian.container.test.impl.enricher.resource.OperatesOnDeploymentAwareProvider;
import org.jboss.arquillian.core.api.Instance;
import org.jboss.arquillian.core.api.annotation.Inject;
import org.jboss.arquillian.test.api.ArquillianResource;
import org.jboss.arquillian.test.spi.annotation.ClassScoped;
import org.jboss.arquillian.container.test.impl.enricher.resource.OperatesOnDeploymentAwareProvider;
import org.testcontainers.containers.GenericContainer;

public class TestContainerProvider extends OperatesOnDeploymentAwareProvider {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

import java.lang.reflect.Constructor;

import com.github.dockerjava.api.DockerClient;
import org.jboss.arquillian.core.api.InstanceProducer;
import org.jboss.arquillian.core.api.annotation.Inject;
import org.jboss.arquillian.core.api.annotation.Observes;
Expand All @@ -29,6 +28,8 @@
import org.testcontainers.DockerClientFactory;
import org.testcontainers.containers.GenericContainer;

import com.github.dockerjava.api.DockerClient;

public class TestContainersObserver {
@Inject
@ClassScoped
Expand All @@ -45,7 +46,7 @@ public void createContainer(@Observes(precedence = 500) BeforeClass beforeClass)
final GenericContainer<?> container = clazz.getConstructor().newInstance();
container.start();
containerWrapper.set(container);
} catch (Exception e) { //Clean up
} catch (Exception e) { // Clean up
throw new RuntimeException(e);
}
}
Expand Down Expand Up @@ -74,7 +75,7 @@ private void checkForDocker(boolean failIfNoDocker) {
}

private boolean isDockerAvailable() {
try(DockerClient client = DockerClientFactory.instance().client()) {
try (DockerClient client = DockerClientFactory.instance().client()) {
return true;
} catch (Throwable ex) {
return false;
Expand Down

0 comments on commit a0a5e88

Please sign in to comment.