From 921791bfa2def92f780de66a9d8b9e1a7bdd658a Mon Sep 17 00:00:00 2001 From: Yury-Fridlyand Date: Fri, 23 Sep 2022 09:49:54 -0700 Subject: [PATCH] Add new test workflow. (#119) * Add new test workflow. Signed-off-by: Yury-Fridlyand --- .../workflows/sql-test-and-build-workflow.yml | 1 + .github/workflows/sql-test-workflow.yml | 104 ++++++++++++++++++ 2 files changed, 105 insertions(+) create mode 100644 .github/workflows/sql-test-workflow.yml diff --git a/.github/workflows/sql-test-and-build-workflow.yml b/.github/workflows/sql-test-and-build-workflow.yml index 91bee808bf..bd9e496728 100644 --- a/.github/workflows/sql-test-and-build-workflow.yml +++ b/.github/workflows/sql-test-and-build-workflow.yml @@ -75,3 +75,4 @@ jobs: integ-test/build/reports/** protocol/build/reports/** legacy/build/reports/** + plugin/build/reports/** diff --git a/.github/workflows/sql-test-workflow.yml b/.github/workflows/sql-test-workflow.yml new file mode 100644 index 0000000000..5ff8bbfc3b --- /dev/null +++ b/.github/workflows/sql-test-workflow.yml @@ -0,0 +1,104 @@ +name: SQL Plugin Tests + +on: + workflow_dispatch: + push: + branches: + - 'dev-*' + paths: + - '**/*.java' + - '**/*.g4' + - '!sql-jdbc/**' + - '**gradle*' + - '**lombok*' + - '**checkstyle*' + - 'integ-test/**' + - 'docs/**' + - 'doctest/**' + - '**/*.jar' + - '**/*.pom' + - '.github/workflows/sql-test-workflow.yml' + +jobs: + build: + strategy: + matrix: + java: + - 11 + - 17 + runs-on: ubuntu-20.04 + + steps: + - uses: actions/checkout@v3 + + - name: Set up JDK ${{ matrix.java }} + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: ${{ matrix.java }} + + - name: Run tests + id: tests + run: | + # checkstyle + ./gradlew :opensearch:checkstyleMain || echo "* Checkstyle failed for opensearch/src" > report.log + ./gradlew :opensearch:checkstyleTest || echo "* Checkstyle failed for opensearch/test" >> report.log + ./gradlew :sql:checkstyleMain || echo "* Checkstyle failed for sql/src" >> report.log + ./gradlew :sql:checkstyleTest || echo "* Checkstyle failed for sql/test" >> report.log + ./gradlew :ppl:checkstyleMain || echo "* Checkstyle failed for ppl/src" >> report.log + ./gradlew :ppl:checkstyleTest || echo "* Checkstyle failed for ppl/test" >> report.log + ./gradlew :core:checkstyleMain || echo "* Checkstyle failed for core/src" >> report.log + ./gradlew :core:checkstyleTest || echo "* Checkstyle failed for core/test" >> report.log + ./gradlew :common:checkstyleMain || echo "* Checkstyle failed for common/src" >> report.log + ./gradlew :common:checkstyleTest || echo "* Checkstyle failed for common/test" >> report.log + ./gradlew :legacy:checkstyleMain || echo "* Checkstyle failed for legacy/src" >> report.log + ./gradlew :legacy:checkstyleTest || echo "* Checkstyle failed for legacy/test" >> report.log + ./gradlew :protocol:checkstyleMain || echo "* Checkstyle failed for protocol/src" >> report.log + ./gradlew :protocol:checkstyleTest || echo "* Checkstyle failed for protocol/test" >> report.log + ./gradlew :opensearch-sql-plugin:checkstyleMain || echo "* Checkstyle failed for plugin/src" >> report.log + ./gradlew :opensearch-sql-plugin:checkstyleTest || echo "* Checkstyle failed for plugin/test" >> report.log + # Add checkstyle for `integ-test` when fixed + # Unit tests + ./gradlew :opensearch:test || echo "* Unit tests failed for opensearch" >> report.log + ./gradlew :ppl:test || echo "* Unit tests failed for sql" >> report.log + ./gradlew :sql:test || echo "* Unit tests failed for ppl" >> report.log + ./gradlew :core:test || echo "* Unit tests failed for core" >> report.log + ./gradlew :protocol:test || echo "* Unit tests failed for protocol" >> report.log + ./gradlew :opensearch-sql-plugin:test || echo "* Unit tests failed for plugin" >> report.log + ./gradlew :legacy:test || echo "* Unit tests failed for legacy" >> report.log + # jacoco + ./gradlew :opensearch:jacocoTestCoverageVerification || echo "* Jacoco failed for opensearch" >> report.log + ./gradlew :ppl:jacocoTestCoverageVerification || echo "* Jacoco failed for sql" >> report.log + ./gradlew :sql:jacocoTestCoverageVerification || echo "* Jacoco failed for ppl" >> report.log + ./gradlew :core:jacocoTestCoverageVerification || echo "* Jacoco failed for core" >> report.log + ./gradlew :protocol:jacocoTestCoverageVerification || echo "* Jacoco failed for protocol" >> report.log + ./gradlew :opensearch-sql-plugin:jacocoTestCoverageVerification || echo "* Jacoco failed for plugin" >> report.log + # Misc tests + ./gradlew :integ-test:integTest || echo "* Integration test failed" >> report.log + ./gradlew :doctest:doctest || echo "* Doctest failed" >> report.log + ./scripts/bwctest.sh || echo "* Backward compatibility test failed" >> report.log + + - name: Verify test results + run: | + if [[ -e failures.log ]] + then + echo "## FAILED TESTS :facepalm::warning::bangbang:" >> $GITHUB_STEP_SUMMARY + cat failures.log >> $GITHUB_STEP_SUMMARY + exit 1 + fi + + - name: Upload test reports + if: always() + uses: actions/upload-artifact@v2 + with: + name: test-reports + path: | + sql/build/reports/** + ppl/build/reports/** + core/build/reports/** + common/build/reports/** + opensearch/build/reports/** + integ-test/build/reports/** + protocol/build/reports/** + legacy/build/reports/** + plugin/build/reports/**