From 812aaf91ccb8988b28078e1e61e46d1ccf390a49 Mon Sep 17 00:00:00 2001 From: Rutuja Surve Date: Tue, 12 May 2020 22:10:42 +0530 Subject: [PATCH] Github workflow for running PSI-cardinality installation and benchmark tests for every PR (#31) --- .flake8 | 8 ++++++ .github/workflows/tests.yml | 55 +++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 .flake8 create mode 100644 .github/workflows/tests.yml diff --git a/.flake8 b/.flake8 new file mode 100644 index 00000000..8bd0b9f8 --- /dev/null +++ b/.flake8 @@ -0,0 +1,8 @@ +[flake8] +select = E901,E999,F821,F822,F823 +max-line-length = 100 +exclude = .git,.eggs,__pycache__,build,dist,venv,third_party,tutorials +max-complexity = 11 +show-source = true +statistics = true +count = true diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 00000000..0abefb96 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,55 @@ +name: Tests + +on: + push: + branches: [ master ] + paths: + - '**.cpp' + pull_request: + types: [ opened, synchronize, reopened ] + paths: + - '**.cpp' + +jobs: + PSI-cpp-tests: + + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [macos-latest, ubuntu-18.04] + + steps: + - uses: actions/checkout@v2 + - name: Install dependencies - Bazel + run: | + sudo apt update + sudo apt install cmake clang + # Step 1: Install the JDK (optional) + sudo apt-get install openjdk-11-jdk + # Step 2: Add Bazel distribution URI as a package source + echo "deb [arch=amd64] https://storage.googleapis.com/bazel-apt stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list + curl https://bazel.build/bazel-release.pub.gpg | sudo apt-key add - + # Step 3: Install and update Bazel + sudo apt-get update && sudo apt-get install bazel + sudo apt-get install --only-upgrade bazel + + - name: Lint with clang-format + run: | + # lint files (all .cpp and .h files) inplace + find ./psi-cardinality/ \( -iname *.h -o -iname *.cpp \) | xargs clang-format -i -style='google' + # print changes + git diff + # already well formated if 'git diff' doesn't output + ! ( git diff | grep -q ^ ) || return 1 + - name: Build the library + run: | + # fetch third_party libraries + git submodule init && git submodule update + # build the cpp library + bazel build //psi_cardinality/cpp/... + - name: Run tests + run: | + bazel test //psi_cardinality/cpp/... + - name: Run benchmark tests + run: | + bazel run -c opt //psi_cardinality/cpp:psi_cardinality_benchmark