Skip to content

Commit

Permalink
[ci] Add taichi-aot-demo headless demos (#6280)
Browse files Browse the repository at this point in the history
Issue: #

### Brief Summary
  • Loading branch information
feisuzhu authored Oct 12, 2022
1 parent 29a421a commit df45c68
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 1 deletion.
46 changes: 46 additions & 0 deletions .github/workflows/scripts/aot-demo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ function build-and-smoke-test-android-aot-demo {

export TAICHI_REPO_DIR=$(pwd)/taichi

rm -rf taichi-aot-demo
git clone https://github.com/taichi-dev/taichi-aot-demo

# Normally we checkout the master's commit Id: https://github.com/taichi-dev/taichi-aot-demo/commit/master
Expand Down Expand Up @@ -94,4 +95,49 @@ function smoke-test-unity-demo {
6
}

function build-and-test-headless-demo {
setup-android-ndk-env

pushd taichi
export TAICHI_REPO_DIR=$(pwd)
popd

rm -rf taichi-aot-demo
git clone --recursive --depth=1 https://github.com/taichi-dev/taichi-aot-demo
cd taichi-aot-demo
mkdir build
pushd build
export TAICHI_C_API_INSTALL_DIR=$(find $TAICHI_REPO_DIR -name cmake-install -type d | head -n 1)/c_api
cmake $ANDROID_CMAKE_ARGS ..
make -j
export PATH=/android-sdk/platform-tools:$PATH
grab-android-bot
trap release-android-bot EXIT
adb connect $BOT
cd headless
BINARIES=$(ls E*)
for b in $BINARIES; do
adb push $b /data/local/tmp
done
adb push $TAICHI_C_API_INSTALL_DIR/lib/libtaichi_c_api.so /data/local/tmp

popd # build

for dir in ?_*; do
adb push $dir /data/local/tmp
done

for b in $BINARIES; do
adb shell "cd /data/local/tmp && LD_LIBRARY_PATH=\$(pwd) ./$b"
adb pull /data/local/tmp/0001.bmp $b.bmp
done

for b in $BINARIES; do
if [[ $(cmp -l $b.bmp ci/headless-truths/$b.bmp | wc -l) -gt 300 ]]; then
echo "Above threshold: $b"
exit 1
fi
done
}

$1
2 changes: 1 addition & 1 deletion .github/workflows/scripts/common-utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ function ci-docker-run-gpu {
}

function setup-android-ndk-env {
export ANDROID_NDK_ROOT=/android-sdk/ndk-bundle
export ANDROID_NDK_ROOT=${ANDROID_NDK_ROOT:-/android-sdk/ndk-bundle}
export ANDROID_CMAKE_ARGS="-DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK_ROOT}/build/cmake/android.toolchain.cmake -DANDROID_NATIVE_API_LEVEL=29 -DANDROID_ABI=arm64-v8a"
export TAICHI_CMAKE_ARGS="$TAICHI_CMAKE_ARGS $ANDROID_CMAKE_ARGS"
export PATH=$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -619,3 +619,11 @@ jobs:
ci-docker-run \
registry.taichigraphics.com/taichidev-androidsdk18.04:v0.0.6 \
/home/dev/taichi/.github/workflows/scripts/aot-demo.sh smoke-test-unity-demo
- name: Build & Run C-API Headless Demos
run: |
. .github/workflows/scripts/common-utils.sh
chown -R 1000:1000 .
ci-docker-run \
registry.taichigraphics.com/taichidev-androidsdk18.04:v0.0.6 \
/home/dev/taichi/.github/workflows/scripts/aot-demo.sh build-and-test-headless-demo
1 change: 1 addition & 0 deletions python/taichi/examples/features/io/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.ply

0 comments on commit df45c68

Please sign in to comment.