Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Add Github action to build library artifacts #170

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
95 changes: 63 additions & 32 deletions .github/workflows/CD.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@ on:
- v*

jobs:
Build-k-NN:
plugin-build-and-ship-artifacts:
strategy:
matrix:
java: [14]
compiler: [g++-5]

name: Build and Release k-NN Plugin
runs-on: ubuntu-16.04

name: Build and release plugin artifacts
runs-on: ubuntu-latest
steps:
- name: Checkout k-NN
uses: actions/checkout@v2
Expand All @@ -30,33 +28,6 @@ jobs:
with:
java-version: ${{ matrix.java }}

- name: Build and ship library artifacts
env:
CXX: ${{ matrix.compiler }}
run: |
cd jni
git submodule update --init -- jni/external/nmslib
sed -i 's/-march=native/-march=x86-64/g' external/nmslib/similarity_search/CMakeLists.txt
cmake .
make package

cd packages
folder_name=`ls ./*.rpm | sed 's|\(.*\)\..*|\1|'`
zip_name=$folder_name".zip"
mkdir $folder_name
cp ../release/*.so $folder_name
zip -r $zip_name $folder_name/*
cd ..

zip_artifact=`ls packages/*.zip`
rpm_artifact=`ls packages/*.rpm`
deb_artifact=`ls packages/*.deb`

aws s3 cp $zip_artifact s3://artifacts.opendistroforelasticsearch.amazon.com/downloads/opendistro-libs/opendistro-knnlib/
aws s3 cp $rpm_artifact s3://artifacts.opendistroforelasticsearch.amazon.com/downloads/rpms/opendistro-knnlib/
aws s3 cp $deb_artifact s3://artifacts.opendistroforelasticsearch.amazon.com/downloads/debs/opendistro-knnlib/
aws cloudfront create-invalidation --distribution-id E1VG5HMIWI4SA2 --paths "/*"

- name: Build and ship plugin artifacts
run: |
./gradlew buildPackages --console=plain -Dbuild.snapshot=false
Expand All @@ -68,3 +39,63 @@ jobs:
aws s3 cp $rpm_artifact s3://artifacts.opendistroforelasticsearch.amazon.com/downloads/rpms/opendistro-knn/
aws s3 cp $deb_artifact s3://artifacts.opendistroforelasticsearch.amazon.com/downloads/debs/opendistro-knn/
aws cloudfront create-invalidation --distribution-id E1VG5HMIWI4SA2 --paths "/*"

library-build-and-ship-artifacts:
name: Build and release JNI library artifacts
runs-on: ubuntu-latest
container:
image: centos:7
strategy:
matrix:
java: [14]
compiler: [g++]
steps:
- name: Checkout k-NN
uses: actions/checkout@v1
with:
submodules: true

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1

- name: Setup Java ${{ matrix.java }}
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java }}

- name: Install dependencies
run: |
yum update -y
yum install -y cmake rpm-build gcc-c++ make epel-release
yum repolist
yum install -y dpkg

- name: Build and ship library artifacts
env:
CXX: ${{ matrix.compiler }}
run: |
cd jni
sed -i 's/-march=native/-march=x86-64/g' external/nmslib/similarity_search/CMakeLists.txt
cmake .
make package

cd packages
folder_name=`ls ./*.rpm | sed 's|\(.*\)\..*|\1|'`
zip_name=$folder_name".zip"
mkdir $folder_name
cp ../release/*.so $folder_name
zip -r $zip_name $folder_name/*
cd ..

zip_artifact=`ls packages/*.zip`
rpm_artifact=`ls packages/*.rpm`
deb_artifact=`ls packages/*.deb`

aws s3 cp $zip_artifact s3://artifacts.opendistroforelasticsearch.amazon.com/downloads/opendistro-libs/opendistro-knnlib/
aws s3 cp $rpm_artifact s3://artifacts.opendistroforelasticsearch.amazon.com/downloads/rpms/opendistro-knnlib/
aws s3 cp $deb_artifact s3://artifacts.opendistroforelasticsearch.amazon.com/downloads/debs/opendistro-knnlib/
aws cloudfront create-invalidation --distribution-id E1VG5HMIWI4SA2 --paths "/*"
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ make
The library will be placed in the `jni/release` directory.

## JNI Library Artifacts
We build and distribute binary library artifacts with Opendistro for Elasticsearch. We build the library binary, RPM and DEB in [this GitHub action](https://github.com/opendistro-for-elasticsearch/k-NN/blob/master/.github/workflows/CD.yml). We use Ubuntu 16.04 with g++ 5.4.0 to build the library. Additionally, in order to provide as much general compatibility as possible, we compile the library without optimized instruction sets enabled. For users that want to get the most out of the library, they should follow [this section](##Build JNI Library RPM/DEB) and build the library from source in their production environment, so that if their environment has optimized instruction sets, they take advantage of them.
We build and distribute binary library artifacts with Opendistro for Elasticsearch. We build the library binary, RPM and DEB in [this GitHub action](https://github.com/opendistro-for-elasticsearch/k-NN/blob/master/.github/workflows/CD.yml). We use Centos 7 with g++ 4.8.5 to build the DEB, RPM and ZIP. Additionally, in order to provide as much general compatibility as possible, we compile the library without optimized instruction sets enabled. For users that want to get the most out of the library, they should follow [this section](##Build JNI Library RPM/DEB) and build the library from source in their production environment, so that if their environment has optimized instruction sets, they take advantage of them.

## Build JNI Library RPM/DEB

Expand Down