From 885a5e8426f96f7e16211fdd6e910bf7042901ed Mon Sep 17 00:00:00 2001 From: Jun Nemoto <35618893+jnmt@users.noreply.github.com> Date: Mon, 22 Sep 2025 13:45:46 +0900 Subject: [PATCH] Add release flows for HashStore and TableStore (#268) --- .github/workflows/create-release-notes.yaml | 26 ++++++++++ .github/workflows/release-snapshot.yaml | 2 +- .github/workflows/release.yaml | 2 +- .github/workflows/scalar.yml | 8 ++-- hash-store/archive.gradle | 47 +++++++++++++++++++ hash-store/build.gradle | 25 +++++++++- .../client/tool/HashStoreCommandLine.java | 4 +- .../client/tool/HashStoreCommandLineTest.java | 8 ++-- table-store/archive.gradle | 47 +++++++++++++++++++ table-store/build.gradle | 25 +++++++++- .../service/TableStoreClientService.java | 15 +----- .../client/tool/TableStoreCommandLine.java | 4 +- .../service/TableStoreClientServiceTest.java | 13 ----- .../tool/TableStoreCommandLineTest.java | 8 ++-- 14 files changed, 187 insertions(+), 47 deletions(-) create mode 100644 hash-store/archive.gradle create mode 100644 table-store/archive.gradle diff --git a/.github/workflows/create-release-notes.yaml b/.github/workflows/create-release-notes.yaml index b7c386e7..ff1208b9 100644 --- a/.github/workflows/create-release-notes.yaml +++ b/.github/workflows/create-release-notes.yaml @@ -78,6 +78,32 @@ jobs: asset_name: scalardl-java-client-sdk-${{ steps.version.outputs.version }}.zip asset_content_type: application/zip + - name: Build HashStore client SDK zip + run: ./gradlew :hash-store:distZip + + - name: Upload HashStore client SDK zip + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GH_PROJECT_ACCESS_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: hash-store/build/distributions/scalardl-hashstore-java-client-sdk-${{ steps.version.outputs.version }}.zip + asset_name: scalardl-hashstore-java-client-sdk-${{ steps.version.outputs.version }}.zip + asset_content_type: application/zip + + - name: Build TableStore client SDK zip + run: ./gradlew :table-store:distZip + + - name: Upload TableStore client SDK zip + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GH_PROJECT_ACCESS_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: table-store/build/distributions/scalardl-tablestore-java-client-sdk-${{ steps.version.outputs.version }}.zip + asset_name: scalardl-tablestore-java-client-sdk-${{ steps.version.outputs.version }}.zip + asset_content_type: application/zip + - name: Build zip for generic contracts and functions run: ./gradlew :generic-contracts:distZip diff --git a/.github/workflows/release-snapshot.yaml b/.github/workflows/release-snapshot.yaml index 991665dc..7960d9a9 100644 --- a/.github/workflows/release-snapshot.yaml +++ b/.github/workflows/release-snapshot.yaml @@ -34,7 +34,7 @@ jobs: if: contains(steps.version.outputs.version, '-SNAPSHOT') run: ./gradlew publish - - name: Upload the SNAPSHOT versions of scalardl-ledger, scalardl-java-client-sdk, scalardl-common, and scalardl-rpc to Maven Central Repository + - name: Upload the SNAPSHOT versions of scalardl-* libraries to Maven Central Repository if: contains(steps.version.outputs.version, '-SNAPSHOT') env: JRELEASER_NEXUS2_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }} diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 4be274a0..88c41832 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -35,7 +35,7 @@ jobs: - name: Prepare artifacts in staging-deploy directories run: ./gradlew publish - - name: Upload scalardl-ledger, scalardl-java-client-sdk, scalardl-common, and scalardl-rpc to Maven Central Repository + - name: Upload scalardl-* libraries to Maven Central Repository env: JRELEASER_MAVENCENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }} JRELEASER_MAVENCENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} diff --git a/.github/workflows/scalar.yml b/.github/workflows/scalar.yml index fc7a17ac..eb17b131 100644 --- a/.github/workflows/scalar.yml +++ b/.github/workflows/scalar.yml @@ -156,8 +156,8 @@ jobs: name: integration_test_reports_for_generic_contracts path: generic-contracts/build/reports/tests/integrationTest - integration-test-for-hash-store: - name: Integration test for hash store + integration-test-for-hashstore: + name: Integration test for HashStore runs-on: ubuntu-latest services: @@ -190,8 +190,8 @@ jobs: name: integration_test_reports_for_hash_store path: hash-store/build/reports/tests/integrationTest - integration-test-for-table-store: - name: Integration test for table store + integration-test-for-tablestore: + name: Integration test for TableStore runs-on: ubuntu-latest services: diff --git a/hash-store/archive.gradle b/hash-store/archive.gradle new file mode 100644 index 00000000..c2e8fe2d --- /dev/null +++ b/hash-store/archive.gradle @@ -0,0 +1,47 @@ +apply plugin: 'maven-publish' + +publishing { + publications { + mavenJava(MavenPublication) { + artifactId = 'scalardl-hashstore-java-client-sdk' + from components.java + artifact distTar + artifact distZip + artifact javadocJar + artifact sourcesJar + pom { + name = 'ScalarDL HashStore Java Client SDK' + description = 'A client-side Java library to interact with ScalarDL HashStore.' + url = 'https://github.com/scalar-labs/scalardl' + licenses { + license { + name = 'Apache License, Version 2.0' + url = 'http://www.apache.org/licenses/LICENSE-2.0' + } + } + developers { + developer { + id = 'hiroyuki' + name = 'Hiroyuki Yamada' + email = 'hiroyuki.yamada@scalar-labs.com' + } + developer { + id = 'jnmt' + name = 'Jun Nemoto' + email = 'jun.nemoto@scalar-labs.com' + } + } + scm { + connection = 'scm:git:https://github.com/scalar-labs/scalardl.git' + developerConnection = 'scm:git:https://github.com/scalar-labs/scalardl.git' + url = 'https://github.com/scalar-labs/scalardl' + } + } + } + } + repositories { + maven { + url = layout.buildDirectory.dir('staging-deploy') + } + } +} diff --git a/hash-store/build.gradle b/hash-store/build.gradle index d2f5f417..5ee8a79e 100644 --- a/hash-store/build.gradle +++ b/hash-store/build.gradle @@ -47,7 +47,7 @@ dependencies { task HashStore(type: CreateStartScripts) { mainClass = 'com.scalar.dl.hashstore.client.tool.HashStoreCommandLine' - applicationName = 'scalardl-hash-store' + applicationName = 'scalardl-hashstore' outputDir = new File(project.buildDir, 'tmp') classpath = jar.outputs.files + project.configurations.runtimeClasspath } @@ -102,3 +102,26 @@ task sourcesJar(type: Jar) { classifier = 'sources' from sourceSets.main.allSource } + +javadoc { + title = "ScalarDL HashStore Java Client SDK ${version}" + source += sourceSets.main.java + source += project(':client').sourceSets.main.java + source += project(':common').sourceSets.main.java + include "com/scalar/dl/hashstore/**" + include "com/scalar/dl/client/exception/*.java" + include "com/scalar/dl/ledger/model/*.java" +} + +distZip { + archiveFileName = "scalardl-hashstore-java-client-sdk-${project.version}.zip" +} + +archivesBaseName = "scalardl-hashstore-java-client-sdk" + +// for archiving and uploading to maven central +if (!project.gradle.startParameter.taskNames.isEmpty() && + (project.gradle.startParameter.taskNames[0].endsWith('publish') || + project.gradle.startParameter.taskNames[0].endsWith('publishToMavenLocal'))) { + apply from: 'archive.gradle' +} diff --git a/hash-store/src/main/java/com/scalar/dl/hashstore/client/tool/HashStoreCommandLine.java b/hash-store/src/main/java/com/scalar/dl/hashstore/client/tool/HashStoreCommandLine.java index 9206e957..51e7f51c 100644 --- a/hash-store/src/main/java/com/scalar/dl/hashstore/client/tool/HashStoreCommandLine.java +++ b/hash-store/src/main/java/com/scalar/dl/hashstore/client/tool/HashStoreCommandLine.java @@ -14,7 +14,7 @@ import picocli.CommandLine.HelpCommand; @Command( - name = "scalardl-hash-store", + name = "scalardl-hashstore", subcommands = { HelpCommand.class, Bootstrap.class, @@ -28,7 +28,7 @@ CollectionHistoryGet.class, LedgerValidation.class, }, - description = {"These are ScalarDL Hash Store commands used in various situations:"}) + description = {"These are ScalarDL HashStore commands used in various situations:"}) public class HashStoreCommandLine { public static void main(String[] args) { diff --git a/hash-store/src/test/java/com/scalar/dl/hashstore/client/tool/HashStoreCommandLineTest.java b/hash-store/src/test/java/com/scalar/dl/hashstore/client/tool/HashStoreCommandLineTest.java index 77c80bab..cc0b90fd 100644 --- a/hash-store/src/test/java/com/scalar/dl/hashstore/client/tool/HashStoreCommandLineTest.java +++ b/hash-store/src/test/java/com/scalar/dl/hashstore/client/tool/HashStoreCommandLineTest.java @@ -36,8 +36,8 @@ void displaysGroupedSubcommands() { String expected = String.join( System.lineSeparator(), - "Usage: scalardl-hash-store [COMMAND]", - "These are ScalarDL Hash Store commands used in various situations:", + "Usage: scalardl-hashstore [COMMAND]", + "These are ScalarDL HashStore commands used in various situations:", "", "bootstrap the hash store", " bootstrap Bootstrap the hash store by registering identity and", @@ -76,7 +76,7 @@ void setup() { @Test @DisplayName("member values are properly set") void memberValuesAreProperlySet() { - assertThat(command.name()).isEqualTo("scalardl-hash-store"); + assertThat(command.name()).isEqualTo("scalardl-hashstore"); assertThat(command.subcommands()) .isEqualTo( new Class[] { @@ -114,7 +114,7 @@ public void parseCommandSucceeds() { // Verify that the argument contains only the top-level command. assertThat(parsed.size()).isEqualTo(1); - // Verify that the top-level command is "scalardl-hash-store". + // Verify that the top-level command is "scalardl-hashstore". assertThat(parsed.get(0).getCommand().getClass()).isEqualTo(HashStoreCommandLine.class); } } diff --git a/table-store/archive.gradle b/table-store/archive.gradle new file mode 100644 index 00000000..0a78231b --- /dev/null +++ b/table-store/archive.gradle @@ -0,0 +1,47 @@ +apply plugin: 'maven-publish' + +publishing { + publications { + mavenJava(MavenPublication) { + artifactId = 'scalardl-tablestore-java-client-sdk' + from components.java + artifact distTar + artifact distZip + artifact javadocJar + artifact sourcesJar + pom { + name = 'ScalarDL TableStore Java Client SDK' + description = 'A client-side Java library to interact with ScalarDL TableStore.' + url = 'https://github.com/scalar-labs/scalardl' + licenses { + license { + name = 'Apache License, Version 2.0' + url = 'http://www.apache.org/licenses/LICENSE-2.0' + } + } + developers { + developer { + id = 'hiroyuki' + name = 'Hiroyuki Yamada' + email = 'hiroyuki.yamada@scalar-labs.com' + } + developer { + id = 'jnmt' + name = 'Jun Nemoto' + email = 'jun.nemoto@scalar-labs.com' + } + } + scm { + connection = 'scm:git:https://github.com/scalar-labs/scalardl.git' + developerConnection = 'scm:git:https://github.com/scalar-labs/scalardl.git' + url = 'https://github.com/scalar-labs/scalardl' + } + } + } + } + repositories { + maven { + url = layout.buildDirectory.dir('staging-deploy') + } + } +} diff --git a/table-store/build.gradle b/table-store/build.gradle index 66c5e7c5..abdc4474 100644 --- a/table-store/build.gradle +++ b/table-store/build.gradle @@ -46,7 +46,7 @@ dependencies { task TableStore(type: CreateStartScripts) { mainClass = 'com.scalar.dl.tablestore.client.tool.TableStoreCommandLine' - applicationName = 'scalardl-table-store' + applicationName = 'scalardl-tablestore' outputDir = new File(project.buildDir, 'tmp') classpath = jar.outputs.files + project.configurations.runtimeClasspath } @@ -101,3 +101,26 @@ task sourcesJar(type: Jar) { classifier = 'sources' from sourceSets.main.allSource } + +javadoc { + title = "ScalarDL TableStore Java Client SDK ${version}" + source += sourceSets.main.java + source += project(':client').sourceSets.main.java + source += project(':common').sourceSets.main.java + include "com/scalar/dl/tablestore/**" + include "com/scalar/dl/client/exception/*.java" + include "com/scalar/dl/ledger/model/*.java" +} + +distZip { + archiveFileName = "scalardl-tablestore-java-client-sdk-${project.version}.zip" +} + +archivesBaseName = "scalardl-tablestore-java-client-sdk" + +// for archiving and uploading to maven central +if (!project.gradle.startParameter.taskNames.isEmpty() && + (project.gradle.startParameter.taskNames[0].endsWith('publish') || + project.gradle.startParameter.taskNames[0].endsWith('publishToMavenLocal'))) { + apply from: 'archive.gradle' +} diff --git a/table-store/src/main/java/com/scalar/dl/tablestore/client/service/TableStoreClientService.java b/table-store/src/main/java/com/scalar/dl/tablestore/client/service/TableStoreClientService.java index 705b4b29..34d9429b 100644 --- a/table-store/src/main/java/com/scalar/dl/tablestore/client/service/TableStoreClientService.java +++ b/table-store/src/main/java/com/scalar/dl/tablestore/client/service/TableStoreClientService.java @@ -39,7 +39,6 @@ import java.util.List; import java.util.Map; import javax.annotation.concurrent.Immutable; -import javax.json.JsonObject; import javax.json.JsonValue; /** @@ -60,7 +59,7 @@ * * TableStoreClientService service = factory.create(new ClientConfig(new File(properties)); * try { - * String statement = ...; // prepare a PartiQL statement + * String statement = ...; // prepare an SQL statement * StatementExecutionResult result = service.executeStatement(statement); * result.getResult().ifPresent(System.out::println); * } catch (ClientException e) { @@ -130,18 +129,6 @@ private void registerContracts() { } } - /** - * Retrieves a list of contracts for the certificate holder specified in {@code ClientConfig}. If - * specified with a contract ID, it will return the matching contract only. - * - * @param id a contract ID - * @return {@link JsonObject} - * @throws ClientException if a request fails for some reason - */ - public JsonObject listContracts(String id) { - return clientService.listContracts(id); - } - /** * Executes the specified statement. * diff --git a/table-store/src/main/java/com/scalar/dl/tablestore/client/tool/TableStoreCommandLine.java b/table-store/src/main/java/com/scalar/dl/tablestore/client/tool/TableStoreCommandLine.java index 21a25b42..f025d9ae 100644 --- a/table-store/src/main/java/com/scalar/dl/tablestore/client/tool/TableStoreCommandLine.java +++ b/table-store/src/main/java/com/scalar/dl/tablestore/client/tool/TableStoreCommandLine.java @@ -13,14 +13,14 @@ import picocli.CommandLine.HelpCommand; @Command( - name = "scalardl-table-store", + name = "scalardl-tablestore", subcommands = { Bootstrap.class, HelpCommand.class, LedgerValidation.class, StatementExecution.class, }, - description = {"These are ScalarDL Table Store commands:"}) + description = {"These are ScalarDL TableStore commands:"}) public class TableStoreCommandLine { public static void main(String[] args) { diff --git a/table-store/src/test/java/com/scalar/dl/tablestore/client/service/TableStoreClientServiceTest.java b/table-store/src/test/java/com/scalar/dl/tablestore/client/service/TableStoreClientServiceTest.java index 82b34283..0cedd869 100644 --- a/table-store/src/test/java/com/scalar/dl/tablestore/client/service/TableStoreClientServiceTest.java +++ b/table-store/src/test/java/com/scalar/dl/tablestore/client/service/TableStoreClientServiceTest.java @@ -127,19 +127,6 @@ public void bootstrap_OtherExceptionThrown_ShouldThrowException() { assertThat(((ClientException) thrown).getStatusCode()).isEqualTo(StatusCode.INVALID_REQUEST); } - @Test - public void listContracts_ShouldCallClientServiceListContracts() { - // Arrange - when(clientService.listContracts(ANY_ID)).thenReturn(ANY_JSON_OBJECT); - - // Act - JsonObject result = service.listContracts(ANY_ID); - - // Assert - verify(clientService).listContracts(ANY_ID); - assertThat(result).isEqualTo(ANY_JSON_OBJECT); - } - @Test public void executeStatement_ValidStatement_ShouldReturnStatementExecutionResult() { // Arrange diff --git a/table-store/src/test/java/com/scalar/dl/tablestore/client/tool/TableStoreCommandLineTest.java b/table-store/src/test/java/com/scalar/dl/tablestore/client/tool/TableStoreCommandLineTest.java index d44460c4..ad54144b 100644 --- a/table-store/src/test/java/com/scalar/dl/tablestore/client/tool/TableStoreCommandLineTest.java +++ b/table-store/src/test/java/com/scalar/dl/tablestore/client/tool/TableStoreCommandLineTest.java @@ -36,8 +36,8 @@ void displaysGroupedSubcommands() { String expected = String.join( System.lineSeparator(), - "Usage: scalardl-table-store [COMMAND]", - "These are ScalarDL Table Store commands:", + "Usage: scalardl-tablestore [COMMAND]", + "These are ScalarDL TableStore commands:", "", "bootstrap the table store", " bootstrap Bootstrap the table store by registering identity and", @@ -67,7 +67,7 @@ void setup() { @Test @DisplayName("member values are properly set") void memberValuesAreProperlySet() { - assertThat(command.name()).isEqualTo("scalardl-table-store"); + assertThat(command.name()).isEqualTo("scalardl-tablestore"); assertThat(command.subcommands()) .isEqualTo( new Class[] { @@ -98,7 +98,7 @@ public void parseCommandSucceeds() { // Verify that the argument contains only the top-level command. assertThat(parsed.size()).isEqualTo(1); - // Verify that the top-level command is "scalardl-table-store". + // Verify that the top-level command is "scalardl-tablestore". assertThat(parsed.get(0).getCommand().getClass()).isEqualTo(TableStoreCommandLine.class); } }