-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from Enet4/ci-gh-actions
Add GitHub Actions CI
- Loading branch information
Showing
4 changed files
with
73 additions
and
172 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
branches: [ master ] | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
rust: | ||
- stable | ||
- beta | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Cache Faiss shared objects | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.faiss_c | ||
key: ${{ runner.os }}-build-${{ env.cache-name }}1 | ||
- name: Download and build Faiss | ||
run: ./faiss-sys/ci/install_faiss_c.sh | ||
- name: Install Faiss | ||
run: sudo cp $HOME/.faiss_c/lib*.so /usr/lib/ | ||
- name: Build | ||
run: cargo build --verbose | ||
- name: Run tests | ||
run: cargo test --verbose |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/usr/bin/env bash | ||
set -eu | ||
|
||
repo_url=https://github.com/Enet4/faiss.git | ||
repo_rev=c_api_head | ||
|
||
git clone $repo_url faiss --branch $repo_rev --depth 1 | ||
|
||
mkdir -p "$HOME/.faiss_c" | ||
|
||
cd faiss | ||
|
||
git rev-parse HEAD > ../rev_hash | ||
|
||
if [[ -s "$HOME/.faiss_c/rev_hash" && `diff -w -q ../rev_hash $HOME/.faiss_c/rev_hash` -eq "0" ]]; then | ||
echo "libfaiss_c.so is already built for revision" `cat ../rev_hash` | ||
|
||
# clean up | ||
cd .. | ||
rm -rf faiss rev_hash | ||
exit 0 | ||
fi | ||
|
||
|
||
# Build | ||
cmake . -DFAISS_ENABLE_C_API=ON -DBUILD_SHARED_LIBS=ON \ | ||
-DCMAKE_BUILD_TYPE=Release \ | ||
-DFAISS_ENABLE_GPU=OFF -DFAISS_ENABLE_PYTHON=OFF -DBUILD_TESTING=OFF | ||
|
||
make | ||
cp -f "../rev_hash" faiss/libfaiss.so c_api/libfaiss_c.so "$HOME/.faiss_c/" | ||
|
||
echo "libfaiss_c.so (" `cat ../rev_hash` ") installed in $HOME/.faiss_c/" | ||
|
||
cd .. | ||
|
||
# clean up | ||
rm -rf faiss rev_hash |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.