From 9493eb8fa10a7666f96e3b77efd7f90d3dc621de Mon Sep 17 00:00:00 2001 From: brokkoli71 Date: Mon, 5 Jan 2026 14:59:35 +0100 Subject: [PATCH 1/4] add cli wrapper --- .github/workflows/conformance.yml | 29 ++++++++++++++ pom.xml | 25 ++++++++++++ src/main/java/dev/zarr/zarrjava/cli/Main.java | 38 +++++++++++++++++++ 3 files changed, 92 insertions(+) create mode 100644 .github/workflows/conformance.yml create mode 100644 src/main/java/dev/zarr/zarrjava/cli/Main.java diff --git a/.github/workflows/conformance.yml b/.github/workflows/conformance.yml new file mode 100644 index 0000000..927c3ff --- /dev/null +++ b/.github/workflows/conformance.yml @@ -0,0 +1,29 @@ +name: Zarr Conformance Tests + +on: + workflow_dispatch: + schedule: + - cron: '17 3 * * 0' + +jobs: + conformance-tests: + runs-on: ubuntu-latest + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + steps: + - uses: actions/checkout@v5 + + - name: Set up JDK + uses: actions/setup-java@v4 + with: + java-version: '11' + distribution: 'temurin' + cache: maven + + - name: Build + run: mvn package -DskipTests + + - name: Run Conformance Tests + uses: Bisaloo/zarr-conformance-tests@v0.0.1 + with: + zarr-cli: "java -jar target/zarr-java-0.0.9.jar" diff --git a/pom.xml b/pom.xml index 3df9b78..819f13e 100644 --- a/pom.xml +++ b/pom.xml @@ -121,6 +121,11 @@ 4.13.1 test + + info.picocli + picocli + 4.7.6 + @@ -231,6 +236,26 @@ true + + org.apache.maven.plugins + maven-shade-plugin + 3.5.0 + + + package + + shade + + + + + dev.zarr.zarrjava.cli.Main + + + + + + diff --git a/src/main/java/dev/zarr/zarrjava/cli/Main.java b/src/main/java/dev/zarr/zarrjava/cli/Main.java new file mode 100644 index 0000000..3a9eae8 --- /dev/null +++ b/src/main/java/dev/zarr/zarrjava/cli/Main.java @@ -0,0 +1,38 @@ +package dev.zarr.zarrjava.cli; + +import dev.zarr.zarrjava.core.Array; +import picocli.CommandLine; +import picocli.CommandLine.Command; +import picocli.CommandLine.Option; + +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.concurrent.Callable; + +@Command(name = "zarr-java-cli", mixinStandardHelpOptions = true, version = "1.0", description = "CLI wrapper for zarr-java conformance tests.") +public class Main implements Callable { + + @Option(names = { "--array_path" }, description = "Path to the Zarr array", required = true) + private String arrayPath; + + @Override + public Integer call() throws Exception { + try { + Path path = Paths.get(arrayPath); + // Attempt to open the array. This should throw if the array is invalid or + // cannot be opened. + Array.open(path); + // If we get here, it means we successfully opened the array. + return 0; + } catch (Exception e) { + System.err.println("Failed to open array at " + arrayPath); + e.printStackTrace(); + return 1; + } + } + + public static void main(String[] args) { + int exitCode = new CommandLine(new Main()).execute(args); + System.exit(exitCode); + } +} From 2ec5bda12f6187dbdba3c5463eeb014b9f9b00b3 Mon Sep 17 00:00:00 2001 From: Hannes Spitz <44113112+brokkoli71@users.noreply.github.com> Date: Mon, 5 Jan 2026 15:03:51 +0100 Subject: [PATCH 2/4] Add pull request trigger to conformance workflow --- .github/workflows/conformance.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/conformance.yml b/.github/workflows/conformance.yml index 927c3ff..8bf9afc 100644 --- a/.github/workflows/conformance.yml +++ b/.github/workflows/conformance.yml @@ -4,6 +4,8 @@ on: workflow_dispatch: schedule: - cron: '17 3 * * 0' + pull_request: + branches: [ "main" ] jobs: conformance-tests: From 5e491af03abea63614d983acadd4b97082025ea9 Mon Sep 17 00:00:00 2001 From: brokkoli71 Date: Mon, 5 Jan 2026 15:13:36 +0100 Subject: [PATCH 3/4] fix pom dependencies --- pom.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pom.xml b/pom.xml index 819f13e..1119bad 100644 --- a/pom.xml +++ b/pom.xml @@ -121,6 +121,11 @@ 4.13.1 test + + org.apache.commons + commons-compress + 1.28.0 + info.picocli picocli From 909da8bc873f051e637f28e5824f448f2f265114 Mon Sep 17 00:00:00 2001 From: brokkoli71 Date: Mon, 5 Jan 2026 15:23:17 +0100 Subject: [PATCH 4/4] print array --- .gitignore | 3 ++- pom.xml | 6 +----- src/main/java/dev/zarr/zarrjava/cli/Main.java | 10 ++++++++-- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index fcafa91..4c52107 100644 --- a/.gitignore +++ b/.gitignore @@ -45,4 +45,5 @@ build/ /main.py /pyproject.toml /uv.lock -**/__pycache__ \ No newline at end of file +**/__pycache__ +/dependency-reduced-pom.xml diff --git a/pom.xml b/pom.xml index 1119bad..5adcaa9 100644 --- a/pom.xml +++ b/pom.xml @@ -121,11 +121,7 @@ 4.13.1 test - - org.apache.commons - commons-compress - 1.28.0 - + info.picocli picocli diff --git a/src/main/java/dev/zarr/zarrjava/cli/Main.java b/src/main/java/dev/zarr/zarrjava/cli/Main.java index 3a9eae8..1d18cfb 100644 --- a/src/main/java/dev/zarr/zarrjava/cli/Main.java +++ b/src/main/java/dev/zarr/zarrjava/cli/Main.java @@ -21,8 +21,14 @@ public Integer call() throws Exception { Path path = Paths.get(arrayPath); // Attempt to open the array. This should throw if the array is invalid or // cannot be opened. - Array.open(path); - // If we get here, it means we successfully opened the array. + Array array = Array.open(path); + + // Read the entire array + ucar.ma2.Array data = array.read(); + + // Print the array values using ucar.ma2.Array's string representation. + System.out.println(data.toString()); + return 0; } catch (Exception e) { System.err.println("Failed to open array at " + arrayPath);