Skip to content

Commit

Permalink
Merge pull request #29 from Enet4/ci-gh-actions
Browse files Browse the repository at this point in the history
Add GitHub Actions CI
  • Loading branch information
Enet4 authored Jun 10, 2021
2 parents b9f95ea + 73adb32 commit 6d6c219
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 172 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/ci.yml
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
38 changes: 38 additions & 0 deletions faiss-sys/ci/install_faiss_c.sh
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
19 changes: 0 additions & 19 deletions faiss-sys/travis/install_faiss_c.sh

This file was deleted.

153 changes: 0 additions & 153 deletions faiss-sys/travis/makefile.inc

This file was deleted.

0 comments on commit 6d6c219

Please sign in to comment.