Onboarding new maven snapshots publishing to s3 (opensearch-remote-me… #662
This file contains hidden or 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: Build and Test | |
on: | |
push: | |
branches: | |
- "*" | |
pull_request: | |
branches: | |
- "*" | |
jobs: | |
Get-CI-Image-Tag: | |
uses: opensearch-project/opensearch-build/.github/workflows/get-ci-image-tag.yml@main | |
with: | |
product: opensearch | |
spotless: | |
if: github.repository == 'opensearch-project/opensearch-remote-metadata-sdk' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-java@v4 | |
with: | |
java-version: 21 | |
distribution: temurin | |
- name: Spotless Check | |
run: ./gradlew spotlessCheck | |
javadoc: | |
if: github.repository == 'opensearch-project/opensearch-remote-metadata-sdk' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-java@v4 | |
with: | |
java-version: 21 | |
distribution: temurin | |
- name: Javadoc CheckStyle | |
run: ./gradlew checkstyleMain | |
- name: Javadoc Check | |
run: ./gradlew javadoc | |
build-linux: | |
needs: [Get-CI-Image-Tag, spotless, javadoc] | |
strategy: | |
matrix: | |
java: | |
- 21 | |
- 23 | |
name: Linux JDK ${{ matrix.java }} | |
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: | |
java-version: ${{ matrix.java }} | |
distribution: temurin | |
- name: Build and Run Tests | |
id: step-build-test-linux | |
run: | | |
chown -R 1000:1000 `pwd` | |
su `id -un 1000` -c 'whoami && java -version && | |
echo "build and run tests" && ./gradlew build && | |
echo "Publish to Maven Local" && ./gradlew publishToMavenLocal' | |
- name: Upload Coverage Report Artifacts | |
if: contains(matrix.java, '21') | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coverage-report-linux-jdk${{ matrix.java }} | |
path: '**/build/reports/jacoco/test/jacocoTestReport.xml' | |
linux-codecov-upload: | |
needs: build-linux | |
runs-on: ubuntu-24.04 | |
steps: | |
# The checkout step should not be necessary but adding to work around CodeCov upload issue | |
# see: https://github.com/codecov/codecov-action/issues/1801 | |
- uses: actions/checkout@v4 | |
- name: Download Coverage Report Artifact | |
uses: actions/download-artifact@v5 | |
with: | |
name: coverage-report-linux-jdk21 | |
path: ./coverage-reports | |
- name: Find Coverage Reports | |
id: find-jacoco-reports | |
run: | | |
REPORTS=$(find ./coverage-reports -name "jacocoTestReport.xml" | tr '\n' ',' | sed 's/,$//') | |
echo "report_files=$REPORTS" >> $GITHUB_OUTPUT | |
- name: Upload Coverage Report | |
uses: codecov/codecov-action@v5 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: ${{ steps.find-jacoco-reports.outputs.report_files }} | |
build-windows: | |
needs: [spotless, javadoc] | |
strategy: | |
matrix: | |
java: | |
- 21 | |
- 23 | |
name: Windows JDK ${{ matrix.java }} | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK ${{ matrix.java }} | |
uses: actions/setup-java@v4 | |
with: | |
java-version: ${{ matrix.java }} | |
distribution: temurin | |
- name: Build and Run Tests | |
run: | | |
./gradlew build |