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
4 changes: 2 additions & 2 deletions .github/workflows/build.yml → .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build
name: compile-and-test

on:
pull_request:
Expand All @@ -13,7 +13,7 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17
java-version: 21
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Build with Gradle
Expand Down
59 changes: 59 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: publish

on:
push:
tags: ['v*']
release:
types: [published]

jobs:
build-artifact:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Tag Version Name Extraction
id: version
shell: bash
run: |
if [[ -n "${{ github.event.release.tag_name }}" ]]; then
# Relase Github
TAG_NAME="${{ github.event.release.tag_name }}"
echo "📋 Triggered by GitHub release: $TAG_NAME"
else
# Just a new tag
TAG_NAME=${GITHUB_REF#refs/tags/}
echo "🏷️ Triggered by Git tag: $TAG_NAME"
fi

# Get rid of the 'v', e.g. v8.18.1.0 -> 8.18.1.0
VERSION=${TAG_NAME#v}
echo "version=$VERSION" >> $GITHUB_OUTPUT

- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 21

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4

- name: Java Compilation
run: ./gradlew -Pplugin_version=${{ steps.version.outputs.version }} clean assemble --no-daemon

- name: Upload Plugin Artifact
uses: actions/upload-artifact@v4
with:
name: pathhierarchy-aggregation-${{ steps.version.outputs.version }}
path: build/distributions/*.zip

- name: Attach ZIP to GitHub Release
uses: softprops/action-gh-release@v2
if: github.event.release.tag_name != ''
with:
files: build/distributions/pathhierarchy-aggregation-${{ steps.version.outputs.version }}.zip
tag_name: ${{ github.event.release.tag_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
682 changes: 661 additions & 21 deletions LICENSE

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -327,4 +327,4 @@ GET /calendar/_search?size=0
License
-------

This software is under The MIT License (MIT).
This software is under AGPL (GNU Affero General Public License)
52 changes: 43 additions & 9 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
/*
Gradle build file for development building, testing, and packaging.
*/

buildscript {
repositories {
mavenLocal()
mavenCentral()
}

Expand All @@ -9,6 +12,11 @@ buildscript {
}
}

// the spotless plugin is dedicated to format the code
plugins {
id("com.diffplug.spotless") version "7.0.4"
}

repositories {
mavenLocal()
mavenCentral()
Expand All @@ -17,14 +25,11 @@ repositories {
group = 'org.elasticsearch.plugin'
version = "${plugin_version}"

def versions = org.elasticsearch.gradle.VersionProperties.versions

apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'elasticsearch.esplugin'
apply plugin: 'elasticsearch.yaml-rest-test'


esplugin {
name 'pathhierarchy-aggregation'
description 'Return a path hierarchy aggregation'
Expand All @@ -33,17 +38,46 @@ esplugin {
noticeFile = rootProject.file('README.md')
}


def versions = org.elasticsearch.gradle.VersionProperties.versions
dependencies {
implementation "org.elasticsearch:elasticsearch:${es_version}"
yamlRestTestImplementation "org.elasticsearch.test:framework:${es_version}"
yamlRestTestImplementation "org.elasticsearch.test:yaml-rest-runner:${es_version}"
yamlRestTestImplementation "org.apache.logging.log4j:log4j-core:${versions.log4j}"
}

tasks.named("yamlRestTest").configure {
systemProperty 'tests.security.manager', 'false'
// add -Xlint:deprecation to check the Elasticsearch deprecation warning at compile-time
allprojects {
gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:deprecation"
options.compilerArgs << "-Xlint:unchecked"
}
}
}

// automatic formatting configuration (the same configuration as elasticsearch)
spotless {
java {
importOrderFile('config/elastic.importorder') // import order file as exported from elastic
eclipse().configFile('config/formatterConfig.xml')
trimTrailingWhitespace()
target 'src/**/*.java'
}
}

tasks.named("test").configure {
systemProperty 'tests.security.manager', 'false'
check.dependsOn spotlessCheck

testClusters.configureEach {
// Make sure the ES distribution used for rest tests is the "complete" variant
testDistribution = 'DEFAULT'

// Disable security (avoids annoying warnings/failures with xpack features)
setting 'xpack.security.enabled', 'false'

// Logging levels for debugging: logs are located in build/testclusters/runTask-0/logs/
setting 'logger._root', 'DEBUG'
setting 'logger.org.elasticsearch.plugins', 'DEBUG'
setting 'logger.org.elasticsearch.cluster', 'DEBUG'
setting 'logger.org.elasticsearch.cluster.metadata', 'TRACE'
}
7 changes: 7 additions & 0 deletions config/elastic.importorder
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#Eclipse configuration for import order for Elasticsearch
0=
1=com
2=org
3=java
4=javax
5=\#
Loading