Skip to content
This repository has been archived by the owner on May 1, 2023. It is now read-only.

Commit

Permalink
Run C++ and Java tests in GitHub action (#8)
Browse files Browse the repository at this point in the history
Summary:
Depends on facebookincubator/fbjni#4.
Pull Request resolved: facebookincubator/fbjni#8

Reviewed By: dreiss

Differential Revision: D17604714

Pulled By: passy

fbshipit-source-id: 0b42991c9600ef8c910d6851e87b058ce4772b93
  • Loading branch information
passy authored and facebook-github-bot committed Sep 27, 2019
1 parent 1e2e5f3 commit 331ccf6
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
4 changes: 4 additions & 0 deletions deps/fbjni/.github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,7 @@ jobs:
run: |
source scripts/android-setup.sh && installAndroidSDK
./gradlew assembleDebug
- name: Run tests
run: |
source scripts/android-setup.sh && installsdk 'cmake;3.10.2.4988404'
scripts/run-host-tests.sh
4 changes: 2 additions & 2 deletions deps/fbjni/scripts/android-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function installsdk() {
PROXY_ARGS="--proxy=http --proxy_host=$PROXY_HOST --proxy_port=$PROXY_PORT"
fi

echo y | "$ANDROID_HOME/tools/bin/sdkmanager" $PROXY_ARGS "$@"
echo y | "$ANDROID_HOME/tools/bin/sdkmanager" $PROXY_ARGS "$@" > /dev/null
}

function getAndroidSDK {
Expand All @@ -35,7 +35,7 @@ function getAndroidSDK {
}

function installAndroidSDK {
export ANDROID_HOME=$USER/android_sdk
export ANDROID_HOME="$HOME/android_sdk"
getAndroidSDK
export PATH="$ANDROID_HOME/platform-tools:$ANDROID_HOME/tools:$ANDROID_HOME/tools/bin:$PATH"

Expand Down
21 changes: 21 additions & 0 deletions deps/fbjni/scripts/run-host-tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

set -exo pipefail

BASE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )/.."
CMAKE=$ANDROID_HOME/cmake/3.10.2.4988404/bin/cmake

mkdir -p "$BASE_DIR/host-build-cmake"
cd "$BASE_DIR/host-build-cmake"

# Configure CMake project
$CMAKE -DJAVA_HOME="$JAVA_HOME" ..
# Build binaries and libraries
make
# Run C++ tests
make test
# LD_LIBRARY_PATH is needed for native library dependencies to load cleanly
TEST_LD_LIBRARY_PATH="$BASE_DIR/host-build-cmake:$BASE_DIR/host-build-cmake/test/jni"
# Build and run JNI tests
cd "$BASE_DIR"
env LD_LIBRARY_PATH="$TEST_LD_LIBRARY_PATH" ./gradlew -b host.gradle -PbuildDir=host-build-gradle test

0 comments on commit 331ccf6

Please sign in to comment.