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/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..3f0c62b --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,11 @@ +name: Dependabot +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/.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 diff --git a/.github/workflows/dependabot_pr.yml b/.github/workflows/dependabot_pr.yml new file mode 100644 index 0000000..bdafb18 --- /dev/null +++ b/.github/workflows/dependabot_pr.yml @@ -0,0 +1,59 @@ +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: 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 diff --git a/build.gradle b/build.gradle index 6bd1626..856fff8 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' @@ -89,6 +90,7 @@ dependencies { test { include '**/*Tests.class' + finalizedBy jacocoTestReport } task integTest(type: RestIntegTestTask) { @@ -125,6 +127,15 @@ sourceSets { } } + +jacocoTestReport { + reports { + xml.enabled = true + html.enabled = false + } + dependsOn test +} + // TODO: Enable these checks dependencyLicenses.enabled = false thirdPartyAudit.enabled = false 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..3093cc5 --- /dev/null +++ b/src/test/java/org/opensearch/search/relevance/transformer/kendraintelligentranking/configuration/KendraIntelligentRankingConfigurationTests.java @@ -0,0 +1,23 @@ +/* + * 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; +import org.opensearch.test.OpenSearchTestCase; + +import java.io.IOException; + +public class KendraIntelligentRankingConfigurationTests extends OpenSearchTestCase { + public void testParseWithNullParserAndContext() { + try { + KendraIntelligentRankingConfiguration.parse(null, null); + fail(); + } catch (NullPointerException | IOException e) { + } + } +} \ No newline at end of file