Skip to content

Commit

Permalink
Initial support for local cross-platform CI tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jjlauer committed Jan 8, 2025
1 parent a06f701 commit 9982663
Show file tree
Hide file tree
Showing 25 changed files with 144 additions and 12 deletions.
2 changes: 2 additions & 0 deletions .blaze/blaze.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
blaze.dependencies = [
"com.fizzed:blaze-ssh"
"com.fizzed:buildx:1.0.7"
"com.fizzed:jne:4.1.1"
]

Expand Down
24 changes: 24 additions & 0 deletions .blaze/blaze.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import com.fizzed.blaze.Config;
import com.fizzed.blaze.Contexts;
import com.fizzed.blaze.Task;
import com.fizzed.buildx.Buildx;
import com.fizzed.buildx.Target;
import com.fizzed.jne.HardwareArchitecture;
import com.fizzed.jne.JavaHome;
import com.fizzed.jne.JavaHomeFinder;
Expand Down Expand Up @@ -87,4 +89,26 @@ public void test_all_jdks() throws Exception {
jdks.forEach(jdk -> log.info(" {}", jdk));
}

private final List<Target> crossTestTargets = 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(crossTestTargets)
.tags("test")
.execute((target, project) -> {
project.action("mvn", "clean", "test")
.run();
});
}

}
10 changes: 10 additions & 0 deletions .blaze/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,16 @@
<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>
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ target
*.iml
nb-configuration.xml
.idea
.buildx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package com.fizzed.bigmap;

import org.junit.jupiter.api.Test;

import java.io.IOException;
import java.nio.file.Files;
import java.util.*;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,25 @@
package com.fizzed.bigmap;

import com.fizzed.bigmap.rocksdb.RocksBigLinkedMapBuilder;
import com.fizzed.jne.HardwareArchitecture;
import com.fizzed.jne.NativeTarget;
import com.fizzed.jne.OperatingSystem;
import org.junit.jupiter.api.condition.DisabledIf;

import java.nio.file.Paths;
import java.util.Map;

@DisabledIf("isUnsupportedOs")
public class RocksBigLinkedMapTest extends AbstractBigLinkedMapTest {

static public boolean isUnsupportedOs() {
final NativeTarget current = NativeTarget.detect();
return current.getOperatingSystem() == OperatingSystem.FREEBSD
|| current.getOperatingSystem() == OperatingSystem.OPENBSD
|| (current.getOperatingSystem() == OperatingSystem.WINDOWS && current.getHardwareArchitecture() == HardwareArchitecture.ARM64)
|| (current.getOperatingSystem() == OperatingSystem.LINUX && current.getHardwareArchitecture() == HardwareArchitecture.RISCV64);
}

@Override
public <K,V> Map<K, V> newMap(Class<K> keyType, Class<V> valueType) {
return new RocksBigLinkedMapBuilder<K,V>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,25 @@
package com.fizzed.bigmap;

import com.fizzed.bigmap.rocksdb.RocksBigLinkedSetBuilder;
import com.fizzed.jne.HardwareArchitecture;
import com.fizzed.jne.NativeTarget;
import com.fizzed.jne.OperatingSystem;
import org.junit.jupiter.api.condition.DisabledIf;

import java.nio.file.Paths;
import java.util.Set;

@DisabledIf("isUnsupportedOs")
public class RocksBigLinkedSetTest extends AbstractBigLinkedSetTest {

static public boolean isUnsupportedOs() {
final NativeTarget current = NativeTarget.detect();
return current.getOperatingSystem() == OperatingSystem.FREEBSD
|| current.getOperatingSystem() == OperatingSystem.OPENBSD
|| (current.getOperatingSystem() == OperatingSystem.WINDOWS && current.getHardwareArchitecture() == HardwareArchitecture.ARM64)
|| (current.getOperatingSystem() == OperatingSystem.LINUX && current.getHardwareArchitecture() == HardwareArchitecture.RISCV64);
}

@Override
public <V> Set<V> newSet(Class<V> valueType) {
return new RocksBigLinkedSetBuilder<V>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,25 @@
package com.fizzed.bigmap;

import com.fizzed.bigmap.rocksdb.RocksBigMapBuilder;
import com.fizzed.jne.HardwareArchitecture;
import com.fizzed.jne.NativeTarget;
import com.fizzed.jne.OperatingSystem;
import org.junit.jupiter.api.condition.DisabledIf;

import java.nio.file.Paths;
import java.util.Map;

@DisabledIf("isUnsupportedOs")
public class RocksBigMapTest extends AbstractBigMapTest {

static public boolean isUnsupportedOs() {
final NativeTarget current = NativeTarget.detect();
return current.getOperatingSystem() == OperatingSystem.FREEBSD
|| current.getOperatingSystem() == OperatingSystem.OPENBSD
|| (current.getOperatingSystem() == OperatingSystem.WINDOWS && current.getHardwareArchitecture() == HardwareArchitecture.ARM64)
|| (current.getOperatingSystem() == OperatingSystem.LINUX && current.getHardwareArchitecture() == HardwareArchitecture.RISCV64);
}

@Override
public <K,V> Map<K, V> newMap(Class<K> keyType, Class<V> valueType) {
return new RocksBigMapBuilder<K,V>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,25 @@
package com.fizzed.bigmap;

import com.fizzed.bigmap.rocksdb.RocksBigSetBuilder;
import com.fizzed.jne.HardwareArchitecture;
import com.fizzed.jne.NativeTarget;
import com.fizzed.jne.OperatingSystem;
import org.junit.jupiter.api.condition.DisabledIf;

import java.nio.file.Paths;
import java.util.Set;

@DisabledIf("isUnsupportedOs")
public class RocksBigSetTest extends AbstractBigSetTest {

static public boolean isUnsupportedOs() {
final NativeTarget current = NativeTarget.detect();
return current.getOperatingSystem() == OperatingSystem.FREEBSD
|| current.getOperatingSystem() == OperatingSystem.OPENBSD
|| (current.getOperatingSystem() == OperatingSystem.WINDOWS && current.getHardwareArchitecture() == HardwareArchitecture.ARM64)
|| (current.getOperatingSystem() == OperatingSystem.LINUX && current.getHardwareArchitecture() == HardwareArchitecture.RISCV64);
}

@Override
public <V> Set<V> newSet(Class<V> valueType) {
return new RocksBigSetBuilder<V>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,13 @@
package com.fizzed.bigmap;

import com.fizzed.bigmap.tkrzw.TkrzwBigLinkedMapBuilder;
import org.junit.jupiter.api.condition.DisabledOnOs;
import org.junit.jupiter.api.condition.OS;

import java.nio.file.Paths;
import java.util.Map;

@DisabledOnOs({ OS.FREEBSD, OS.OPENBSD })
public class TkrzwBigLinkedMapTest extends AbstractBigLinkedMapTest {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,13 @@
package com.fizzed.bigmap;

import com.fizzed.bigmap.tkrzw.TkrzwBigLinkedSetBuilder;
import org.junit.jupiter.api.condition.DisabledOnOs;
import org.junit.jupiter.api.condition.OS;

import java.nio.file.Paths;
import java.util.Set;

@DisabledOnOs({ OS.FREEBSD, OS.OPENBSD })
public class TkrzwBigLinkedSetTest extends AbstractBigLinkedSetTest {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,13 @@
package com.fizzed.bigmap;

import com.fizzed.bigmap.tkrzw.TkrzwBigMapBuilder;
import org.junit.jupiter.api.condition.DisabledOnOs;
import org.junit.jupiter.api.condition.OS;

import java.nio.file.Paths;
import java.util.Map;

@DisabledOnOs({ OS.FREEBSD, OS.OPENBSD })
public class TkrzwBigMapTest extends AbstractBigMapTest {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,13 @@
package com.fizzed.bigmap;

import com.fizzed.bigmap.tkrzw.TkrzwBigSetBuilder;
import org.junit.jupiter.api.condition.DisabledOnOs;
import org.junit.jupiter.api.condition.OS;

import java.nio.file.Paths;
import java.util.Set;

@DisabledOnOs({ OS.FREEBSD, OS.OPENBSD })
public class TkrzwBigSetTest extends AbstractBigSetTest {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import java.nio.file.Paths;
import java.util.Map;

@DisabledOnOs(value=OS.WINDOWS, disabledReason="TokyoCabinet does not support windows")
@DisabledOnOs({ OS.WINDOWS, OS.FREEBSD, OS.OPENBSD })
public class TokyoBigLinkedMapTest extends AbstractBigLinkedMapTest {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import java.nio.file.Paths;
import java.util.Set;

@DisabledOnOs(value=OS.WINDOWS, disabledReason="TokyoCabinet does not support windows")
@DisabledOnOs({ OS.WINDOWS, OS.FREEBSD, OS.OPENBSD })
public class TokyoBigLinkedSetTest extends AbstractBigLinkedSetTest {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import java.nio.file.Paths;
import java.util.Map;

@DisabledOnOs(value=OS.WINDOWS, disabledReason="TokyoCabinet does not support windows")
@DisabledOnOs({ OS.WINDOWS, OS.FREEBSD, OS.OPENBSD })
public class TokyoBigMapTest extends AbstractBigMapTest {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import java.nio.file.Paths;
import java.util.Set;

@DisabledOnOs(value=OS.WINDOWS, disabledReason="TokyoCabinet does not support windows")
@DisabledOnOs({ OS.WINDOWS, OS.FREEBSD, OS.OPENBSD })
public class TokyoBigSetTest extends AbstractBigSetTest {

@Override
Expand Down
6 changes: 6 additions & 0 deletions bigmap-rocksdb/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@

<!-- testing -->

<dependency>
<groupId>com.fizzed</groupId>
<artifactId>jne</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>java-hamcrest</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,13 @@
*/
package com.fizzed.bigmap.rocksdb;

import com.fizzed.jne.HardwareArchitecture;
import com.fizzed.jne.NativeTarget;
import com.fizzed.jne.OperatingSystem;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledIf;
import org.junit.jupiter.api.condition.DisabledOnOs;
import org.junit.jupiter.api.condition.OS;

import java.nio.file.Paths;
import java.util.Map;
Expand All @@ -24,8 +30,17 @@
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.nullValue;

@DisabledIf("isUnsupportedOs")
public class RocksBigMapTest {

static public boolean isUnsupportedOs() {
final NativeTarget current = NativeTarget.detect();
return current.getOperatingSystem() == OperatingSystem.FREEBSD
|| current.getOperatingSystem() == OperatingSystem.OPENBSD
|| (current.getOperatingSystem() == OperatingSystem.WINDOWS && current.getHardwareArchitecture() == HardwareArchitecture.ARM64)
|| (current.getOperatingSystem() == OperatingSystem.LINUX && current.getHardwareArchitecture() == HardwareArchitecture.RISCV64);
}

@Test
public void putGetWithStrings() {
final Map<String,String> map = new RocksBigMapBuilder<String,String>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@

import com.fizzed.bigmap.BigMap;
import org.junit.jupiter.api.Test;
import tkrzw.DBM;
import tkrzw.Iterator;
import tkrzw.Status;
import org.junit.jupiter.api.condition.DisabledOnOs;
import org.junit.jupiter.api.condition.OS;

import java.io.IOException;
import java.nio.file.Files;
Expand All @@ -15,6 +14,7 @@
import static org.hamcrest.CoreMatchers.nullValue;
import static org.hamcrest.MatcherAssert.assertThat;

@DisabledOnOs({ OS.FREEBSD, OS.OPENBSD })
public class TkrzwBigMapTest {

@Test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
package com.fizzed.bigmap.tkrzw;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledOnOs;
import org.junit.jupiter.api.condition.OS;

import java.nio.file.Paths;
import java.util.Set;

@DisabledOnOs({ OS.FREEBSD, OS.OPENBSD })
public class TkrzwBigSetTest {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import static org.hamcrest.CoreMatchers.nullValue;
import static org.hamcrest.MatcherAssert.assertThat;

@DisabledOnOs(OS.WINDOWS)
@DisabledOnOs({ OS.WINDOWS, OS.FREEBSD, OS.OPENBSD })
public class TokyoBigMapTest {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import java.nio.file.Paths;
import java.util.Set;

@DisabledOnOs(OS.WINDOWS)
@DisabledOnOs({ OS.WINDOWS, OS.FREEBSD, OS.OPENBSD })
public class TokyoBigSetTest {

@Test
Expand Down
Binary file modified blaze.jar
Binary file not shown.
12 changes: 9 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<parent>
<groupId>com.fizzed</groupId>
<artifactId>maven-parent</artifactId>
<version>2.5.0</version>
<version>2.6.0</version>
</parent>

<properties>
Expand Down Expand Up @@ -126,7 +126,13 @@
</dependency>

<!-- testing -->


<dependency>
<groupId>com.fizzed</groupId>
<artifactId>jne</artifactId>
<version>4.3.0</version>
</dependency>

<dependency>
<groupId>com.fizzed</groupId>
<artifactId>crux-util</artifactId>
Expand All @@ -148,7 +154,7 @@
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.8.1</version>
<version>5.10.3</version>
</dependency>

<dependency>
Expand Down

0 comments on commit 9982663

Please sign in to comment.