Skip to content

Commit

Permalink
chore: fix build (#2617)
Browse files Browse the repository at this point in the history
* chore: remove maven cache by moving it to java setup

* chore: set 4 thread

* chore: fix formatting
  • Loading branch information
SteKoe authored Jul 14, 2023
1 parent 7272375 commit 2d7e0fc
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 80 deletions.
14 changes: 1 addition & 13 deletions .github/workflows/build-feature.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,7 @@ jobs:
with:
distribution: 'adopt'
java-version: '17'

- name: Cache local Maven repository
uses: actions/[email protected]
env:
cache-name: cache-mvn
with:
path: ~/.m2/repository
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
cache: 'maven'

- name: Cache node modules
uses: actions/cache@v3
Expand All @@ -51,7 +40,6 @@ jobs:
# otherwise the build will fail https://stackoverflow.com/questions/38051787/maven-javadoc-skip-true-throws-an-error
- name: Build with Maven
run: |
mvn -B spring-javaformat:apply --no-transfer-progress
mvn -B verify -P coverage --no-transfer-progress -D maven.javadoc.skip=true
- uses: codecov/codecov-action@v3
Expand Down
27 changes: 2 additions & 25 deletions .github/workflows/build-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,7 @@ jobs:
with:
distribution: 'adopt'
java-version: '17'

- name: Cache local Maven repository
uses: actions/[email protected]
env:
cache-name: cache-mvn
with:
path: ~/.m2/repository
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
cache: 'maven'

- name: Cache node modules
uses: actions/cache@v3
Expand All @@ -50,7 +39,6 @@ jobs:
# otherwise the build will fail https://stackoverflow.com/questions/38051787/maven-javadoc-skip-true-throws-an-error
- name: Build with Maven
run: |
mvn -B spring-javaformat:apply --no-transfer-progress
mvn -B verify -P coverage --no-transfer-progress -D maven.javadoc.skip=true
- uses: codecov/codecov-action@v3
Expand All @@ -69,18 +57,7 @@ jobs:
with:
distribution: 'adopt'
java-version: '17'

- name: Cache local Maven repository
uses: actions/[email protected]
env:
cache-name: cache-mvn
with:
path: ~/.m2/repository
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
cache: 'maven'

- name: Cache node modules
uses: actions/cache@v3
Expand Down
14 changes: 1 addition & 13 deletions .github/workflows/build-pullrequest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,7 @@ jobs:
with:
distribution: 'adopt'
java-version: '17'

- name: Cache local Maven repository
uses: actions/[email protected]
env:
cache-name: cache-mvn
with:
path: ~/.m2/repository
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
cache: 'maven'

- name: Cache node modules
uses: actions/cache@v3
Expand All @@ -46,7 +35,6 @@ jobs:
# otherwise the build will fail https://stackoverflow.com/questions/38051787/maven-javadoc-skip-true-throws-an-error
- name: Build with Maven
run: |
mvn -B spring-javaformat:apply --no-transfer-progress
mvn -B verify -P coverage --no-transfer-progress -D maven.javadoc.skip=true
- uses: codecov/codecov-action@v3
Expand Down
15 changes: 2 additions & 13 deletions .github/workflows/release-to-maven-central.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,7 @@ jobs:
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE

- name: Cache local Maven repository
uses: actions/[email protected]
env:
cache-name: cache-mvn
with:
path: ~/.m2/repository
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
cache: 'maven'

- name: Cache node modules
uses: actions/cache@v3
Expand All @@ -58,7 +47,7 @@ jobs:
run: mvn versions:set "-DnewVersion=${{ github.event.inputs.releaseversion }}" --no-transfer-progress

- name: Publish package
run: mvn --batch-mode clean deploy --no-transfer-progress -P central-deploy -DskipTests=true
run: mvn -B deploy --no-transfer-progress -P central-deploy -DskipTests=true
env:
#TODO: This is a workaround for NEXUS-27902 which uses XStream that fails on JVM >16
JDK_JAVA_OPTIONS: "--add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.base/java.text=ALL-UNNAMED --add-opens java.desktop/java.awt.font=ALL-UNNAMED"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ public class SpringBootAdminClientAutoConfigurationTest {

private final WebApplicationContextRunner contextRunner = new WebApplicationContextRunner()
.withConfiguration(AutoConfigurations.of(EndpointAutoConfiguration.class, WebEndpointAutoConfiguration.class,
DispatcherServletAutoConfiguration.class, RestTemplateAutoConfiguration.class,
SpringBootAdminClientAutoConfiguration.class));
DispatcherServletAutoConfiguration.class, RestTemplateAutoConfiguration.class,
SpringBootAdminClientAutoConfiguration.class));

@Test
public void not_active() {
Expand All @@ -62,7 +62,7 @@ public void active() {
public void disabled() {
this.contextRunner
.withPropertyValues("spring.boot.admin.client.url:http://localhost:8081",
"spring.boot.admin.client.enabled:false")
"spring.boot.admin.client.enabled:false")
.run((context) -> assertThat(context).doesNotHaveBean(ApplicationRegistrator.class));
}

Expand All @@ -79,8 +79,8 @@ public void nonWebEnvironment() {
public void reactiveEnvironment() {
ReactiveWebApplicationContextRunner reactiveContextRunner = new ReactiveWebApplicationContextRunner()
.withConfiguration(
AutoConfigurations.of(EndpointAutoConfiguration.class, WebEndpointAutoConfiguration.class,
WebClientAutoConfiguration.class, SpringBootAdminClientAutoConfiguration.class))
AutoConfigurations.of(EndpointAutoConfiguration.class, WebEndpointAutoConfiguration.class,
WebClientAutoConfiguration.class, SpringBootAdminClientAutoConfiguration.class))
.withBean(WebFluxProperties.class);
reactiveContextRunner.withPropertyValues("spring.boot.admin.client.url:http://localhost:8081")
.run((context) -> assertThat(context).hasSingleBean(ApplicationRegistrator.class));
Expand All @@ -90,16 +90,16 @@ public void reactiveEnvironment() {
public void blockingClientInBlockingEnvironment() {
WebApplicationContextRunner webApplicationContextRunner = new WebApplicationContextRunner()
.withConfiguration(AutoConfigurations.of(EndpointAutoConfiguration.class,
WebEndpointAutoConfiguration.class, DispatcherServletAutoConfiguration.class,
RestTemplateAutoConfiguration.class, SpringBootAdminClientAutoConfiguration.class));
WebEndpointAutoConfiguration.class, DispatcherServletAutoConfiguration.class,
RestTemplateAutoConfiguration.class, SpringBootAdminClientAutoConfiguration.class));

webApplicationContextRunner
.withPropertyValues("spring.boot.admin.client.url:http://localhost:8081",
"spring.boot.admin.client.connectTimeout=1337", "spring.boot.admin.client.readTimeout=42")
"spring.boot.admin.client.connectTimeout=1337", "spring.boot.admin.client.readTimeout=42")
.run((context) -> {
RegistrationClient registrationClient = context.getBean(RegistrationClient.class);
RestTemplate restTemplate = (RestTemplate) ReflectionTestUtils.getField(registrationClient,
"restTemplate");
"restTemplate");
assertThat(restTemplate).isNotNull();

ClientHttpRequestFactory requestFactory = restTemplate.getRequestFactory();
Expand All @@ -116,8 +116,8 @@ public void customBlockingClientInReactiveEnvironment() {
ReactiveWebApplicationContextRunner reactiveContextRunner = new ReactiveWebApplicationContextRunner()
.withConfiguration(UserConfigurations.of(CustomBlockingConfiguration.class))
.withConfiguration(
AutoConfigurations.of(EndpointAutoConfiguration.class, WebEndpointAutoConfiguration.class,
WebClientAutoConfiguration.class, SpringBootAdminClientAutoConfiguration.class))
AutoConfigurations.of(EndpointAutoConfiguration.class, WebEndpointAutoConfiguration.class,
WebClientAutoConfiguration.class, SpringBootAdminClientAutoConfiguration.class))
.withBean(WebFluxProperties.class);

reactiveContextRunner.withPropertyValues("spring.boot.admin.client.url:http://localhost:8081")
Expand All @@ -133,8 +133,8 @@ public void customBlockingClientInBlockingEnvironment() {
WebApplicationContextRunner webApplicationContextRunner = new WebApplicationContextRunner()
.withConfiguration(UserConfigurations.of(CustomBlockingConfiguration.class))
.withConfiguration(AutoConfigurations.of(EndpointAutoConfiguration.class,
WebEndpointAutoConfiguration.class, DispatcherServletAutoConfiguration.class,
RestTemplateAutoConfiguration.class, SpringBootAdminClientAutoConfiguration.class));
WebEndpointAutoConfiguration.class, DispatcherServletAutoConfiguration.class,
RestTemplateAutoConfiguration.class, SpringBootAdminClientAutoConfiguration.class));

webApplicationContextRunner.withPropertyValues("spring.boot.admin.client.url:http://localhost:8081")
.run((context) -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ public class SpringBootAdminClientCloudFoundryAutoConfigurationTest {

private final WebApplicationContextRunner contextRunner = new WebApplicationContextRunner()
.withConfiguration(AutoConfigurations.of(EndpointAutoConfiguration.class, WebEndpointAutoConfiguration.class,
WebMvcAutoConfiguration.class, DispatcherServletAutoConfiguration.class,
RestTemplateAutoConfiguration.class, SpringBootAdminClientAutoConfiguration.class,
SpringBootAdminClientCloudFoundryAutoConfiguration.class));
WebMvcAutoConfiguration.class, DispatcherServletAutoConfiguration.class,
RestTemplateAutoConfiguration.class, SpringBootAdminClientAutoConfiguration.class,
SpringBootAdminClientCloudFoundryAutoConfiguration.class));

@Test
public void non_cloud_platform() {
Expand Down

0 comments on commit 2d7e0fc

Please sign in to comment.