From 97182d9d20fba96d6e3ced3174c902019b7069d1 Mon Sep 17 00:00:00 2001 From: Mark Cohen Date: Thu, 17 Nov 2022 10:33:20 -0500 Subject: [PATCH 01/10] adding codecov and windows build commands Signed-off-by: Mark Cohen --- .github/.codecov.yml | 7 +++++++ .github/workflows/CI.yml | 32 +++++++++----------------------- 2 files changed, 16 insertions(+), 23 deletions(-) create mode 100644 .github/.codecov.yml diff --git a/.github/.codecov.yml b/.github/.codecov.yml new file mode 100644 index 0000000..a69722d --- /dev/null +++ b/.github/.codecov.yml @@ -0,0 +1,7 @@ +# https://docs.codecov.com/docs/codecov-yaml +coverage: + status: + project: + default: + # https://docs.codecov.com/docs/commit-status#target + target: auto # coverage must be equal or above the previous commit \ No newline at end of file diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 10fc7d7..61bfc57 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -16,7 +16,7 @@ jobs: strategy: matrix: java: [11, 17] - os: [ubuntu-latest, macos-latest] # want to get the build running first; fixing windows build after- windows-latest] + os: [ubuntu-latest, macos-latest, windows-latest] name: Build and Test Search Request Processor Plugin runs-on: ${{ matrix.os }} @@ -30,34 +30,20 @@ jobs: with: java-version: ${{ matrix.java }} - - name: Run build + - name: Run build Windows + if: ${{ matrix.os == 'windows-latest' }} + run: | + ./gradlew.bat build + + - name: Run non-Windows + if: ${{ matrix.os != 'windows-latest' }} run: | ./gradlew build - name: Upload Coverage Report - if: startsWith(matrix.os,'ubuntu') + if: ${{matrix.os}} == 'ubuntu' uses: codecov/codecov-action@v1 with: token: ${{ secrets.CODECOV_TOKEN }} -# Build-search-request-processor-Windows: -# strategy: -# matrix: -# java: [ 11, 17 ] -# -# name: Build and Test Search Request Processor Plugin on Windows -# runs-on: windows-latest - -# steps: -# - name: Checkout Search Request Processor -# uses: actions/checkout@v1 - -# - name: Setup Java ${{ matrix.java }} -# uses: actions/setup-java@v1 -# with: -# java-version: ${{ matrix.java }} -# -# - name: Run build -# run: | -# ./gradlew.bat build From 6f977752e543fc8f1e180e1d6cbcca84127fc812 Mon Sep 17 00:00:00 2001 From: Mark Cohen Date: Thu, 17 Nov 2022 10:52:03 -0500 Subject: [PATCH 02/10] updated to 2.4.0-SNAPSHOT and added jacoco plugin Signed-off-by: Mark Cohen --- build.gradle | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index e3b7e7f..89de139 100644 --- a/build.gradle +++ b/build.gradle @@ -5,6 +5,7 @@ apply plugin: 'idea' apply plugin: 'opensearch.opensearchplugin' apply plugin: 'opensearch.yaml-rest-test' apply plugin: 'opensearch.pluginzip' +apply plugin: 'jacoco' group = 'org.opensearch' @@ -52,7 +53,7 @@ validateNebulaPom.enabled = false buildscript { ext { - opensearch_version = "2.1.0-SNAPSHOT" + opensearch_version = "2.4.0-SNAPSHOT" } repositories { From 168d57a7035fd0200afdcb44ea0ff109a0a1294a Mon Sep 17 00:00:00 2001 From: Mark Cohen Date: Thu, 17 Nov 2022 10:57:36 -0500 Subject: [PATCH 03/10] updated httpcore and jackson dependencies Signed-off-by: Mark Cohen --- build.gradle | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index 89de139..c0b675c 100644 --- a/build.gradle +++ b/build.gradle @@ -79,10 +79,10 @@ dependencies { implementation 'com.ibm.icu:icu4j:57.2' implementation 'org.apache.commons:commons-lang3:3.12.0' implementation 'org.apache.httpcomponents:httpclient:4.5.13' - implementation 'org.apache.httpcomponents:httpcore:4.4.12' - implementation 'com.fasterxml.jackson.core:jackson-databind:2.13.2' - implementation 'com.fasterxml.jackson.core:jackson-core:2.13.2' - implementation 'com.fasterxml.jackson.core:jackson-annotations:2.13.2' + implementation 'org.apache.httpcomponents:httpcore:4.4.15' + implementation 'com.fasterxml.jackson.core:jackson-databind:2.14.0' + implementation 'com.fasterxml.jackson.core:jackson-core:2.14.0' + implementation 'com.fasterxml.jackson.core:jackson-annotations:2.14.0' implementation 'commons-logging:commons-logging:1.2' implementation 'com.amazonaws:aws-java-sdk-sts:1.12.300' implementation 'com.amazonaws:aws-java-sdk-core:1.12.300' From 8905428d5ab5a2008bf8094b86be4b09cf304aef Mon Sep 17 00:00:00 2001 From: Mark Cohen Date: Thu, 17 Nov 2022 11:01:18 -0500 Subject: [PATCH 04/10] output jacoco test reports Signed-off-by: Mark Cohen --- build.gradle | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/build.gradle b/build.gradle index c0b675c..b87a8c3 100644 --- a/build.gradle +++ b/build.gradle @@ -126,6 +126,14 @@ sourceSets { } } + +jacocoTestReport { + reports { + xml.enabled true + html.enabled false + } +} + // TODO: Enable these checks dependencyLicenses.enabled = false thirdPartyAudit.enabled = false From 7a55330d799344cbd92822c222935e61783ae3c5 Mon Sep 17 00:00:00 2001 From: Mark Cohen Date: Thu, 17 Nov 2022 12:54:28 -0500 Subject: [PATCH 05/10] enabling jacoco test report output in build.gradle Signed-off-by: Mark Cohen --- build.gradle | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index b87a8c3..70dafe8 100644 --- a/build.gradle +++ b/build.gradle @@ -90,6 +90,7 @@ dependencies { test { include '**/*Tests.class' + finalizedBy jacocoTestReport } task integTest(type: RestIntegTestTask) { @@ -129,9 +130,10 @@ sourceSets { jacocoTestReport { reports { - xml.enabled true - html.enabled false + xml.enabled = true + html.enabled = false } + dependsOn test } // TODO: Enable these checks From 300e113956749d850bcbc2656b83be1d24625d83 Mon Sep 17 00:00:00 2001 From: Mark Cohen Date: Mon, 21 Nov 2022 09:30:35 -0500 Subject: [PATCH 06/10] adding dependabot check at a daily interval added test that adds 1 more line of coverage. :| Signed-off-by: Mark Cohen --- .github/workflows/dependabot.yml | 10 +++++++++ .../actionfilter/SearchActionFilterTest.java | 4 ++++ ...aIntelligentRankingConfigurationTests.java | 21 +++++++++++++++++++ 3 files changed, 35 insertions(+) create mode 100644 .github/workflows/dependabot.yml create mode 100644 src/test/java/org/opensearch/search/relevance/actionfilter/SearchActionFilterTest.java create mode 100644 src/test/java/org/opensearch/search/relevance/transformer/kendraintelligentranking/configuration/KendraIntelligentRankingConfigurationTests.java diff --git a/.github/workflows/dependabot.yml b/.github/workflows/dependabot.yml new file mode 100644 index 0000000..73698b3 --- /dev/null +++ b/.github/workflows/dependabot.yml @@ -0,0 +1,10 @@ +updates: + - directory: / + open-pull-requests-limit: 1 + package-ecosystem: gradle + schedule: + interval: daily + labels: + - "dependabot" + - "dependencies" +version: 2 \ No newline at end of file diff --git a/src/test/java/org/opensearch/search/relevance/actionfilter/SearchActionFilterTest.java b/src/test/java/org/opensearch/search/relevance/actionfilter/SearchActionFilterTest.java new file mode 100644 index 0000000..b331f1b --- /dev/null +++ b/src/test/java/org/opensearch/search/relevance/actionfilter/SearchActionFilterTest.java @@ -0,0 +1,4 @@ +import static org.junit.Assert.*; +public class SearchActionFilterTest { + +} \ No newline at end of file diff --git a/src/test/java/org/opensearch/search/relevance/transformer/kendraintelligentranking/configuration/KendraIntelligentRankingConfigurationTests.java b/src/test/java/org/opensearch/search/relevance/transformer/kendraintelligentranking/configuration/KendraIntelligentRankingConfigurationTests.java new file mode 100644 index 0000000..2e365ca --- /dev/null +++ b/src/test/java/org/opensearch/search/relevance/transformer/kendraintelligentranking/configuration/KendraIntelligentRankingConfigurationTests.java @@ -0,0 +1,21 @@ +package org.opensearch.search.relevance.transformer.kendraintelligentranking.configuration; + +import junit.framework.TestCase; +import org.junit.Test; + +import java.io.IOException; + +import static org.junit.Assert.*; + +public class KendraIntelligentRankingConfigurationTest extends TestCase { + + @Test + public void parseWithNullParserAndContext() { + try { + KendraIntelligentRankingConfiguration.parse(null, null); + } catch (IOException e) { + throw new RuntimeException(e); + } + fail(); + } +} \ No newline at end of file From 19671de7c4996d706f9cba20f22785328e09a4b7 Mon Sep 17 00:00:00 2001 From: Mark Cohen Date: Mon, 21 Nov 2022 13:50:42 -0500 Subject: [PATCH 07/10] fixing dependabot configurations Signed-off-by: Mark Cohen --- .github/{workflows => }/dependabot.yml | 1 + .github/workflows/dependabot_pr.yml | 63 ++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) rename .github/{workflows => }/dependabot.yml (91%) create mode 100644 .github/workflows/dependabot_pr.yml diff --git a/.github/workflows/dependabot.yml b/.github/dependabot.yml similarity index 91% rename from .github/workflows/dependabot.yml rename to .github/dependabot.yml index 73698b3..3f0c62b 100644 --- a/.github/workflows/dependabot.yml +++ b/.github/dependabot.yml @@ -1,3 +1,4 @@ +name: Dependabot updates: - directory: / open-pull-requests-limit: 1 diff --git a/.github/workflows/dependabot_pr.yml b/.github/workflows/dependabot_pr.yml new file mode 100644 index 0000000..90b214a --- /dev/null +++ b/.github/workflows/dependabot_pr.yml @@ -0,0 +1,63 @@ +name: Dependabot PR actions +on: pull_request + +jobs: + dependabot: + runs-on: ubuntu-latest + permissions: + pull-requests: write + contents: write + if: ${{ github.actor == 'dependabot[bot]' }} + steps: + - name: GitHub App token + id: github_app_token + uses: tibdex/github-app-token@v1.5.0 + with: + app_id: ${{ secrets.APP_ID }} + private_key: ${{ secrets.APP_PRIVATE_KEY }} + installation_id: 22958780 + + - name: Check out code + uses: actions/checkout@v2 + with: + token: ${{ steps.github_app_token.outputs.token }} + + - name: Update Gradle SHAs + run: | + ./gradlew updateSHAs + + - name: Commit the changes + uses: stefanzweifel/git-auto-commit-action@v4.7.2 + with: + commit_message: Updating SHAs + branch: ${{ github.head_ref }} + commit_user_name: dependabot[bot] + commit_user_email: support@github.com + commit_options: '--signoff' + + - name: Run spotless + run: | + ./gradlew spotlessApply + + - name: Commit the changes + uses: stefanzweifel/git-auto-commit-action@v4.7.2 + with: + commit_message: Spotless formatting + branch: ${{ github.head_ref }} + commit_user_name: dependabot[bot] + commit_user_email: support@github.com + commit_options: '--signoff' + + - name: Update the changelog + uses: dangoslen/dependabot-changelog-helper@v1 + with: + version: 'Unreleased' + + - name: Commit the changes + uses: stefanzweifel/git-auto-commit-action@v4 + with: + commit_message: "Update changelog" + branch: ${{ github.head_ref }} + commit_user_name: dependabot[bot] + commit_user_email: support@github.com + commit_options: '--signoff' \ No newline at end of file From 828aba1de2cd247892156d447b47099e025952d3 Mon Sep 17 00:00:00 2001 From: Mark Cohen Date: Mon, 21 Nov 2022 13:58:34 -0500 Subject: [PATCH 08/10] fixing tests - adding 1 line coverage - woohoo Signed-off-by: Mark Cohen --- .../actionfilter/SearchActionFilterTest.java | 4 ---- .../KendraIntelligentRankingConfigurationTests.java | 13 ++++++------- 2 files changed, 6 insertions(+), 11 deletions(-) delete mode 100644 src/test/java/org/opensearch/search/relevance/actionfilter/SearchActionFilterTest.java diff --git a/src/test/java/org/opensearch/search/relevance/actionfilter/SearchActionFilterTest.java b/src/test/java/org/opensearch/search/relevance/actionfilter/SearchActionFilterTest.java deleted file mode 100644 index b331f1b..0000000 --- a/src/test/java/org/opensearch/search/relevance/actionfilter/SearchActionFilterTest.java +++ /dev/null @@ -1,4 +0,0 @@ -import static org.junit.Assert.*; -public class SearchActionFilterTest { - -} \ No newline at end of file diff --git a/src/test/java/org/opensearch/search/relevance/transformer/kendraintelligentranking/configuration/KendraIntelligentRankingConfigurationTests.java b/src/test/java/org/opensearch/search/relevance/transformer/kendraintelligentranking/configuration/KendraIntelligentRankingConfigurationTests.java index 2e365ca..6f16b16 100644 --- a/src/test/java/org/opensearch/search/relevance/transformer/kendraintelligentranking/configuration/KendraIntelligentRankingConfigurationTests.java +++ b/src/test/java/org/opensearch/search/relevance/transformer/kendraintelligentranking/configuration/KendraIntelligentRankingConfigurationTests.java @@ -1,21 +1,20 @@ package org.opensearch.search.relevance.transformer.kendraintelligentranking.configuration; -import junit.framework.TestCase; import org.junit.Test; +import org.opensearch.test.OpenSearchTestCase; import java.io.IOException; -import static org.junit.Assert.*; - -public class KendraIntelligentRankingConfigurationTest extends TestCase { +public class KendraIntelligentRankingConfigurationTests extends OpenSearchTestCase { @Test public void parseWithNullParserAndContext() { try { KendraIntelligentRankingConfiguration.parse(null, null); - } catch (IOException e) { - throw new RuntimeException(e); + fail(); + } catch (NullPointerException | IOException e) { } - fail(); + } + } \ No newline at end of file From ebb77d3986c6b0f28887ef68556b4347ffd46079 Mon Sep 17 00:00:00 2001 From: Mark Cohen Date: Mon, 21 Nov 2022 14:06:36 -0500 Subject: [PATCH 09/10] fixing tests - adding 1 line coverage - woohoo - part2 Signed-off-by: Mark Cohen --- .../KendraIntelligentRankingConfigurationTests.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/test/java/org/opensearch/search/relevance/transformer/kendraintelligentranking/configuration/KendraIntelligentRankingConfigurationTests.java b/src/test/java/org/opensearch/search/relevance/transformer/kendraintelligentranking/configuration/KendraIntelligentRankingConfigurationTests.java index 6f16b16..3093cc5 100644 --- a/src/test/java/org/opensearch/search/relevance/transformer/kendraintelligentranking/configuration/KendraIntelligentRankingConfigurationTests.java +++ b/src/test/java/org/opensearch/search/relevance/transformer/kendraintelligentranking/configuration/KendraIntelligentRankingConfigurationTests.java @@ -1,3 +1,10 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ package org.opensearch.search.relevance.transformer.kendraintelligentranking.configuration; import org.junit.Test; @@ -6,15 +13,11 @@ import java.io.IOException; public class KendraIntelligentRankingConfigurationTests extends OpenSearchTestCase { - - @Test - public void parseWithNullParserAndContext() { + public void testParseWithNullParserAndContext() { try { KendraIntelligentRankingConfiguration.parse(null, null); fail(); } catch (NullPointerException | IOException e) { } - } - } \ No newline at end of file From b10dd9dba7b878fd8b449b66b6b0bb86efe12bb9 Mon Sep 17 00:00:00 2001 From: Mark Cohen Date: Mon, 21 Nov 2022 14:17:52 -0500 Subject: [PATCH 10/10] removed spotlessCheck Signed-off-by: Mark Cohen --- .github/workflows/dependabot_pr.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/dependabot_pr.yml b/.github/workflows/dependabot_pr.yml index 90b214a..bdafb18 100644 --- a/.github/workflows/dependabot_pr.yml +++ b/.github/workflows/dependabot_pr.yml @@ -35,10 +35,6 @@ jobs: commit_user_email: support@github.com commit_options: '--signoff' - - name: Run spotless - run: | - ./gradlew spotlessApply - - name: Commit the changes uses: stefanzweifel/git-auto-commit-action@v4.7.2 with: