forked from opensearch-project/k-NN
-
Notifications
You must be signed in to change notification settings - Fork 0
140 lines (129 loc) · 5.45 KB
/
CI.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
name: Build and Test k-NN
on:
schedule:
- cron: '0 0 * * *' # every night
push:
branches:
- "*"
- "feature/**"
pull_request:
branches:
- "*"
- "feature/**"
jobs:
# Build-k-NN:
# strategy:
# matrix:
# java: [11, 17]
# os: [ubuntu-latest, macos-latest]
#
# name: Build and Test k-NN Plugin
# runs-on: ${{ matrix.os }}
#
# steps:
# - name: Checkout k-NN
# uses: actions/checkout@v1
#
# - name: Setup Java ${{ matrix.java }}
# uses: actions/setup-java@v1
# with:
# java-version: ${{ matrix.java }}
#
# - name: Install dependencies on ubuntu
# if: startsWith(matrix.os,'ubuntu')
# run: |
# sudo apt-get install libopenblas-dev gfortran -y
#
# - name: Install dependencies on macos
# if: startsWith(matrix.os, 'macos')
# run: |
# brew reinstall gcc
# export FC=/usr/local/Cellar/gcc/12.2.0/bin/gfortran
#
# - name: Run build
# run: |
# ./gradlew build
#
# - name: Upload Coverage Report
# if: startsWith(matrix.os,'ubuntu')
# uses: codecov/codecov-action@v1
# with:
# token: ${{ secrets.CODECOV_TOKEN }}
Build-k-NN-Windows:
strategy:
matrix:
java: [ 11 ]
name: Build and Test k-NN Plugin on Windows
runs-on: windows-latest
steps:
- name: Checkout k-NN
uses: actions/checkout@v1
- name: Setup Java ${{ matrix.java }}
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java }}
- name: Install MinGW Using Scoop
run: |
iex "& {$(irm get.scoop.sh)} -RunAsAdmin"
scoop bucket add main
scoop install mingw
- name: Add MinGW to PATH
run: |
echo "C:/Users/runneradmin/scoop/apps/mingw/current/bin" >> $env:GITHUB_PATH
Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
refreshenv
# iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
# choco install -y git
# $env:ChocolateyInstall = Convert-Path "$((Get-Command choco).Path)\..\.."
- name: Download OpenBLAS
run: |
curl -L -O https://github.com/xianyi/OpenBLAS/releases/download/v0.3.21/OpenBLAS-0.3.21-x64.zip
mkdir OpenBLAS
Expand-Archive -Path .\OpenBLAS-0.3.21-x64.zip -DestinationPath .\OpenBLAS\
mkdir ./src/main/resources/windowsDependencies
cp ./OpenBLAS/bin/libopenblas.dll ./src/main/resources/windowsDependencies/
rm .\OpenBLAS-0.3.21-x64.zip
rm -r .\OpenBLAS\
- name: Run build
run: |
./gradlew.bat build
# - name: Pull and Run Docker for security tests
# run: |
# plugin=`ls build/distributions/*.zip`
# version=`echo $plugin|awk -F- '{print $4}'| cut -d. -f 1-3`
# plugin_version=`echo $plugin|awk -F- '{print $4}'| cut -d. -f 1-4`
# echo $version
# cd ..
# if docker pull opendistroforelasticsearch/opendistroforelasticsearch:$version
# then
# echo "FROM opendistroforelasticsearch/opendistroforelasticsearch:$version" >> Dockerfile
# echo "RUN if [ -d /usr/share/elasticsearch/plugins/opendistro-knn ]; then /usr/share/elasticsearch/bin/elasticsearch-plugin remove opendistro-knn; fi" >> Dockerfile
# echo "RUN yum -y update \ && yum -y groupinstall "Development Tools" \ && yum install -y unzip glibc.x86_64 cmake \ && yum clean all" >> Dockerfile
# echo "RUN git clone --recursive --branch ${GITHUB_REF##*/} https://github.com/opendistro-for-elasticsearch/k-NN.git /usr/share/elasticsearch/k-NN \ " >> Dockerfile
# echo "&& cd /usr/share/elasticsearch/k-NN/jni \ && sed -i 's/-march=native/-march=x86-64/g' external/nmslib/similarity_search/CMakeLists.txt \ && cmake . \ && make \ " >> Dockerfile
# echo "&& mkdir /tmp/jni/ && cp release/*.so /tmp/jni/ && ls -ltr /tmp/jni/ \ && cp /tmp/jni/libKNNIndex*.so /usr/lib \ && rm -rf /usr/share/elasticsearch/k-NN" >> Dockerfile
# echo "RUN cd /usr/share/elasticsearch/" >> Dockerfile
# echo "ADD k-NN/build/distributions/opendistro-knn-$plugin_version.zip /tmp/" >> Dockerfile
# echo "RUN /usr/share/elasticsearch/bin/elasticsearch-plugin install --batch file:/tmp/opendistro-knn-$plugin_version.zip" >> Dockerfile
# docker build -t odfe-knn: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" odfe-knn:test
# sleep 90
# - name: Run k-NN Test
# if: env.imagePresent == 'true'
# run: |
# security=`curl -XGET https://localhost:9200/_cat/plugins?v -u admin:admin --insecure |grep opendistro_security|wc -l`
# if [ $security -gt 0 ]
# then
# echo "Security plugin is available. Running tests in security mode"
# ./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. Skipping tests as they are already ran part of ./gradlew build"
# fi