-
Notifications
You must be signed in to change notification settings - Fork 26
v6: Release SNAPSHOT versions #446
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
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
2883784
ci: release SNAPSHOT version after merging PRs to v6
bevzzz fd25bb7
chore: update README
bevzzz ebca3a8
feat: include client6 build info in the resources
bevzzz 7fedb1d
feat: add debug util for printing build info
bevzzz 7a8283b
test: skip test if no git branch or git commit not found locally
bevzzz 3f0d175
ci: run on any tag push
bevzzz 0bf399a
chore(readme): expand SNAPSHOT section
bevzzz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
src/main/java/io/weaviate/client6/v1/internal/BuildInfo.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| package io.weaviate.client6.v1.internal; | ||
|
|
||
| import java.io.IOException; | ||
| import java.util.Properties; | ||
|
|
||
| public final class BuildInfo { | ||
| /** Prevent public initialization. */ | ||
| private BuildInfo() { | ||
| } | ||
|
|
||
| public static final String BRANCH; | ||
| public static final String COMMIT_ID; | ||
| public static final String COMMIT_ID_ABBREV; | ||
|
|
||
| static { | ||
| var properties = new Properties(); | ||
|
|
||
| try { | ||
| properties.load(BuildInfo.class.getClassLoader().getResourceAsStream("client6-git.properties")); | ||
| } catch (IOException | NullPointerException e) { | ||
| System.out.println("failed to load client6-git.properties, no build information will be available"); | ||
| } | ||
|
|
||
| BRANCH = String.valueOf(properties.get("git.branch")); | ||
| COMMIT_ID = String.valueOf(properties.get("git.commit.id.full")); | ||
| COMMIT_ID_ABBREV = String.valueOf(properties.get("git.commit.id.abbrev")); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
src/test/java/io/weaviate/client6/v1/internal/BuildInfoTest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| package io.weaviate.client6.v1.internal; | ||
|
|
||
| import java.io.BufferedReader; | ||
| import java.io.IOException; | ||
| import java.io.InputStreamReader; | ||
|
|
||
| import org.assertj.core.api.Assertions; | ||
| import org.junit.Assume; | ||
| import org.junit.Test; | ||
|
|
||
| public class BuildInfoTest { | ||
| private static final String BRANCH = gitBranch(); | ||
| private static final String COMMIT_ID = gitCommit(); | ||
|
|
||
| @Test | ||
| public void testBuildInfo() throws IOException { | ||
| Assume.assumeNotNull(BRANCH, COMMIT_ID); | ||
| Assume.assumeTrue("found git branch", !BRANCH.isBlank()); | ||
| Assume.assumeTrue("found git commit", !COMMIT_ID.isBlank()); | ||
|
|
||
| Assertions.assertThat(BuildInfo.BRANCH).as("branch").isEqualTo(BRANCH); | ||
| Assertions.assertThat(BuildInfo.COMMIT_ID).as("commit.full").isEqualTo(COMMIT_ID); | ||
| Assertions.assertThat(COMMIT_ID).as("commit.abbrev").startsWith(BuildInfo.COMMIT_ID_ABBREV); | ||
| } | ||
|
|
||
| /** Get current non-abbreviated Git commit hash. */ | ||
| private static String gitCommit() { | ||
| return runCommand("/usr/bin/git", "rev-parse", "HEAD"); | ||
| } | ||
|
|
||
| /** Get current git branch. */ | ||
| private static String gitBranch() { | ||
| return runCommand("/usr/bin/git", "branch", "--show-current"); | ||
| } | ||
|
|
||
| /** Run shell command and return the output as multi-line string. */ | ||
| private static String runCommand(String... cmdarray) { | ||
| try { | ||
| var process = Runtime.getRuntime().exec(cmdarray); | ||
| var r = new BufferedReader(new InputStreamReader(process.getInputStream())); | ||
| return String.join("\n", (Iterable<String>) () -> r.lines().iterator()); | ||
| } catch (IOException e) { | ||
| return null; | ||
| } | ||
| } | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.