Skip to content

Commit

Permalink
Merge pull request #113 from rithin-pullela-aws/ci-workflow
Browse files Browse the repository at this point in the history
Add CI workflow for consistency with OpenSearch build image
  • Loading branch information
ylwu-amzn authored Jan 17, 2025
2 parents 556f834 + 8ac9dbd commit 2823199
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 32 deletions.
80 changes: 80 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
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
2 changes: 1 addition & 1 deletion .github/workflows/add-untriaged-label.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Apply 'untriaged' label during issue lifecycle

on:
issues:
types: [opened, transferred]
types: [opened, reopened, transferred]

jobs:
apply-label:
Expand Down
31 changes: 0 additions & 31 deletions .github/workflows/test.yml

This file was deleted.

0 comments on commit 2823199

Please sign in to comment.