Skip to content
Merged
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
39 changes: 39 additions & 0 deletions .github/workflows/jacoco-badge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Update JaCoCo Badge

on:
push:
branches: [ "main" ]

jobs:
badge:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: maven

- name: Test with JUnit
run: mvn -B test

- name: Generate JaCoCo Badge
id: jacoco
uses: cicirello/jacoco-badge-generator@v2
with:
generate-branches-badge: true
jacoco-csv-file: >
meteor-jedis/target/site/jacoco/jacoco.csv
meteor-core/target/site/jacoco/jacoco.csv

- name: Log coverage percentage
run: |
echo "coverage = ${{ steps.jacoco.outputs.coverage }}"
echo "branch coverage = ${{ steps.jacoco.outputs.branches }}"

- uses: EndBug/add-and-commit@v9
with:
default_author: github_actions
message: "Update JaCoCo badge"
43 changes: 4 additions & 39 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
@@ -1,54 +1,19 @@
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: Java CI with Maven

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.ref }}
- name: Set up JDK 20
uses: actions/setup-java@v3
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: '17.0.8+7'
java-version: '21'
distribution: 'temurin'
cache: maven

# run tests with junit
- name: Test with JUnit
run: mvn -B test --file pom.xml

- name: Generate JaCoCo Badge
id: jacoco
uses: cicirello/jacoco-badge-generator@v2
with:
generate-branches-badge: true
jacoco-csv-file: >
meteor-jedis/target/site/jacoco/jacoco.csv
meteor-core/target/site/jacoco/jacoco.csv

- name: Log coverage percentage
run: |
echo "coverage = ${{ steps.jacoco.outputs.coverage }}"
echo "branch coverage = ${{ steps.jacoco.outputs.branches }}"

- uses: EndBug/add-and-commit@v9 # You can change this to use a specific version.
with:
default_author: github_actions
message: "Add JaCoCo badge"
run: mvn -B test
56 changes: 43 additions & 13 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,56 @@
name: Publish package to the Maven Central Repository
name: Release to Maven Central

on:
release:
types: [created,edited]
push:
tags:
- '[0-9]*.[0-9]*.[0-9]*'

jobs:
create-release:
runs-on: ubuntu-latest
permissions:
contents: write
outputs:
tag: ${{ steps.tag.outputs.tag }}
steps:
- uses: actions/checkout@v4
- id: tag
run: echo "tag=${GITHUB_REF_NAME}" >> "$GITHUB_OUTPUT"
- uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref_name }}
name: Release ${{ github.ref_name }}
generate_release_notes: true

publish:
needs: create-release
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- name: Set up Maven Central Repository
uses: actions/setup-java@v3
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: '17.0.8+7'
java-version: '21'
distribution: 'temurin'
server-id: ossrh
server-id: central
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- name: Publish package
run: mvn -Drevision=${{ github.event.release.tag_name }} --batch-mode deploy -P release
- run: mvn -Drevision=${{ needs.create-release.outputs.tag }} --batch-mode deploy -P release
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
MAVEN_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
- uses: actions/checkout@v4
with:
ref: main
- name: Update README version
run: |
TAG=${{ needs.create-release.outputs.tag }}
sed -i "s|<version>[^<]*</version>|<version>${TAG}</version>|" README.md
- uses: EndBug/add-and-commit@v9
with:
default_author: github_actions
message: "chore: update README version to ${{ needs.create-release.outputs.tag }}"
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,9 @@ target/
### Mac OS ###
.DS_Store
**/.flattened-pom.xml
**/dependency-reduced-pom.xml
**/dependency-reduced-pom.xml

.settings/
**/.project
**/.factorypath
**/.classpath
15 changes: 5 additions & 10 deletions benchmarks/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,24 @@
<artifactId>benchmarks</artifactId>

<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

<jmh.version>1.37</jmh.version>
</properties>

<dependencies>
<dependency>
<groupId>dev.pixelib.meteor</groupId>
<artifactId>meteor-core</artifactId>
<version>${revision}</version>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>dev.pixelib.meteor</groupId>
<artifactId>meteor-common</artifactId>
<version>${revision}</version>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>dev.pixelib.meteor.transport</groupId>
<groupId>dev.pixelib.meteor</groupId>
<artifactId>meteor-jedis</artifactId>
<version>${revision}</version>
<version>${project.version}</version>
</dependency>

<dependency>
Expand All @@ -58,8 +54,6 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>17</source>
<target>17</target>
<annotationProcessorPaths>
<path>
<groupId>org.openjdk.jmh</groupId>
Expand All @@ -73,6 +67,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.6.0</version>
<executions>
<execution>
<phase>package</phase>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ public class ScoresWithMaps {

@Setup
public void setup() {
System.out.println("workerThreads: " + workerThreads);
RpcOptions rpcOptions = new RpcOptions();
rpcOptions.setExecutorThreads(workerThreads);
meteor = new Meteor(new LoopbackTransport(), rpcOptions);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ public class SimpleIncrement {

@Setup
public void setup() {
System.out.println("workerThreads: " + workerThreads);
RpcOptions rpcOptions = new RpcOptions();
rpcOptions.setExecutorThreads(workerThreads);
meteor = new Meteor(new LoopbackTransport(), rpcOptions);
Expand Down
8 changes: 1 addition & 7 deletions examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,14 @@

<artifactId>examples</artifactId>

<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
<dependency>
<groupId>dev.pixelib.meteor</groupId>
<artifactId>meteor-core</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>dev.pixelib.meteor.transport</groupId>
<groupId>dev.pixelib.meteor</groupId>
<artifactId>meteor-jedis</artifactId>
<version>${revision}</version>
</dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@

import dev.pixelib.meteor.base.defaults.LoopbackTransport;
import dev.pixelib.meteor.core.Meteor;
import lombok.extern.java.Log;

import java.util.HashMap;
import java.util.Map;
import java.util.logging.Level;

@Log
public class ScoreboardExample {

public static void main(String[] args) throws Exception{
Expand All @@ -19,10 +22,10 @@ public static void main(String[] args) throws Exception{
scoreboard.setScoreForPlayer("player3", 30);

Map<String, Integer> scores = scoreboard.getAllScores();
System.out.println("scores: " + scores);
log.log(Level.INFO, "scores: {0}", scores);

int player1Score = scoreboard.getScoreForPlayer("player1");
System.out.println("player1 score: " + player1Score);
log.log(Level.INFO, "player1 score: {0}", player1Score);

meteor.stop();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

import dev.pixelib.meteor.base.defaults.LoopbackTransport;
import dev.pixelib.meteor.core.Meteor;
import lombok.extern.java.Log;

import java.util.logging.Level;

@Log
public class SendingUpdateMethod {

public static void main(String[] args) throws Exception{
Expand All @@ -17,13 +21,13 @@ public static void main(String[] args) throws Exception{
meteor.registerImplementation(new MathFunctionsImpl());

int subResult = mathSubstract.substract(10, 1, 2, 3, 4, 5);
System.out.println("10 - 1 - 2 - 3 - 4 - 5 = " + subResult);
log.log(Level.INFO, "10 - 1 - 2 - 3 - 4 - 5 = {0}", subResult);

int addResult = mathAdd.add(1, 2, 3, 4, 5);
System.out.println("1 + 2 + 3 + 4 + 5 = " + addResult);
log.log(Level.INFO, "1 + 2 + 3 + 4 + 5 = {0}", addResult);

int multiResult = mathMultiply.multiply(5, 5);
System.out.println("5 * 5 = " + multiResult);
log.log(Level.INFO, "5 * 5 = {0}", multiResult);

meteor.stop();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@

import dev.pixelib.meteor.core.Meteor;
import dev.pixelib.meteor.transport.redis.RedisTransport;
import lombok.extern.java.Log;

import java.util.logging.Level;

@Log
public class SendingUpdateMethodRedis {

public static void main(String[] args) throws Exception{
Meteor meteor = new Meteor(new RedisTransport("192.168.178.46", 6379, "test"));
Meteor meteor = new Meteor(new RedisTransport("localhost", 6379, "test"));

MathAdd mathAdd = meteor.registerProcedure(MathAdd.class);
MathSubstract mathSubstract = meteor.registerProcedure(MathSubstract.class);
Expand All @@ -18,13 +22,13 @@ public static void main(String[] args) throws Exception{


int subResult = mathSubstract.substract(10, 1, 2, 3, 4, 5);
System.out.println("10 - 1 - 2 - 3 - 4 - 5 = " + subResult);
log.log(Level.INFO, "10 - 1 - 2 - 3 - 4 - 5 = {0}", subResult);

int addResult = mathAdd.add(1, 2, 3, 4, 5);
System.out.println("1 + 2 + 3 + 4 + 5 = " + addResult);
log.log(Level.INFO, "1 + 2 + 3 + 4 + 5 = {0}", addResult);

int multiResult = mathMultiply.multiply(5, 5);
System.out.println("5 * 5 = " + multiResult);
log.log(Level.INFO, "5 * 5 = {0}", multiResult);

meteor.stop();
}
Expand Down
4 changes: 0 additions & 4 deletions meteor-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
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>dev.pixelib.meteor</groupId>
<artifactId>meteor-parent</artifactId>
Expand All @@ -14,9 +13,6 @@

<artifactId>meteor-common</artifactId>

<properties>
</properties>

<dependencies>
<dependency>
<groupId>com.google.code.gson</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class GsonSerializer implements RpcSerializer {
* the Gson instance to use for serialization/deserialization
* this is a static field so that it is shared between all instances of this class and can be swapped out at runtime
*/
public static Gson GSON = new Gson();
public static final Gson GSON = new Gson();

/**
* @param obj the object to serialize
Expand Down
Loading
Loading