Skip to content

Commit

Permalink
Merge pull request #52 from JDAI-CV/ci
Browse files Browse the repository at this point in the history
Replace travis and appveyor with azure pipeline
  • Loading branch information
daquexian authored May 23, 2019
2 parents a645f98 + 3ca03f7 commit 4f12fe1
Show file tree
Hide file tree
Showing 50 changed files with 365 additions and 174 deletions.
5 changes: 5 additions & 0 deletions .daq_pm/configs/all-27
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Configuration for [project_manager.vim](https://github.com/daquexian/project_manager.vim)
name DNNLibrary
type cpp
build_dir build-all-v27
cmake_options -DCMAKE_TOOLCHAIN_FILE=~/Android/Sdk/ndk-bundle/build/cmake/android.toolchain.cmake -DANDROID_PLATFORM=android-27 -DANDROID_ABI=arm64-v8a -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -GNinja
93 changes: 0 additions & 93 deletions .travis.yml

This file was deleted.

5 changes: 3 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ include(cmake/system.cmake)
include(cmake/glog.cmake)
include(cmake/common.cmake)

include(cmake/utils.cmake)
dnn_add_msvc_runtime_flag()

configure_glog()

if (${CMAKE_SYSTEM_NAME} STREQUAL "Android")
Expand All @@ -29,8 +32,6 @@ if (${CMAKE_SYSTEM_NAME} STREQUAL "Android")
add_subdirectory(dnnlibrary)
add_subdirectory(binaries)
else()
include(cmake/utils.cmake)
dnn_add_msvc_runtime_flag()
set (CMAKE_CXX_STANDARD 11)
if (MSVC)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS 1)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# DNNLibrary

[![Build Status](https://travis-ci.com/JDAI-CV/DNNLibrary.svg?branch=master)](https://travis-ci.com/JDAI-CV/DNNLibrary)
[![Build Status](https://dev.azure.com/daquexian/DNNLibrary/_apis/build/status/DNNLibrary%20Build%20and%20Test?branchName=master)](https://dev.azure.com/daquexian/DNNLibrary/_build/latest?definitionId=8&branchName=master)
[![Download](https://api.bintray.com/packages/daquexian566/maven/dnnlibrary/images/download.svg) ](https://bintray.com/daquexian566/maven/dnnlibrary/_latestVersion)
![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)

Expand Down
17 changes: 0 additions & 17 deletions appveyor.yml

This file was deleted.

12 changes: 9 additions & 3 deletions binaries/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,25 @@ if (DNN_BUILD_BIN)
target_link_libraries(dnn_retrieve_result
dnnlibrary)

treat_warnings_as_errors(dnn_retrieve_result)
if ((NOT DNN_READ_ONNX) OR DNN_SYSTEM_PROTOBUF)
treat_warnings_as_errors(dnn_retrieve_result)
endif()

add_executable(dnn_benchmark
dnn_benchmark.cpp)
target_link_libraries(dnn_benchmark
dnnlibrary)

treat_warnings_as_errors(dnn_benchmark)
if ((NOT DNN_READ_ONNX) OR DNN_SYSTEM_PROTOBUF)
treat_warnings_as_errors(dnn_benchmark)
endif()

add_executable(ex_model_builder
ex_model_builder.cpp)
target_link_libraries(ex_model_builder
dnnlibrary)

treat_warnings_as_errors(ex_model_builder)
if ((NOT DNN_READ_ONNX) OR DNN_SYSTEM_PROTOBUF)
treat_warnings_as_errors(ex_model_builder)
endif()
endif()
1 change: 1 addition & 0 deletions binaries/dnn_benchmark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ auto GetModel(css &daq_name, const bool allow_fp16,
#if __ANDROID_API__ >= __ANDROID_API_P__
model = builder.AllowFp16(allow_fp16).Compile(compile_preference);
#else
(void) allow_fp16;
model = builder.Compile(compile_preference);
#endif
return model;
Expand Down
4 changes: 4 additions & 0 deletions ci/adb_push_and_run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#! /usr/bin/env bash

# echo "${@:2}"
adb push $1 /data/local/tmp/`basename $1` && adb shell "data/local/tmp/`basename $1` ${@:2}"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
54 changes: 54 additions & 0 deletions ci/build_aar.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#! /usr/bin/env bash

set -e

nproc=$(ci/get_cores.sh)
if [[ "$OSTYPE" == "darwin"* ]]; then
echo "The system is Mac OS X, alias sed to gsed"
export PATH="/usr/local/opt/gnu-sed/libexec/gnubin:$PATH"
echo "Output of sed -v:"
sed --version
fi

MY_ANDROID_HOME="${ANDROID_HOME:-$HOME/Android/Sdk}"
MY_ANDROID_NDK_HOME="${ANDROID_NDK_HOME:-$MY_ANDROID_HOME/ndk-bundle}"
JNI_BUILD_DIR=build_jni_tmp
rm -rf ${JNI_BUILD_DIR} && mkdir ${JNI_BUILD_DIR} && pushd ${JNI_BUILD_DIR}
cmake -DCMAKE_SYSTEM_NAME=Android -DCMAKE_TOOLCHAIN_FILE=${MY_ANDROID_NDK_HOME}/build/cmake/android.toolchain.cmake -DANDROID_CPP_FEATURES=exceptions -DANDROID_PLATFORM=android-27 -DANDROID_ABI=arm64-v8a -DDNN_BUILD_JNI=ON -DDNN_BUILD_BIN=OFF ..
cmake --build . --target daq-jni -- -j$nproc
popd
mkdir -p ci/android_aar/dnnlibrary/src/main/jniLibs/arm64-v8a
cp ${JNI_BUILD_DIR}/dnnlibrary/libdaq-jni.so ci/android_aar/dnnlibrary/src/main/jniLibs/arm64-v8a/

# Increase version code and update version name

echo "Build source branch: $BUILD_SOURCEBRANCH"

if (($# == 0)); then
if [[ $BUILD_SOURCEBRANCH == refs/tags/v* ]]; then
ver=`echo $BUILD_SOURCEBRANCH | cut -c 12-`
else
echo "HEAD is not tagged as a version, skip deploy aar"
exit 0
fi
elif (( $# == 1 )); then
ver=$1
fi
echo "ver=$ver"

sed -i -E "s/versionName .+/versionName \"v$ver\"/" ci/android_aar/dnnlibrary/build.gradle
sed -i -E "s/publishVersion = .+/publishVersion = \'$ver\'/" ci/android_aar/dnnlibrary/build.gradle

cat ci/android_aar/dnnlibrary/build.gradle

pushd ci/android_aar
ANDROID_HOME=$MY_ANDROID_HOME ./gradlew clean build

# Publishing is only for myself
if [[ -z $BINTRAY_KEY ]]; then
echo "BINTRAY_KEY is not set, skip bintray upload"
else
echo "Publishing.."
ANDROID_HOME=$MY_ANDROID_HOME ./gradlew bintrayUpload -PbintrayUser=daquexian566 -PbintrayKey=$BINTRAY_KEY -PdryRun=false
fi
popd
6 changes: 3 additions & 3 deletions scripts/build_appimage.sh → ci/build_appimage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ wget https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/lin
wget https://github.com/linuxdeploy/linuxdeploy-plugin-appimage/releases/download/continuous/linuxdeploy-plugin-appimage-x86_64.AppImage

chmod +x linuxdeploy-*.AppImage
mkdir -p appimage/appdir/usr/bin
cp build_onnx2daq/tools/onnx2daq/onnx2daq appimage/appdir/usr/bin/
./linuxdeploy-x86_64.AppImage --appdir appimage/appdir -d appimage/onnx2daq.desktop -i appimage/onnx2daq.png --output appimage
mkdir -p ci/appimage/appdir/usr/bin
cp build_onnx2daq/tools/onnx2daq/onnx2daq ci/appimage/appdir/usr/bin/
./linuxdeploy-x86_64.AppImage --appdir ci/appimage/appdir -d ci/appimage/onnx2daq.desktop -i ci/appimage/onnx2daq.png --output appimage
mv `ls onnx2daq-*.AppImage` onnx2daq.AppImage
10 changes: 10 additions & 0 deletions ci/build_dnnlibrary.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#! /usr/bin/env bash
set -e

echo "y" | $ANDROID_HOME/tools/bin/sdkmanager --install 'ndk-bundle'
nproc=$(ci/get_cores.sh)

mkdir build_dnnlibrary && pushd build_dnnlibrary
cmake -DCMAKE_TOOLCHAIN_FILE=$ANDROID_HOME/ndk-bundle/build/cmake/android.toolchain.cmake -DANDROID_PLATFORM=android-27 -DANDROID_ABI=x86_64 -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=Release -DDNN_READ_ONNX=ON -DDNN_CUSTOM_PROTOC_EXECUTABLE=$BUILD_SOURCESDIRECTORY/protoc/bin/protoc ..
cmake --build . -- -j$nproc
popd
9 changes: 9 additions & 0 deletions ci/build_onnx2daq.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#! /usr/bin/env bash
set -e

nproc=$(ci/get_cores.sh)

mkdir build_onnx2daq && cd build_onnx2daq
cmake ..
cmake --build . -- -j$nproc
cd -
45 changes: 45 additions & 0 deletions ci/dnnlibrary_build_and_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
trigger:
branches:
include:
- master
tags:
include:
- v*
paths:
include:
- '*'
exclude:
- README.md
- docs/*
pr:
branches:
include:
- '*'
paths:
include:
- '*'
exclude:
- README.md
- docs/*

pool:
vmImage: 'macOS-10.14'
steps:
- checkout: self
submodules: true
- bash: brew install watch gnu-sed
displayName: Install watch and gnu-sed
- bash: ci/download_protoc.sh
displayName: Download protoc
- bash: ci/build_dnnlibrary.sh
displayName: Build
- bash: ci/start_android_emulator.sh
displayName: Start Android Emulator
- bash: pip3 install --user onnx
displayName: Install ONNX
- bash: ci/download_and_test_models.sh
displayName: Download And Test Models
- bash: ci/build_aar.sh
env:
BINTRAY_KEY: $(bintrayKey)
displayName: Build and Publish AAR package
20 changes: 20 additions & 0 deletions ci/download_and_test_models.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#! /usr/bin/env bash

set -e

wget "https://s3.amazonaws.com/onnx-model-zoo/squeezenet/squeezenet1.1/squeezenet1.1.tar.gz" -O squeezenet1.1.tar.gz
tar xvf squeezenet1.1.tar.gz
python3 ci/validate_onnx.py squeezenet1.1 build_dnnlibrary/binaries/dnn_retrieve_result

wget "https://s3.amazonaws.com/onnx-model-zoo/mobilenet/mobilenetv2-1.0/mobilenetv2-1.0.tar.gz" -O mobilenetv2-1.0.tar.gz
tar xvf mobilenetv2-1.0.tar.gz
python3 ci/validate_onnx.py mobilenetv2-1.0 build_dnnlibrary/binaries/dnn_retrieve_result

wget "https://s3.amazonaws.com/onnx-model-zoo/resnet/resnet18v2/resnet18v2.tar.gz" -O resnet18v2.tar.gz
tar xvf resnet18v2.tar.gz
python3 ci/validate_onnx.py resnet18v2 build_dnnlibrary/binaries/dnn_retrieve_result

wget "https://s3.amazonaws.com/download.onnx/models/opset_9/bvlc_googlenet.tar.gz" -O bvlc_googlenet.tar.gz
tar xvf bvlc_googlenet.tar.gz
python3 ci/validate_onnx.py bvlc_googlenet build_dnnlibrary/binaries/dnn_retrieve_result

5 changes: 5 additions & 0 deletions ci/download_protoc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#! /usr/bin/env bash
set -e

wget https://github.com/protocolbuffers/protobuf/releases/download/v3.7.1/protoc-3.7.1-osx-x86_64.zip -O protoc.zip
unzip protoc.zip -d protoc
5 changes: 5 additions & 0 deletions ci/get_cores.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
if [[ "$OSTYPE" == "drawin*" ]]; then
echo $(sysctl -n hw.physicalcpu)
else
echo $(nproc)
fi
Loading

0 comments on commit 4f12fe1

Please sign in to comment.