Skip to content

Commit

Permalink
Adding Github pipelines
Browse files Browse the repository at this point in the history
  • Loading branch information
hermeswaldemarin committed Nov 6, 2023
1 parent b7fe53c commit b61da07
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 15 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Java-SDK
on:
workflow_dispatch:
push:
pull_request:

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Setup Java 17
uses: actions/setup-java@v3
with:
distribution: "adopt"
java-version: "8"
cache: "gradle"

- name: Build Previewer
run: |
./gradlew clean build
25 changes: 25 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Publish Java-SDK

on:
push:
branches:
- "main"
tags:
- v*
jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Setup Java 17
uses: actions/setup-java@v3
with:
distribution: "adopt"
java-version: "8"
cache: "gradle"

- name: Build Previewer
run: |
./gradlew clean build
5 changes: 5 additions & 0 deletions core-api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ description = """ABSmartly Java SDK"""

def httpClientVersion = "5.1.3"

def lombokVersion = "1.18.26"

dependencies {
implementation group: "org.slf4j", name: "slf4j-api", version: slf4jVersion

Expand All @@ -22,6 +24,9 @@ dependencies {
implementation group: "com.fasterxml.jackson.core", name: "jackson-databind", version: jacksonVersion
implementation group: "com.fasterxml.jackson.datatype", name: "jackson-datatype-jsr310", version: jacksonDataTypeVersion

compileOnly group: "org.projectlombok", name: "lombok", version: lombokVersion
annotationProcessor group: "org.projectlombok", name: "lombok", version: lombokVersion

testImplementation group: "org.junit.jupiter", name: "junit-jupiter-api", version: junitVersion
testImplementation group: "org.junit.jupiter", name: "junit-jupiter-params", version: junitVersion
testRuntimeOnly group: "org.junit.jupiter", name: "junit-jupiter-engine", version: junitVersion
Expand Down
24 changes: 12 additions & 12 deletions core-api/src/main/java/com/absmartly/sdk/Context.java
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ public String[] getCustomFieldKeys() {
for (final Experiment experiment : data_.experiments) {
if (experiment.customFieldValues != null) {
for (final CustomFieldValue customFieldValue : experiment.customFieldValues) {
keys.add(customFieldValue.name);
keys.add(customFieldValue.getName());
}
}
}
Expand Down Expand Up @@ -997,18 +997,18 @@ public int compare(ContextExperiment a, ContextExperiment b) {
if (experiment.customFieldValues != null) {
for (final CustomFieldValue customFieldValue : experiment.customFieldValues) {
final ContextCustomFieldValue value = new ContextCustomFieldValue();
contextExperiment.customFieldValues.put(customFieldValue.name, value);

value.type = customFieldValue.type;
if (customFieldValue.value != null) {
if (customFieldValue.type.startsWith("json")) {
value.value = variableParser_.parse(this, experiment.name, customFieldValue.value);
} else if (customFieldValue.type.equals("boolean")) {
value.value = Boolean.parseBoolean(customFieldValue.value);
} else if (customFieldValue.type.equals("number")) {
value.value = Double.parseDouble(customFieldValue.value);
contextExperiment.customFieldValues.put(customFieldValue.getName(), value);

value.type = customFieldValue.getType();
if (customFieldValue.getValue() != null) {
if (customFieldValue.getType().startsWith("json")) {
value.value = variableParser_.parse(this, experiment.name, customFieldValue.getValue());
} else if (customFieldValue.getType().equals("boolean")) {
value.value = Boolean.parseBoolean(customFieldValue.getValue());
} else if (customFieldValue.getType().equals("number")) {
value.value = Double.parseDouble(customFieldValue.getValue());
} else {
value.value = customFieldValue.value;
value.value = customFieldValue.getValue();
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
package com.absmartly.sdk.json;

import lombok.Getter;
import lombok.Setter;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;

@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
@Getter
@Setter
public class CustomFieldValue {
public String name;
public String type;
public String value;
private String name;
private String type;
private String value;

public CustomFieldValue() {}

Expand Down

0 comments on commit b61da07

Please sign in to comment.