Skip to content
This repository was archived by the owner on Aug 2, 2022. It is now read-only.
Closed
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
13 changes: 11 additions & 2 deletions .github/workflows/test-and-build-workflow.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
name: Test and Build Workflow
# This workflow is triggered on pull requests to master or a opendistro release branch
# This workflow is triggered on pull requests and pushes to master or an opendistro release branch
on:
pull_request:
branches:
- master
- opendistro-*

push:
branches:
- master
- opendistro-*
jobs:
build:
strategy:
Expand All @@ -26,12 +29,18 @@ jobs:
java-version: ${{ matrix.java }}
- name: Build with Gradle
run: ./gradlew build
# This step uses the codecov-action Github action: https://github.com/codecov/codecov-action
- name: Uploads coverage
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: Upload Artifacts Plugin
uses: actions/upload-artifact@v1
if: always()
with:
name: job-scheduler-plugin
path: ./build
# This step uses the upload-artifact Github action: https://github.com/actions/upload-artifact
- name: Upload Artifacts Sample Plugin
uses: actions/upload-artifact@v1
if: always()
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
[![Test Workflow](https://github.com/opendistro-for-elasticsearch/job-scheduler/workflows/Test%20and%20Build%20Workflow/badge.svg)](https://github.com/opendistro-for-elasticsearch/job-scheduler/actions)
[![codecov](https://codecov.io/gh/opendistro-for-elasticsearch/job-scheduler/branch/master/graph/badge.svg)](https://codecov.io/gh/opendistro-for-elasticsearch/job-scheduler)
![PRs welcome!](https://img.shields.io/badge/PRs-welcome!-success)


# Open Distro for Elasticsearch Job Scheduler

Open Distro for Elasticsearch JobScheduler plugin provides a framework for Elasticsearch plugin
Expand Down
67 changes: 67 additions & 0 deletions build-tools/merged-coverage.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/*
* Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/

allprojects {
plugins.withId('jacoco') {
jacoco.toolVersion = '0.8.5'
// For some reason this dependency isn't getting setup automatically by the jacoco plugin
tasks.withType(JacocoReport) {
dependsOn tasks.withType(Test)
}
}
}

task jacocoMerge(type: JacocoMerge) {
description = 'Gathers code coverage for all projects by merging the execution data files'

gradle.projectsEvaluated {
// collect code coverage of the sub-projects
subprojects.each {
jacocoMerge.dependsOn it.tasks.withType(JacocoReport)
jacocoMerge.executionData it.tasks.withType(JacocoReport).collect { it.executionData }
}
// collect code coverage of the root project
// analyze coverage for the root project before merging
jacocoMerge.dependsOn jacocoTestReport
// add the execution data file of the root project to be used during coverage analysis.
executionData jacocoTestReport.executionData
}
doFirst {
executionData = files(executionData.findAll { it.exists() })
}
}

task jacocoReport(type: JacocoReport, group: 'verification') {
description = 'Generates an aggregate report from all projects'
dependsOn jacocoMerge
executionData jacocoMerge.destinationFile

reports {
html.enabled = true // human readable
xml.enabled = true
}

gradle.projectsEvaluated {
// coverage data is being reported for all source dirs
getSourceDirectories().from(files(allprojects.sourceSets.main.allSource.srcDirs))
// coverage data is being reported for all class dirs except the classes for "sample-extension-plugin"
getClassDirectories().from(files(allprojects.sourceSets.main.output))
getClassDirectories().setFrom(files(classDirectories.files.collect {
fileTree(dir: it, exclude: '**/sampleextension/**')
}))
}
}

check.dependsOn jacocoReport
2 changes: 2 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ buildscript {
plugins {
id 'nebula.ospackage' version "8.3.0"
id 'java-library'
id 'jacoco'
}

ext {
Expand All @@ -40,6 +41,7 @@ ext {
apply plugin: 'elasticsearch.esplugin'
apply plugin: 'elasticsearch.testclusters'
apply plugin: 'elasticsearch.java-rest-test'
apply from: 'build-tools/merged-coverage.gradle'

ext {
projectSubstitutions = [:]
Expand Down
16 changes: 0 additions & 16 deletions spi/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import org.elasticsearch.gradle.test.RestIntegTestTask
plugins {
id 'com.github.johnrengelman.shadow'
id 'jacoco'
id 'maven'
id 'maven-publish'
id 'signing'
}
Expand All @@ -33,20 +32,6 @@ ext {
noticeFile = rootProject.file('NOTICE')
}

jacoco {
toolVersion = '0.8.5'
reportsDir = file("$buildDir/JacocoReport")
}

jacocoTestReport {
reports {
xml.enabled false
csv.enabled false
html.destination file("${buildDir}/jacoco/")
}
}
check.dependsOn jacocoTestReport

dependencies {
compileOnly "org.elasticsearch:elasticsearch:${es_version}"
compile "com.cronutils:cron-utils:9.1.3"
Expand Down Expand Up @@ -150,4 +135,3 @@ signing {
required { gradle.taskGraph.hasTask("publishShadowPublicationToSonatype-stagingRepository") }
sign publishing.publications.shadow
}