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

chore: Build binaries with Java 21 #477

Merged
merged 7 commits into from
Jan 17, 2025
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
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Set up JDK
uses: actions/setup-java@v4.5.0
with:
java-version: 17
java-version: 21
distribution: 'adopt'
cache: maven
- name: Cache Maven packages
Expand Down
10 changes: 4 additions & 6 deletions .github/workflows/early-access.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ jobs:
strategy:
fail-fast: true
matrix:
os: [ ubuntu-latest, macOS-12, macos-14, windows-latest ]
os: [ ubuntu-latest, macos-13, macos-14, windows-latest ]
gu-binary: [ gu, gu.cmd ]
exclude:
- os: ubuntu-latest
gu-binary: gu.cmd
- os: macOS-12
- os: macos-13
gu-binary: gu.cmd
- os: macos-14
gu-binary: gu.cmd
Expand All @@ -47,9 +47,7 @@ jobs:
uses: graalvm/setup-graalvm@v1.2.2
with:
distribution: 'graalvm'
java-version: 17
components: 'native-image'
github-token: ${{ secrets.GITHUB_TOKEN }}
java-version: 21

- name: Get musl toolchain and compile libz against it
id: prepare-musl
Expand Down Expand Up @@ -134,7 +132,7 @@ jobs:

- name: Move build artifacts to correct folder
run: |
targets=("ubuntu-latest" "macOS-latest" "macos-14" "windows-latest")
targets=("ubuntu-latest" "macos-13" "macos-14" "windows-latest")

mkdir -p artifacts

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/mutation-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- name: Set up JDK
uses: actions/setup-java@v4.5.0
with:
java-version: 17
java-version: 21
distribution: 'adopt'
cache: maven

Expand Down
14 changes: 6 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- name: Set up Java
uses: actions/setup-java@v4.5.0
with:
java-version: 17
java-version: 21
distribution: 'adopt'

- name: Cache Maven packages
Expand Down Expand Up @@ -70,12 +70,12 @@ jobs:
strategy:
fail-fast: true
matrix:
os: [ ubuntu-latest, macOS-12, macos-14, windows-latest ]
os: [ ubuntu-latest, macos-13, macos-14, windows-latest ]
gu-binary: [ gu, gu.cmd ]
exclude:
- os: ubuntu-latest
gu-binary: gu.cmd
- os: macOS-12
- os: macos-13
gu-binary: gu.cmd
- os: macos-14
gu-binary: gu.cmd
Expand Down Expand Up @@ -106,9 +106,7 @@ jobs:
uses: graalvm/setup-graalvm@v1.2.2
with:
distribution: 'graalvm'
java-version: 17
components: 'native-image'
github-token: ${{ secrets.GITHUB_TOKEN }}
java-version: 21

- name: Get musl toolchain and compile libz against it
id: prepare-musl
Expand Down Expand Up @@ -208,7 +206,7 @@ jobs:

- name: Move build artifacts to correct folder
run: |
targets=("ubuntu-latest" "macOS-latest" "macos-14" "windows-latest")
targets=("ubuntu-latest" "macos-13" "macos-14" "windows-latest")

mkdir -p artifacts

Expand All @@ -217,7 +215,7 @@ jobs:
- name: Set up Java
uses: actions/setup-java@v4.5.0
with:
java-version: 17
java-version: 21
distribution: 'adopt'

- name: Cache Maven packages
Expand Down
30 changes: 22 additions & 8 deletions src/test/java/it/mulders/mcs/search/SearchClientIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
import static com.github.tomakehurst.wiremock.client.WireMock.ok;
import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
import static com.github.tomakehurst.wiremock.client.WireMock.urlPathMatching;
import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig;

import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo;
import com.github.tomakehurst.wiremock.junit5.WireMockTest;
import com.github.tomakehurst.wiremock.core.Options;
import com.github.tomakehurst.wiremock.junit5.WireMockExtension;
import it.mulders.mcs.common.Result;
import java.io.IOException;
import java.io.InputStream;
Expand All @@ -20,10 +21,19 @@
import org.junit.jupiter.api.DisplayNameGenerator;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;

@DisplayNameGeneration(DisplayNameGenerator.ReplaceUnderscores.class)
@WireMockTest
class SearchClientIT implements WithAssertions {
@RegisterExtension
static WireMockExtension wiremock = WireMockExtension.newInstance()
.options(wireMockConfig()
.bindAddress("localhost")
.dynamicPort()
.useChunkedTransferEncoding(Options.ChunkedEncodingPolicy.NEVER))
.configureStaticDsl(true)
.build();

String getResourceAsString(final String resourceName) {
try (final InputStream input = getClass().getResourceAsStream(resourceName)) {
byte[] bytes = input != null ? input.readAllBytes() : new byte[] {};
Expand All @@ -37,8 +47,9 @@ String getResourceAsString(final String resourceName) {
@DisplayName("Wildcard search")
class WildcardSearchTest {
@Test
void should_parse_response(final WireMockRuntimeInfo wmRuntimeInfo) {
void should_parse_response() {
// Arrange
var wmRuntimeInfo = wiremock.getRuntimeInfo();
stubFor(get(urlPathMatching("/solrsearch/select*"))
.willReturn(ok(getResourceAsString("/wildcard-search-response.json"))));

Expand All @@ -62,8 +73,9 @@ void should_parse_response(final WireMockRuntimeInfo wmRuntimeInfo) {
@Nested
class SingularSearchTest {
@Test
void should_parse_response_groupId_artifactId(final WireMockRuntimeInfo wmRuntimeInfo) {
void should_parse_response_groupId_artifactId() {
// Arrange
var wmRuntimeInfo = wiremock.getRuntimeInfo();
stubFor(get(urlPathMatching("/solrsearch/select*"))
.willReturn(ok(getResourceAsString("/group-artifact-search.json"))));

Expand All @@ -83,8 +95,9 @@ void should_parse_response_groupId_artifactId(final WireMockRuntimeInfo wmRuntim
}

@Test
void should_parse_response_groupId_artifactId_version(final WireMockRuntimeInfo wmRuntimeInfo) {
void should_parse_response_groupId_artifactId_version() {
// Arrange
var wmRuntimeInfo = wiremock.getRuntimeInfo();
stubFor(get(urlPathMatching("/solrsearch/select*"))
.willReturn(ok(getResourceAsString("/group-artifact-version-search.json"))));

Expand All @@ -108,9 +121,10 @@ void should_parse_response_groupId_artifactId_version(final WireMockRuntimeInfo
@Nested
class ErrorHandlingTest {
@Test
void should_gracefully_handle_4xx_response(final WireMockRuntimeInfo wmRuntimeInfo) {
void should_gracefully_handle_4xx_response() {
// Arrange
stubFor(get(urlPathMatching("/solrsearch/select*"))
var wmRuntimeInfo = wiremock.getRuntimeInfo();
wiremock.stubFor(get(urlPathMatching("/solrsearch/select*"))
.willReturn(badRequest().withBody("Solr returned 400, msg: ")));

// Act
Expand Down
Loading