Skip to content

Commit

Permalink
PLT-191: CI action
Browse files Browse the repository at this point in the history
  • Loading branch information
n5nk committed Nov 24, 2023
1 parent d19ef5d commit fbb3141
Show file tree
Hide file tree
Showing 35 changed files with 1,935 additions and 72 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#apache-maven-with-a-settings-path

name: Java CI with Maven

on:
push:
branches:
- v0.6-cache

env:
ES_JAVA_OPTS: "-Xms256m -Xmx512m"
BUILD_MAVEN_OPTS: "-DskipTests=true --batch-mode --also-make"

jobs:
build:

runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- uses: actions/checkout@v2

- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8

- name: Cache Maven packages
uses: actions/cache@v2
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2

- name: Get branch name
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: get_branch

- name: Build with Maven
- run: |
branch_name=${{ steps.get_branch.outputs.branch }}
if [[ $branch_name == ' v0.6-cache' ]]
then
echo "Building branch ${branch_name}"
mvn clean install -Dcheckstyle.skip -Drat.skip=true -Dit.skip=true -Denforcer.skip=true -Dmaven.javadoc.skip=true ${{ env.BUILD_MAVEN_OPTS }}
- name: Publish to GitHub Packages Apache Maven
run: mvn --batch-mode deploy
env:
GITHUB_TOKEN: ${{ secrets.my_pat }}
2 changes: 1 addition & 1 deletion janusgraph-all/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>org.janusgraph</groupId>
<artifactId>janusgraph</artifactId>
<version>0.6.0</version>
<version>0.6.6</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>janusgraph-all</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion janusgraph-backend-testutils/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.janusgraph</groupId>
<artifactId>janusgraph</artifactId>
<version>0.6.0</version>
<version>0.6.6</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>janusgraph-backend-testutils</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion janusgraph-berkeleyje/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>org.janusgraph</groupId>
<artifactId>janusgraph</artifactId>
<version>0.6.0</version>
<version>0.6.6</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>janusgraph-berkeleyje</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion janusgraph-bigtable/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>org.janusgraph</groupId>
<artifactId>janusgraph</artifactId>
<version>0.6.0</version>
<version>0.6.6</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>janusgraph-bigtable</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion janusgraph-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>org.janusgraph</groupId>
<artifactId>janusgraph</artifactId>
<version>0.6.0</version>
<version>0.6.6</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>janusgraph-core</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,18 @@
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.redisson.config.ReadMode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Arrays;
import java.util.Objects;

import static org.janusgraph.graphdb.configuration.GraphDatabaseConfiguration.*;

public class RedissonCache {

private static RedissonClient client;
private static final Logger log = LoggerFactory.getLogger(RedissonCache.class);
private static final String REDIS_URL_PREFIX = "redis://";
private static final String COMMA = ",";
private static final String JANUSGRAPH_REDIS = "janusgraph-redis";
Expand All @@ -25,41 +30,47 @@ public class RedissonCache {
private static long watchdogTimeoutInMS;

public static RedissonClient getRedissonClient(Configuration configuration) {
redisServerMode = configuration.get(REDIS_CACHE_SERVER_MODE);
connectTimeout = configuration.get(REDIS_CACHE_CONNECTION_TIME_OUT);
keepAlive = configuration.get(REDIS_CACHE_KEEP_ALIVE);
watchdogTimeoutInMS = configuration.get(REDIS_CACHE_LOCK_WATCHDOG_TIMEOUT_MS);

Config config = new Config();
switch (redisServerMode) {
case SENTINEL:
config.setLockWatchdogTimeout(watchdogTimeoutInMS)
.useSentinelServers()
.setClientName(JANUSGRAPH_REDIS)
.setReadMode(ReadMode.MASTER_SLAVE)
.setCheckSentinelsList(false)
.setConnectTimeout(connectTimeout)
.setKeepAlive(keepAlive)
.setMasterName(configuration.get(REDIS_CACHE_MASTER_NAME))
.addSentinelAddress(formatUrls(configuration.get(REDIS_CACHE_SENTINEL_URLS).split(COMMA)))
.setUsername(configuration.get(REDIS_CACHE_USERNAME))
.setPassword(configuration.get(REDIS_CACHE_PASSWORD));
break;
case STANDALONE:
config.setLockWatchdogTimeout(watchdogTimeoutInMS)
.useSingleServer()
.setClientName(JANUSGRAPH_REDIS)
.setAddress(formatUrls(configuration.get(REDIS_CACHE_SERVER_URL).split(COMMA))[0])
.setConnectTimeout(connectTimeout)
.setKeepAlive(keepAlive)
.setUsername(configuration.get(REDIS_CACHE_USERNAME))
.setPassword(configuration.get(REDIS_CACHE_PASSWORD));
break;
default:
throw new JanusGraphConfigurationException("Invalid redis server mode");
synchronized (RedissonClient.class) {
if (Objects.isNull(client)) {
redisServerMode = configuration.get(REDIS_CACHE_SERVER_MODE);
connectTimeout = configuration.get(REDIS_CACHE_CONNECTION_TIME_OUT);
keepAlive = configuration.get(REDIS_CACHE_KEEP_ALIVE);
watchdogTimeoutInMS = configuration.get(REDIS_CACHE_LOCK_WATCHDOG_TIMEOUT_MS);
log.info("Creating connection for redis:{}", redisServerMode);
System.out.println("Creating connection for redis:"+redisServerMode);
Config config = new Config();
switch (redisServerMode) {
case SENTINEL:
config.setLockWatchdogTimeout(watchdogTimeoutInMS)
.useSentinelServers()
.setClientName(JANUSGRAPH_REDIS)
.setReadMode(ReadMode.MASTER_SLAVE)
.setCheckSentinelsList(false)
.setConnectTimeout(connectTimeout)
.setKeepAlive(keepAlive)
.setMasterName(configuration.get(REDIS_CACHE_MASTER_NAME))
.addSentinelAddress(formatUrls(configuration.get(REDIS_CACHE_SENTINEL_URLS).split(COMMA)))
.setUsername(configuration.get(REDIS_CACHE_USERNAME))
.setPassword(configuration.get(REDIS_CACHE_PASSWORD));
break;
case STANDALONE:
config.setLockWatchdogTimeout(watchdogTimeoutInMS)
.useSingleServer()
.setClientName(JANUSGRAPH_REDIS)
.setAddress(formatUrls(configuration.get(REDIS_CACHE_SERVER_URL).split(COMMA))[0])
.setConnectTimeout(connectTimeout)
.setKeepAlive(keepAlive)
.setUsername(configuration.get(REDIS_CACHE_USERNAME))
.setPassword(configuration.get(REDIS_CACHE_PASSWORD));
break;
default:
throw new JanusGraphConfigurationException("Invalid redis server mode");
}
client = Redisson.create(config);
}
}

return Redisson.create(config);
return client;
}

private static String[] formatUrls(String[] urls) throws IllegalArgumentException {
Expand Down
15 changes: 1 addition & 14 deletions janusgraph-cql/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.janusgraph</groupId>
<artifactId>janusgraph</artifactId>
<version>0.6.0</version>
<version>0.6.6</version>
</parent>

<artifactId>janusgraph-cql</artifactId>
Expand Down Expand Up @@ -126,19 +126,6 @@
<artifactId>java-driver-core</artifactId>
<version>${cassandra-driver.version}</version>
<exclusions>

<exclusion>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-core</artifactId>
</exclusion>
<exclusion>
<groupId>org.reactivestreams</groupId>
<artifactId>reactive-streams</artifactId>
</exclusion>
<exclusion>
<groupId>io.reactivex.rxjava3</groupId>
<artifactId>rxjava</artifactId>
</exclusion>
<exclusion>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion janusgraph-dist/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>org.janusgraph</groupId>
<artifactId>janusgraph</artifactId>
<version>0.6.0</version>
<version>0.6.6</version>
<relativePath>../pom.xml</relativePath>
</parent>
<packaging>pom</packaging>
Expand Down
2 changes: 1 addition & 1 deletion janusgraph-doc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>org.janusgraph</groupId>
<artifactId>janusgraph</artifactId>
<version>0.6.0</version>
<version>0.6.6</version>
<relativePath>../pom.xml</relativePath>
</parent>
<packaging>pom</packaging>
Expand Down
2 changes: 1 addition & 1 deletion janusgraph-driver/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>org.janusgraph</groupId>
<artifactId>janusgraph</artifactId>
<version>0.6.0</version>
<version>0.6.6</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>janusgraph-driver</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion janusgraph-es/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>org.janusgraph</groupId>
<artifactId>janusgraph</artifactId>
<version>0.6.0</version>
<version>0.6.6</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>janusgraph-es</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion janusgraph-examples/example-berkeleyje/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>org.janusgraph</groupId>
<artifactId>janusgraph-examples</artifactId>
<version>0.6.0</version>
<version>0.6.6</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>example-berkeleyje</artifactId>
Expand Down
41 changes: 41 additions & 0 deletions janusgraph-examples/example-berkeleyje/pom.xml.versionsBackup
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<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>
<parent>
<groupId>org.janusgraph</groupId>
<artifactId>janusgraph-examples</artifactId>
<version>0.6.0</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>example-berkeleyje</artifactId>
<packaging>pom</packaging>
<name>Example-BerkeleyJE: BerkeleyJE Storage, Lucene Index</name>
<url>https://janusgraph.org</url>

<dependencies>
<!-- These are all runtime dependencies -->
<dependency>
<groupId>org.janusgraph</groupId>
<artifactId>example-common</artifactId>
<version>${project.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.janusgraph</groupId>
<artifactId>janusgraph-berkeleyje</artifactId>
<version>${project.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.janusgraph</groupId>
<artifactId>janusgraph-lucene</artifactId>
<version>${project.version}</version>
<scope>runtime</scope>
</dependency>
</dependencies>

<properties>
<example.main.class>org.janusgraph.example.JanusGraphApp</example.main.class>
<example.config>${project.basedir}/conf/jgex-berkeleyje.properties</example.config>
</properties>

</project>
2 changes: 1 addition & 1 deletion janusgraph-examples/example-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>org.janusgraph</groupId>
<artifactId>janusgraph-examples</artifactId>
<version>0.6.0</version>
<version>0.6.6</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>example-common</artifactId>
Expand Down
26 changes: 26 additions & 0 deletions janusgraph-examples/example-common/pom.xml.versionsBackup
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<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>
<parent>
<groupId>org.janusgraph</groupId>
<artifactId>janusgraph-examples</artifactId>
<version>0.6.0</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>example-common</artifactId>
<name>Example-Common: Common Graph Code for Examples</name>
<url>https://janusgraph.org</url>

<dependencies>
<dependency>
<groupId>org.janusgraph</groupId>
<artifactId>janusgraph-core</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>

<properties>
<example.main.class>org.janusgraph.example.JanusGraphApp</example.main.class>
<example.config>${project.basedir}/conf/jgex-inmemory.properties</example.config>
</properties>

</project>
2 changes: 1 addition & 1 deletion janusgraph-examples/example-cql/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>org.janusgraph</groupId>
<artifactId>janusgraph-examples</artifactId>
<version>0.6.0</version>
<version>0.6.6</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>example-cql</artifactId>
Expand Down
Loading

0 comments on commit fbb3141

Please sign in to comment.