Add additional tests to increase code coverage #5527
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: SQL Java CI | |
on: | |
pull_request: | |
push: | |
branches-ignore: | |
- 'dependabot/**' | |
paths: | |
- '**/*.java' | |
- '**/*.g4' | |
- '!sql-jdbc/**' | |
- '**gradle*' | |
- '**lombok*' | |
- 'integ-test/**' | |
- '**/*.jar' | |
- '**/*.pom' | |
- '.github/workflows/sql-test-and-build-workflow.yml' | |
jobs: | |
Get-CI-Image-Tag: | |
uses: opensearch-project/opensearch-build/.github/workflows/get-ci-image-tag.yml@main | |
with: | |
product: opensearch | |
build-linux: | |
needs: Get-CI-Image-Tag | |
strategy: | |
# Run all jobs | |
fail-fast: false | |
matrix: | |
java: [21] | |
runs-on: ubuntu-latest | |
container: | |
# using the same image which is used by opensearch-build team to build the OpenSearch Distribution | |
# this image tag is subject to change as more dependencies and updates will arrive over time | |
image: ${{ needs.Get-CI-Image-Tag.outputs.ci-image-version-linux }} | |
options: ${{ needs.Get-CI-Image-Tag.outputs.ci-image-start-options }} | |
steps: | |
- name: Run start commands | |
run: ${{ needs.Get-CI-Image-Tag.outputs.ci-image-start-command }} | |
- uses: actions/checkout@v4 | |
- name: Set up JDK ${{ matrix.java }} | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: ${{ matrix.java }} | |
- name: Build with Gradle | |
run: | | |
chown -R 1000:1000 `pwd` | |
su `id -un 1000` -c "./gradlew --continue build" | |
- name: Create Artifact Path | |
run: | | |
mkdir -p opensearch-sql-builds | |
cp -r ./plugin/build/distributions/*.zip opensearch-sql-builds/ | |
# This step uses the codecov-action Github action: https://github.com/codecov/codecov-action | |
- name: Upload SQL Coverage Report | |
if: ${{ always() }} | |
uses: codecov/codecov-action@v4 | |
continue-on-error: true | |
with: | |
flags: sql-engine | |
token: ${{ secrets.CODECOV_TOKEN }} | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v4 | |
continue-on-error: true | |
with: | |
name: opensearch-sql-ubuntu-latest-${{ matrix.java }} | |
path: opensearch-sql-builds | |
- name: Upload test reports | |
if: ${{ always() }} | |
uses: actions/upload-artifact@v4 | |
continue-on-error: true | |
with: | |
name: test-reports-ubuntu-latest-${{ matrix.java }} | |
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/** | |
doctest/build/testclusters/docTestCluster-0/logs/* | |
integ-test/build/testclusters/*/logs/* | |
build-windows-macos: | |
strategy: | |
# Run all jobs | |
fail-fast: false | |
matrix: | |
entry: | |
- { os: windows-latest, java: 21, os_build_args: -x doctest -PbuildPlatform=windows } | |
- { os: macos-13, java: 21 } | |
runs-on: ${{ matrix.entry.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK ${{ matrix.java }} | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: ${{ matrix.entry.java }} | |
- name: Build with Gradle | |
run: ./gradlew --continue build ${{ matrix.entry.os_build_args }} | |
- name: Create Artifact Path | |
run: | | |
mkdir -p opensearch-sql-builds | |
cp -r ./plugin/build/distributions/*.zip opensearch-sql-builds/ | |
# This step uses the codecov-action Github action: https://github.com/codecov/codecov-action | |
- name: Upload SQL Coverage Report | |
if: ${{ always() && matrix.entry.os == 'ubuntu-latest' }} | |
uses: codecov/codecov-action@v4 | |
continue-on-error: true | |
with: | |
flags: sql-engine | |
token: ${{ secrets.CODECOV_TOKEN }} | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v4 | |
continue-on-error: true | |
with: | |
name: opensearch-sql-${{ matrix.entry.os }}-${{ matrix.entry.java }} | |
path: opensearch-sql-builds | |
- name: Upload test reports | |
if: ${{ always() && matrix.entry.os == 'ubuntu-latest' }} | |
uses: actions/upload-artifact@v4 | |
continue-on-error: true | |
with: | |
name: test-reports-${{ matrix.entry.os }}-${{ matrix.entry.java }} | |
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/** | |
doctest/build/testclusters/docTestCluster-0/logs/* | |
integ-test/build/testclusters/*/logs/* | |
bwc-tests: | |
needs: Get-CI-Image-Tag | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
java: [21] | |
container: | |
image: ${{ needs.Get-CI-Image-Tag.outputs.ci-image-version-linux }} | |
options: ${{ needs.Get-CI-Image-Tag.outputs.ci-image-start-options }} | |
steps: | |
- name: Run start commands | |
run: ${{ needs.Get-CI-Image-Tag.outputs.ci-image-start-command }} | |
- uses: actions/checkout@v4 | |
- name: Set up JDK ${{ matrix.java }} | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: ${{ matrix.java }} | |
- name: Run backward compatibility tests | |
run: | | |
chown -R 1000:1000 `pwd` | |
su `id -un 1000` -c "./scripts/bwctest.sh" | |
- name: Upload test reports | |
if: ${{ always() }} | |
uses: actions/upload-artifact@v4 | |
continue-on-error: true | |
with: | |
name: test-reports-ubuntu-latest-${{ matrix.java }}-bwc | |
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/** | |
doctest/build/testclusters/docTestCluster-0/logs/* | |
integ-test/build/testclusters/*/logs/* |