[2.x] Adding an integration test for redeploying a model (#1016) (#1… #27
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 ml-commons | |
# This workflow is triggered on pull requests and push to any branches | |
on: | |
pull_request: | |
branches: | |
- "*" | |
push: | |
branches: | |
- "*" | |
jobs: | |
Build-ml: | |
strategy: | |
matrix: | |
java: [11, 17, 20] | |
name: Build and Test MLCommons Plugin | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setup Java ${{ matrix.java }} | |
uses: actions/setup-java@v1 | |
with: | |
java-version: ${{ matrix.java }} | |
# ml-commons | |
- name: Checkout MLCommons | |
uses: actions/checkout@v2 | |
- name: Build and Run Tests | |
run: | | |
./gradlew build | |
- name: Publish to Maven Local | |
run: | | |
./gradlew publishToMavenLocal | |
- name: Multi Nodes Integration Testing | |
run: | | |
./gradlew integTest -PnumNodes=3 | |
- name: Pull and Run Docker | |
run: | | |
plugin=`basename $(ls plugin/build/distributions/*.zip)` | |
version=`echo $plugin|awk -F- '{print $3}'| cut -d. -f 1-3` | |
plugin_version=`echo $plugin|awk -F- '{print $3}'| cut -d. -f 1-4` | |
qualifier=`echo $plugin|awk -F- '{print $4}'| cut -d. -f 1-1` | |
candidate_version=`echo $plugin|awk -F- '{print $5}'| cut -d. -f 1-1` | |
docker_version=$version-$qualifier | |
[[ -z $candidate_version ]] && candidate_version=$qualifier && qualifier="" | |
echo plugin version plugin_version qualifier candidate_version docker_version | |
echo "($plugin) ($version) ($plugin_version) ($qualifier) ($candidate_version) ($docker_version)" | |
cd .. | |
if docker pull opensearchstaging/opensearch:$docker_version | |
then | |
echo "FROM opensearchstaging/opensearch:$docker_version" >> Dockerfile | |
echo "RUN if [ -d /usr/share/opensearch/plugins/opensearch-ml ]; then /usr/share/opensearch/bin/opensearch-plugin remove opensearch-ml; fi" >> Dockerfile | |
echo "ADD ml-commons/plugin/build/distributions/$plugin /tmp/" >> Dockerfile | |
echo "RUN /usr/share/opensearch/bin/opensearch-plugin install --batch file:/tmp/$plugin" >> Dockerfile | |
docker build -t opensearch-ml:test . | |
echo "imagePresent=true" >> $GITHUB_ENV | |
else | |
echo "imagePresent=false" >> $GITHUB_ENV | |
fi | |
- name: Run Docker Image | |
if: env.imagePresent == 'true' | |
run: | | |
cd .. | |
docker run -p 9200:9200 -d -p 9600:9600 -e "discovery.type=single-node" opensearch-ml:test | |
sleep 90 | |
- name: Run MLCommons Test | |
if: env.imagePresent == 'true' | |
run: | | |
security=`curl -XGET https://localhost:9200/_cat/plugins?v -u admin:admin --insecure |grep opensearch-security|wc -l` | |
if [ $security -gt 0 ] | |
then | |
echo "Security plugin is available" | |
./gradlew integTest -Dtests.rest.cluster=localhost:9200 -Dtests.cluster=localhost:9200 -Dtests.clustername="docker-cluster" -Dhttps=true -Duser=admin -Dpassword=admin | |
else | |
echo "Security plugin is NOT available" | |
./gradlew integTest -Dtests.rest.cluster=localhost:9200 -Dtests.cluster=localhost:9200 -Dtests.clustername="docker-cluster" | |
fi | |
- name: Upload Coverage Report | |
uses: codecov/codecov-action@v1 | |
with: | |
flags: ml-commons | |
token: ${{ secrets.CODECOV_TOKEN }} | |
Build-ml-windows: | |
strategy: | |
matrix: | |
java: [11, 17, 20] | |
name: Build and Test MLCommons Plugin on Windows | |
runs-on: windows-latest | |
steps: | |
- name: Setup Java ${{ matrix.java }} | |
uses: actions/setup-java@v1 | |
with: | |
java-version: ${{ matrix.java }} | |
# ml-commons | |
- name: Checkout MLCommons | |
uses: actions/checkout@v2 | |
- name: Build and Run Tests | |
run: | | |
./gradlew.bat build | |
- name: Publish to Maven Local | |
run: | | |
./gradlew publishToMavenLocal | |
# - name: Multi Nodes Integration Testing | |
# run: | | |
# ./gradlew integTest -PnumNodes=3 |