Skip to content
Draft
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
31 changes: 31 additions & 0 deletions .github/workflows/conformance.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Zarr Conformance Tests

on:
workflow_dispatch:
schedule:
- cron: '17 3 * * 0'
pull_request:
branches: [ "main" ]

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/[email protected]
with:
zarr-cli: "java -jar target/zarr-java-0.0.9.jar"
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,5 @@ build/
/main.py
/pyproject.toml
/uv.lock
**/__pycache__
**/__pycache__
/dependency-reduced-pom.xml
26 changes: 26 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,12 @@
<version>4.13.1</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>info.picocli</groupId>
<artifactId>picocli</artifactId>
<version>4.7.6</version>
</dependency>
</dependencies>

<repositories>
Expand Down Expand Up @@ -231,6 +237,26 @@
<tokenAuth>true</tokenAuth>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.5.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>dev.zarr.zarrjava.cli.Main</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
44 changes: 44 additions & 0 deletions src/main/java/dev/zarr/zarrjava/cli/Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
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<Integer> {

@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 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);
e.printStackTrace();
return 1;
}
}

public static void main(String[] args) {
int exitCode = new CommandLine(new Main()).execute(args);
System.exit(exitCode);
}
}
Loading