Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CI workflow for consistency with OpenSearch build image #113

Merged
merged 3 commits into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.