Merge pull request #113 from rithin-pullela-aws/ci-workflow #1
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: Build and Test LTR | |
# This workflow is triggered on pull requests and push to any branches | |
on: | |
push: | |
branches-ignore: | |
- 'backport/**' | |
- 'create-pull-request/**' | |
- 'dependabot/**' | |
pull_request_target: | |
types: [opened, synchronize, reopened] | |
permissions: | |
id-token: write | |
contents: read | |
jobs: | |
Get-CI-Image-Tag: | |
uses: opensearch-project/opensearch-build/.github/workflows/get-ci-image-tag.yml@main | |
with: | |
product: opensearch | |
Build-ltr-linux: | |
needs: [Get-CI-Image-Tag] | |
strategy: | |
matrix: | |
java: [21] | |
name: Build and Test LTR Plugin on Linux | |
if: github.repository == 'opensearch-project/opensearch-learning-to-rank-base' | |
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 }} | |
# need to switch to root so that github actions can install runner binary on container without permission issues. | |
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 }} | |
- name: Setup Java ${{ matrix.java }} | |
uses: actions/setup-java@v4 | |
with: | |
java-version: ${{ matrix.java }} | |
distribution: 'temurin' | |
- name: Checkout LTR Code | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Build LTR Plugin | |
run: | | |
chown -R 1000:1000 `pwd` | |
su `id -un 1000` -c 'whoami && java -version && | |
./gradlew -Dtests.security.manager=false clean test' | |
Build-ltr-windows: | |
strategy: | |
matrix: | |
java: [ 21 ] | |
name: Build and Test LTR Plugin on Windows | |
if: github.repository == 'opensearch-project/opensearch-learning-to-rank-base' | |
runs-on: windows-latest | |
steps: | |
- name: Setup Java ${{ matrix.java }} | |
uses: actions/setup-java@v4 | |
with: | |
java-version: ${{ matrix.java }} | |
distribution: 'temurin' | |
- name: Checkout LTR Code | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Build and Run Tests | |
shell: bash | |
run: | | |
./gradlew.bat build |