Skip to content

Commit

Permalink
Merge pull request #92 from RADAR-base/release-0.15.0
Browse files Browse the repository at this point in the history
Release 0.15.0
  • Loading branch information
blootsvoets authored May 9, 2022
2 parents b003222 + e5f3355 commit 1a6548c
Show file tree
Hide file tree
Showing 34 changed files with 594 additions and 300 deletions.
18 changes: 5 additions & 13 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,15 @@ jobs:
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- uses: actions/setup-java@v1
- uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 11

- name: Cache
uses: actions/cache@v2
with:
# Cache gradle directories
path: |
~/.gradle/caches
~/.gradle/wrapper
# Key for restoring and saving the cache
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle', 'gradle.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Setup Gradle
uses: gradle/gradle-build-action@v2

# Compile the code
- name: Compile code
Expand Down
18 changes: 5 additions & 13 deletions .github/workflows/publish_snapshots.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,19 @@ jobs:
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Has SNAPSHOT version
id: is-snapshot
run: grep "version = '.*-SNAPSHOT'" build.gradle

- uses: actions/setup-java@v1
- uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 11

- name: Cache
uses: actions/cache@v2
with:
# Cache gradle directories
path: |
~/.gradle/caches
~/.gradle/wrapper
# Key for restoring and saving the cache
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle', 'gradle.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Setup Gradle
uses: gradle/gradle-build-action@v2

- name: Install gpg secret key
run: |
Expand Down
19 changes: 6 additions & 13 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,15 @@ jobs:
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
- uses: actions/checkout@v3

- uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 11

- name: Cache
uses: actions/cache@v2
with:
# Cache gradle directories
path: |
~/.gradle/caches
~/.gradle/wrapper
# Key for restoring and saving the cache
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle', 'gradle.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Setup Gradle
uses: gradle/gradle-build-action@v2

# Compile code
- name: Compile code
Expand Down
24 changes: 18 additions & 6 deletions .github/workflows/scheduled_snyk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,26 @@ jobs:
env:
REPORT_FILE: test.json
steps:
- uses: actions/checkout@master
- name: Run Snyk to check for vulnerabilities
uses: snyk/actions/gradle-jdk11@master
- uses: actions/checkout@v3
- uses: snyk/actions/setup@master

- uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 11

- name: Setup Gradle
uses: gradle/gradle-build-action@v2

- name: Run Snyk
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
command: test
args: --json-file-output=${{ env.REPORT_FILE }}
run: >
snyk test
--all-sub-projects
--configuration-matching='^runtimeClasspath$'
--json-file-output=${{ env.REPORT_FILE }}
--org=radar-base
- name: Report new vulnerabilities
uses: thehyve/report-vulnerability@master
with:
Expand Down
28 changes: 21 additions & 7 deletions .github/workflows/snyk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,24 @@ jobs:
security:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Run Snyk to check for vulnerabilities
uses: snyk/actions/gradle-jdk11@master
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
args: --severity-threshold=high
- uses: actions/checkout@v3
- uses: snyk/actions/setup@master

- uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 11

- name: Setup Gradle
uses: gradle/gradle-build-action@v2

- name: Run Snyk to check for vulnerabilities
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
run: >
snyk test
--all-sub-projects
--configuration-matching='^runtimeClasspath$'
--fail-on=upgradable
--org=radar-base
--severity-threshold=high
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ repositories {
}
dependencies {
implementation group: 'org.radarbase', name: 'radar-commons', version: '0.14.0'
implementation group: 'org.radarbase', name: 'radar-commons', version: '0.15.0'
}
```

Expand Down Expand Up @@ -69,7 +69,7 @@ repositories {
}
dependencies {
implementation group: 'org.radarbase', name: 'radar-commons-server', version: '0.14.0'
implementation group: 'org.radarbase', name: 'radar-commons-server', version: '0.15.0'
}
```

Expand All @@ -82,7 +82,7 @@ repositories {
}
dependencies {
testImplementation group: 'org.radarbase', name: 'radar-commons-testing', version: '0.14.0'
testImplementation group: 'org.radarbase', name: 'radar-commons-testing', version: '0.15.0'
}
```

Expand All @@ -107,7 +107,7 @@ configurations.all {
}
dependencies {
compile group: 'org.radarbase', name: 'radar-commons', version: '0.14.1-SNAPSHOT'
implementation group: 'org.radarbase', name: 'radar-commons', version: '0.15.1-SNAPSHOT'
}
```

Expand Down
20 changes: 16 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
plugins {
id 'com.github.davidmc24.gradle.plugin.avro' version '1.3.0'
id("io.github.gradle-nexus.publish-plugin") version "1.1.0"
id("com.github.ben-manes.versions") version "0.39.0"
id("com.github.ben-manes.versions") version "0.42.0"
}

allprojects {
version = '0.14.0'
version = '0.15.0'
group = 'org.radarbase'
}

Expand Down Expand Up @@ -69,7 +69,7 @@ subprojects {
}

onOutput { TestDescriptor td, TestOutputEvent toe ->
stdout.addAll(toe.getMessage().split('(?m)$'))
stdout.addAll(Arrays.asList(toe.getMessage().split('(?m)$')))
while (stdout.size() > 100) {
stdout.remove()
}
Expand Down Expand Up @@ -99,6 +99,18 @@ subprojects {
}
}

def isNonStable = { String version ->
def stableKeyword = ["RELEASE", "FINAL", "GA"].any { version.toUpperCase().contains(it) }
def regex = /^[0-9,.v-]+(-r)?$/
return !stableKeyword && !(version ==~ regex)
}

tasks.named("dependencyUpdates").configure {
rejectVersionIf {
isNonStable(it.candidate.version)
}
}

nexusPublishing {
repositories {
sonatype {
Expand All @@ -109,5 +121,5 @@ nexusPublishing {
}

wrapper {
gradleVersion '7.3.3'
gradleVersion '7.4.2'
}
16 changes: 8 additions & 8 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
slf4jVersion=1.7.32
confluentVersion=7.0.1
kafkaVersion=7.0.1-ce
slf4jVersion=1.7.36
confluentVersion=7.1.1
kafkaVersion=3.1.0
avroVersion=1.11.0
jacksonVersion=2.12.6
jacksonYamlVersion=2.12.6
jacksonVersion=2.13.2.20220328
okhttpVersion=4.9.3
junitVersion=4.13.2
mockitoVersion=4.2.0
mockitoVersion=4.5.1
hamcrestVersion=1.3
radarSchemasVersion=0.7.5
orgJsonVersion=20211205
radarSchemasVersion=0.7.9
orgJsonVersion=20220320
opencsvVersion=5.6
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
6 changes: 3 additions & 3 deletions radar-commons-server/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ dependencies {
api project(':radar-commons')

// For POJO classes and ConfigLoader
implementation group: 'com.fasterxml.jackson.core' , name: 'jackson-databind' , version: jacksonVersion
implementation group: 'com.fasterxml.jackson.dataformat', name: 'jackson-dataformat-yaml', version: jacksonYamlVersion
implementation(platform("com.fasterxml.jackson:jackson-bom:$jacksonVersion"))
implementation group: 'com.fasterxml.jackson.core' , name: 'jackson-databind'
implementation group: 'com.fasterxml.jackson.dataformat', name: 'jackson-dataformat-yaml'

api group: 'org.apache.avro', name: 'avro', version: avroVersion

implementation group: 'com.fasterxml.jackson.core' , name: 'jackson-databind' , version: jacksonVersion
implementation group: 'org.apache.kafka', name: 'kafka-clients', version: kafkaVersion

testImplementation group: 'org.mockito', name: 'mockito-core', version: mockitoVersion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,24 +29,32 @@
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.function.Consumer;

/**
* A YAML Config file loader, to load YAML files into equivalent POJO Objects.
*/
public class YamlConfigLoader {
public static final JsonFactory YAML_FACTORY = new YAMLFactory();
private static final ObjectMapper YAML_MAPPER = new ObjectMapper(YAML_FACTORY);

static {
YAML_MAPPER.setPropertyNamingStrategy(PropertyNamingStrategies.SNAKE_CASE);
private final ObjectMapper yamlMapper = new ObjectMapper(YAML_FACTORY);

public YamlConfigLoader() {
this((mapper) -> { });
}

/** Config loader that does some additional object mapper configuration after initialization. */
public YamlConfigLoader(Consumer<ObjectMapper> mapperConfigurator) {
yamlMapper.setPropertyNamingStrategy(PropertyNamingStrategies.SNAKE_CASE);
// only serialize fields, not getters, etc.
YAML_MAPPER.setVisibility(YAML_MAPPER.getSerializationConfig().getDefaultVisibilityChecker()
yamlMapper.setVisibility(yamlMapper.getSerializationConfig().getDefaultVisibilityChecker()
.withFieldVisibility(JsonAutoDetect.Visibility.ANY)
.withGetterVisibility(JsonAutoDetect.Visibility.NONE)
.withIsGetterVisibility(JsonAutoDetect.Visibility.NONE)
.withSetterVisibility(JsonAutoDetect.Visibility.NONE)
.withCreatorVisibility(JsonAutoDetect.Visibility.NONE));
YAML_MAPPER.addMixIn(ServerConfig.class, ServerConfigMixin.class);
yamlMapper.addMixIn(ServerConfig.class, ServerConfigMixin.class);
mapperConfigurator.accept(yamlMapper);
}

/**
Expand All @@ -59,22 +67,22 @@ public class YamlConfigLoader {
*/
public <T> T load(Path file, Class<T> configClass) throws IOException {
try (Reader reader = Files.newBufferedReader(file, StandardCharsets.UTF_8)) {
return YAML_MAPPER.readValue(reader, configClass);
return yamlMapper.readValue(reader, configClass);
}
}

/** Store config into given YAML file. */
public void store(Path file, Object config) throws IOException {
try (Writer writer = Files.newBufferedWriter(file, StandardCharsets.UTF_8)) {
YAML_MAPPER.writeValue(writer, config);
yamlMapper.writeValue(writer, config);
}
}

/**
* Pretty-print the given object as a YAML string.
*/
public String prettyString(Object config) {
ObjectMapper prettyPrintMapper = YAML_MAPPER.copy();
ObjectMapper prettyPrintMapper = yamlMapper.copy();
// pretty print
prettyPrintMapper.enable(SerializationFeature.INDENT_OUTPUT);
// make ConfigRadar the root element
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import java.util.Collections;
import java.util.List;
import org.apache.avro.Schema;
import org.apache.avro.generic.IndexedRecord;
import org.apache.avro.specific.SpecificRecord;
import org.radarbase.util.SpecificAvroConvertible;

Expand Down Expand Up @@ -52,7 +53,7 @@ public AggregateListCollector(String[] fieldNames, Schema schema, boolean useRes
}

@Override
public AggregateListCollector add(SpecificRecord record) {
public AggregateListCollector add(IndexedRecord record) {
for (NumericAggregateCollector collector : collectors) {
collector.add(record);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.apache.avro.Schema;
import org.apache.avro.Schema.Field;
import org.apache.avro.Schema.Type;
import org.apache.avro.generic.IndexedRecord;
import org.apache.avro.specific.SpecificRecord;
import org.radarbase.util.SpecificAvroConvertible;

Expand Down Expand Up @@ -105,7 +106,7 @@ private static Type getType(Field field) {
}

@Override
public NumericAggregateCollector add(SpecificRecord record) {
public NumericAggregateCollector add(IndexedRecord record) {
if (pos == -1) {
throw new IllegalStateException(
"Cannot add record without specifying a schema in the constructor.");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package org.radarbase.stream.collector;

import org.apache.avro.specific.SpecificRecord;
import org.apache.avro.generic.IndexedRecord;

public interface RecordCollector {
/**
* Add a sample to the collection.
* @param record new sample that has to be analysed
* @throws IllegalStateException if this collector was constructed without a schema.
*/
RecordCollector add(SpecificRecord record);
RecordCollector add(IndexedRecord record);
}
Loading

0 comments on commit 1a6548c

Please sign in to comment.