Skip to content

Commit

Permalink
Use blaze for local, fast, cross-platform unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jjlauer committed Jan 8, 2025
1 parent d871848 commit 8400655
Show file tree
Hide file tree
Showing 5 changed files with 137 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .blaze/blaze.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
blaze.dependencies = [
"com.fizzed:blaze-ssh"
"com.fizzed:buildx:1.0.7"
"com.fizzed:jne:4.1.1"
]

java.source.version = 8
50 changes: 50 additions & 0 deletions .blaze/blaze.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import com.fizzed.blaze.Config;
import com.fizzed.blaze.Contexts;
import com.fizzed.blaze.Task;
import com.fizzed.buildx.Buildx;
import com.fizzed.buildx.ContainerBuilder;
import com.fizzed.buildx.Target;
import com.fizzed.jne.*;
import org.slf4j.Logger;

import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;

import static com.fizzed.blaze.Contexts.withBaseDir;
import static com.fizzed.blaze.Systems.*;
import static com.fizzed.blaze.util.Globber.globber;
import static java.util.Arrays.asList;
import static java.util.Optional.ofNullable;

public class blaze {
private final Logger log = Contexts.logger();
private final Config config = Contexts.config();
private final Path projectDir = withBaseDir("../").toAbsolutePath();
private final NativeTarget localNativeTarget = NativeTarget.detect();
private final Path nativeDir = projectDir.resolve("native");
private final Path targetDir = projectDir.resolve("target");

private final List<Target> crossTargets = asList(
new Target("linux", "x64").setTags("test").setHost("build-x64-linux-latest"),
new Target("linux", "arm64").setTags("test").setHost("build-arm64-linux-latest"),
new Target("linux", "riscv64").setTags("test").setHost("build-riscv64-linux-latest"),
new Target("macos", "x64").setTags("test").setHost("build-x64-macos-latest"),
new Target("macos", "arm64").setTags("test").setHost("build-arm64-macos-latest"),
new Target("windows", "x64").setTags("test").setHost("build-x64-windows-latest"),
new Target("windows", "arm64").setTags("test").setHost("build-arm64-windows-latest"),
new Target("freebsd", "x64").setTags("test").setHost("build-x64-freebsd-latest"),
new Target("openbsd", "x64").setTags("test").setHost("build-x64-openbsd-latest")
);

@Task(order = 1)
public void cross_tests() throws Exception {
new Buildx(crossTargets)
.tags("test")
.execute((target, project) -> {
project.action("mvn", "test")
.run();
});
}

}
79 changes: 79 additions & 0 deletions .blaze/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>blaze</groupId>
<artifactId>tokyocabinet-blaze</artifactId>
<version>0.0.1</version>

<!--
THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT BY HAND!
Edit or create a <blaze-script>.conf file, and re-run the generate-maven-project command.
-->

<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<maven.install.skip>true</maven.install.skip>
<maven.deploy.skip>true</maven.deploy.skip>
</properties>
<build>
<sourceDirectory>${project.basedir}</sourceDirectory>
</build>
<dependencies>
<dependency>
<groupId>com.fizzed</groupId>
<artifactId>blaze-ivy</artifactId>
<version>1.5.0</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.11.0</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>2.0.7</version>
</dependency>
<dependency>
<groupId>com.typesafe</groupId>
<artifactId>config</artifactId>
<version>1.3.0</version>
</dependency>
<dependency>
<groupId>org.apache.ivy</groupId>
<artifactId>ivy</artifactId>
<version>2.5.2</version>
</dependency>
<dependency>
<groupId>com.fizzed</groupId>
<artifactId>blaze-core</artifactId>
<version>1.5.0</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>2.0.7</version>
</dependency>
<dependency>
<groupId>org.zeroturnaround</groupId>
<artifactId>zt-exec</artifactId>
<version>1.12</version>
</dependency>
<dependency>
<groupId>com.fizzed</groupId>
<artifactId>blaze-ssh</artifactId>
<version>1.5.0</version>
</dependency>
<dependency>
<groupId>com.fizzed</groupId>
<artifactId>buildx</artifactId>
<version>1.0.7</version>
</dependency>
<dependency>
<groupId>com.fizzed</groupId>
<artifactId>jne</artifactId>
<version>4.1.1</version>
</dependency>
</dependencies>
</project>
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ ninja-upstream
.vagrant
.idea
*.iml
.buildx
Binary file added blaze.jar
Binary file not shown.

0 comments on commit 8400655

Please sign in to comment.