-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
azure pipeline ci init -- move files from dabnn
- Loading branch information
Showing
32 changed files
with
299 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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-21 -DANDROID_ABI=arm64-v8a -DBNN_BUILD_JNI=ON -DBNN_BUILD_TEST=OFF -DBNN_BUILD_BENCHMARK=OFF .. | ||
cmake --build . -- -j$nproc | ||
popd | ||
mkdir -p ci/android_aar/dabnn/src/main/jniLibs/arm64-v8a | ||
cp ${JNI_BUILD_DIR}/dabnn/jni/libdabnn-jni.so ci/android_aar/dabnn/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/dabnn/build.gradle | ||
sed -i -E "s/publishVersion = .+/publishVersion = \'$ver\'/" ci/android_aar/dabnn/build.gradle | ||
|
||
cat ci/android_aar/dabnn/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
wget https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage | ||
wget https://github.com/linuxdeploy/linuxdeploy-plugin-appimage/releases/download/continuous/linuxdeploy-plugin-appimage-x86_64.AppImage | ||
|
||
chmod +x linuxdeploy-*.AppImage | ||
mkdir -p ci/appimage/appdir/usr/bin | ||
cp build_onnx2bnn/tools/onnx2bnn/onnx2bnn ci/appimage/appdir/usr/bin/ | ||
./linuxdeploy-x86_64.AppImage --appdir ci/appimage/appdir -d ci/appimage/onnx2bnn.desktop -i ci/appimage/onnx2bnn.png --output appimage | ||
mv `ls onnx2bnn-*.AppImage` onnx2bnn.AppImage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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_dabnn && cd build_dabnn | ||
cmake -DCMAKE_TOOLCHAIN_FILE=$ANDROID_HOME/ndk-bundle/build/cmake/android.toolchain.cmake -DANDROID_ABI=arm64-v8a -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=Release .. | ||
cmake --build . -- -j$nproc | ||
cd - |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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_onnx2bnn && cd build_onnx2bnn | ||
cmake .. | ||
cmake --build . -- -j$nproc | ||
cd - |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
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/build_dabnn.sh | ||
displayName: Build | ||
- bash: ci/start_android_emulator.sh | ||
displayName: Start Android Emulator | ||
- bash: ci/adb_push_and_run.sh build_dabnn/tests/bconv_test | ||
displayName: Binary Conv Test | ||
- bash: ci/adb_push_and_run.sh build_dabnn/tests/bgemm_test | ||
displayName: Binary Gemm Test | ||
- bash: ci/download_models.sh | ||
displayName: Download Models | ||
- bash: ci/adb_push_and_run.sh build_dabnn/tests/net_test | ||
displayName: Model Test | ||
- bash: ci/build_aar.sh | ||
env: | ||
BINTRAY_KEY: $(bintrayKey) | ||
displayName: Build and Publish AAR package |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#! /usr/bin/env bash | ||
|
||
wget "https://drive.google.com/uc?export=download&id=1FYqF5BvYO2kl13bn28sheKtgverkbbQN" -O model_imagenet.dab | ||
adb push model_imagenet.dab /data/local/tmp | ||
wget "https://drive.google.com/uc?export=download&id=1frtRL1O0zhtJvPFbhE8COFl1-WWHIaOW" -O model_imagenet_stem.dab | ||
adb push model_imagenet_stem.dab /data/local/tmp/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
trigger: | ||
branches: | ||
include: | ||
- master | ||
tags: | ||
include: | ||
- v* | ||
paths: | ||
include: | ||
- '*' | ||
exclude: | ||
- README.md | ||
- docs/* | ||
# not trigger onnx2bnn build when only dabnn is edited | ||
- dabnn/* | ||
pr: | ||
branches: | ||
include: | ||
- '*' | ||
paths: | ||
include: | ||
- '*' | ||
exclude: | ||
- README.md | ||
- docs/* | ||
# not trigger onnx2bnn build when only dabnn is edited | ||
- dabnn/* | ||
|
||
jobs: | ||
- job: LinuxAppImage | ||
pool: | ||
vmImage: 'ubuntu-16.04' | ||
steps: | ||
- checkout: self | ||
submodules: true | ||
- script: sudo apt install -y protobuf-compiler libprotobuf-dev | ||
displayName: Install protobuf | ||
- bash: ci/build_onnx2bnn.sh | ||
displayName: Build | ||
- bash: ci/build_appimage.sh | ||
displayName: Build AppImage | ||
- task: CopyFiles@2 | ||
inputs: | ||
contents: 'onnx2bnn.AppImage' | ||
targetFolder: $(Build.ArtifactStagingDirectory) | ||
- template: template_onnx2bnn_publish_artifacts.yml | ||
- template: template_onnx2bnn_github_release.yml | ||
- job: Windows | ||
pool: | ||
vmImage: 'vs2017-win2016' | ||
steps: | ||
- checkout: self | ||
submodules: true | ||
- template: template_onnx2bnn_build_python_all_version.yml | ||
- task: CopyFiles@2 | ||
inputs: | ||
sourceFolder: '.setuptools-cmake-build\tools\onnx2bnn\Release\' | ||
contents: 'onnx2bnn.exe' | ||
targetFolder: $(Build.ArtifactStagingDirectory) | ||
- template: template_onnx2bnn_publish_artifacts.yml | ||
- template: template_onnx2bnn_github_release.yml | ||
- template: template_onnx2bnn_upload_to_pypi.yml | ||
- job: macOS | ||
pool: | ||
vmImage: 'macOS-10.14' | ||
steps: | ||
- checkout: self | ||
submodules: true | ||
- template: template_onnx2bnn_build_python_all_version.yml | ||
- script: 'cp .setuptools-cmake-build/tools/onnx2bnn/onnx2bnn .setuptools-cmake-build/tools/onnx2bnn/onnx2bnn-macos' | ||
displayName: 'Rename onnx2bnn' | ||
- task: CopyFiles@2 | ||
inputs: | ||
sourceFolder: '.setuptools-cmake-build/tools/onnx2bnn' | ||
contents: 'onnx2bnn-macos' | ||
targetFolder: $(Build.ArtifactStagingDirectory) | ||
- template: template_onnx2bnn_publish_artifacts.yml | ||
- template: template_onnx2bnn_github_release.yml | ||
- template: template_onnx2bnn_upload_to_pypi.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#! /usr/bin/env bash | ||
set -e | ||
|
||
export TERM=xterm | ||
|
||
echo "y" | $ANDROID_HOME/tools/bin/sdkmanager --install 'system-images;android-25;google_apis;arm64-v8a' | ||
|
||
echo "no" | $ANDROID_HOME/tools/bin/avdmanager create avd -n android_emulator -k 'system-images;android-25;google_apis;arm64-v8a' --force | ||
|
||
echo "Starting emulator" | ||
|
||
# Start emulator in background | ||
nohup $ANDROID_HOME/emulator/emulator -avd android_emulator -no-snapshot -no-audio & | ||
|
||
# start server in advance, so that the result of watch will only change when device gets online | ||
$ANDROID_HOME/platform-tools/adb start-server | ||
|
||
watch -g -n 1 '$ANDROID_HOME/platform-tools/adb devices | grep -c device$' | ||
|
||
echo "Emulator is online" | ||
|
||
$ANDROID_HOME/platform-tools/adb devices | ||
|
||
echo "Emulator started" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
steps: | ||
- script: python -m pip install --user --upgrade setuptools wheel twine | ||
displayName: Install setuptools, wheel and twine | ||
- script: python setup.py bdist_wheel | ||
workingDirectory: tools/onnx2bnn/python/ | ||
displayName: Build onnx2bnn python package |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
steps: | ||
- task: UsePythonVersion@0 | ||
inputs: | ||
versionSpec: '3.7' | ||
addToPath: true | ||
architecture: 'x64' | ||
- template: template_onnx2bnn_build_python.yml | ||
- task: UsePythonVersion@0 | ||
inputs: | ||
versionSpec: '3.6' | ||
addToPath: true | ||
architecture: 'x64' | ||
- template: template_onnx2bnn_build_python.yml | ||
- task: UsePythonVersion@0 | ||
inputs: | ||
versionSpec: '3.5' | ||
addToPath: true | ||
architecture: 'x64' | ||
- template: template_onnx2bnn_build_python.yml | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
steps: | ||
- task: GitHubRelease@0 | ||
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v')) | ||
inputs: | ||
gitHubConnection: 'dabnn release' | ||
repositoryName: '$(Build.Repository.Name)' | ||
action: 'edit' | ||
tag: '$(Build.SourceBranchName)' | ||
target: '$(Build.SourceVersion)' | ||
assets: '$(Build.ArtifactStagingDirectory)/*' | ||
assetUploadMode: 'replace' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
steps: | ||
- task: PublishBuildArtifacts@1 | ||
inputs: | ||
pathtoPublish: $(Build.ArtifactStagingDirectory) | ||
artifactName: onnx2bnn | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
steps: | ||
- script: python -m twine upload dist/* --verbose | ||
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v')) | ||
displayName: Upload wheel to PyPI | ||
workingDirectory: tools/onnx2bnn/python/ | ||
env: | ||
TWINE_USERNAME: $(twineUsername) | ||
TWINE_PASSWORD: $(twinePassword) | ||
|