From e35c53244d0e89b3f48c026e7536922b4cf44569 Mon Sep 17 00:00:00 2001 From: ByronHsu Date: Tue, 24 Jul 2018 11:54:44 +0800 Subject: [PATCH] Add MacOS support in travis and fix travis banner path. (#102) * Add MacOS support in travis * make changes according to the review * change command order * skip ops_test on mac --- .travis.yml | 70 ++++++++++++++++++++++++++++++++--------------------- README.md | 2 +- 2 files changed, 43 insertions(+), 29 deletions(-) diff --git a/.travis.yml b/.travis.yml index dcecbdc8..2c8c5bf0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,47 +1,61 @@ language: cpp -os: linux -dist: xenial -sudo: required +matrix: + include: + - os: linux + dist: xenial + sudo: required + - os: osx + osx_image: xcode7.2 + sudo: required before_install: - - sudo pip install pycodestyle + - echo "Start to test on $TRAVIS_OS_NAME"; + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export PIP=pip2; else export PIP=pip; fi + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export OS=darwin; else export OS=linux; fi + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export PYTHONPATH="/usr/local/lib/python2.7/site-packages:$PYTHONPATH"; fi + - sudo $PIP install pycodestyle - export BAZEL_VERSION=0.13.1 - - wget https://github.com/bazelbuild/bazel/releases/download/$BAZEL_VERSION/bazel-$BAZEL_VERSION-installer-linux-x86_64.sh + - wget https://github.com/bazelbuild/bazel/releases/download/$BAZEL_VERSION/bazel-$BAZEL_VERSION-installer-$OS-x86_64.sh - chmod +x bazel-*.sh - - sudo ./bazel-$BAZEL_VERSION-installer-linux-x86_64.sh - - rm -f bazel-$BAZEL_VERSION-installer-linux-x86_64.sh + - sudo ./bazel-$BAZEL_VERSION-installer-$OS-x86_64.sh + - rm -f bazel-$BAZEL_VERSION-installer-$OS-x86_64.sh - pushd /opt/ - - sudo wget -q https://dl.google.com/android/repository/android-ndk-r15c-linux-x86_64.zip - - sudo unzip -q android-ndk-r15c-linux-x86_64.zip - - sudo rm -f android-ndk-r15c-linux-x86_64.zip + - sudo wget -q https://dl.google.com/android/repository/android-ndk-r15c-$OS-x86_64.zip + - sudo unzip -q android-ndk-r15c-$OS-x86_64.zip + - sudo rm -f android-ndk-r15c-$OS-x86_64.zip - export ANDROID_NDK_VERSION=r15c - export ANDROID_NDK=/opt/android-ndk-${ANDROID_NDK_VERSION} - export ANDROID_NDK_HOME=${ANDROID_NDK} - export PATH=${PATH}:${ANDROID_NDK_HOME} - popd - - sudo apt-get update - - sudo apt-get install -y --no-install-recommends android-tools-adb - - sudo pip install setuptools - - sudo pip install -I tensorflow==1.8.0 "numpy>=1.14.0" scipy jinja2 pyyaml sh==1.12.14 pycodestyle==2.4.0 filelock + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update; brew cask install android-platform-tools; fi + - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get update; sudo apt-get install -y --no-install-recommends android-tools-adb; fi + - sudo $PIP install setuptools + - sudo $PIP install -I "tensorflow==1.8.0" "numpy>=1.14.0" "sh==1.12.14" "pycodestyle==2.4.0" filelock scipy jinja2 pyyaml script: - > echo "MACE_TEST 0: Check cpp code style"; curl -o cpplint.py https://raw.githubusercontent.com/google/styleguide/gh-pages/cpplint/cpplint.py && python cpplint.py --linelength=80 --counting=detailed $(find mace -name "*.h" -or -name "*.cc") && rm -f cpplint.py || exit 1; echo "MACE_TEST 1: Check python code style"; - pycodestyle $(find -name "*.py") || exit 1; - echo "MACE_TEST 2: Platform compatible test"; - mkdir -p mace/codegen/version && bash mace/tools/git/gen_version_source.sh mace/codegen/version/version.cc || exit 1; - mkdir -p mace/codegen/tuning && python mace/python/tools/binary_codegen.py --output_path=mace/codegen/tuning/tuning_params.cc || exit 1; - bazel build mace/core:core || exit 1; - echo "MACE_TEST 3: Ops test"; + pycodestyle $(find . -name "*.py") || exit 1; + echo "MACE_TEST 2: Ops test"; python tools/bazel_adb_run.py --target="//mace/ops:ops_test" --run_target=False --target_abis=armeabi-v7a,arm64-v8a || exit 1; - python tools/bazel_adb_run.py --target="//mace/ops:ops_test" --run_target=False --target_abis=armeabi-v7a,arm64-v8a --enable_neon=false || exit 1; - echo "MACE_TEST 4: Api test"; - python tools/bazel_adb_run.py --target="//mace/test:mace_api_test" --run_target=False --target_abis=armeabi-v7a,arm64-v8a || exit 1; - python tools/bazel_adb_run.py --target="//mace/test:mace_api_mt_test" --run_target=False --target_abis=armeabi-v7a,arm64-v8a || exit 1; - echo "MACE_TEST 5: Ops benchmark"; + if [[ "$TRAVIS_OS_NAME" != "osx" ]]; then + python tools/bazel_adb_run.py --target="//mace/ops:ops_test" --run_target=False --target_abis=armeabi-v7a,arm64-v8a --enable_neon=false || exit 1; + fi; + echo "MACE_TEST 3: Ops benchmark"; python tools/bazel_adb_run.py --target="//mace/ops:ops_benchmark" --run_target=False --target_abis=armeabi-v7a,arm64-v8a || exit 1; - echo "MACE_TEST 6: Extra test"; - python tools/bazel_adb_run.py --target="//mace/kernels:kernels_test" --run_target=False --target_abis=armeabi-v7a,arm64-v8a || exit 1; - python tools/bazel_adb_run.py --target="//mace/utils:tuner_test" --run_target=False --target_abis=armeabi-v7a,arm64-v8a || exit 1; + + if [[ "$TRAVIS_OS_NAME" != "osx" ]]; then + echo "MACE_TEST 4: Platform compatible test"; + mkdir -p mace/codegen/version && bash mace/tools/git/gen_version_source.sh mace/codegen/version/version.cc || exit 1; + mkdir -p mace/codegen/tuning && python mace/python/tools/binary_codegen.py --output_path=mace/codegen/tuning/tuning_params.cc || exit 1; + bazel build mace/core:core || exit 1; + echo "MACE_TEST 5: Api test"; + python tools/bazel_adb_run.py --target="//mace/test:mace_api_test" --run_target=False --target_abis=armeabi-v7a,arm64-v8a || exit 1; + python tools/bazel_adb_run.py --target="//mace/test:mace_api_mt_test" --run_target=False --target_abis=armeabi-v7a,arm64-v8a || exit 1; + echo "MACE_TEST 6: Extra test"; + python tools/bazel_adb_run.py --target="//mace/kernels:kernels_test" --run_target=False --target_abis=armeabi-v7a,arm64-v8a || exit 1; + python tools/bazel_adb_run.py --target="//mace/utils:tuner_test" --run_target=False --target_abis=armeabi-v7a,arm64-v8a || exit 1; + fi; \ No newline at end of file diff --git a/README.md b/README.md index 50263ebb..329304d3 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE) -[![Build Status](https://travis-ci.org/travis-ci/travis-web.svg?branch=master)](https://travis-ci.org/travis-ci/travis-web) +[![Build Status](https://travis-ci.org/XiaoMi/mace.svg?branch=master)](https://travis-ci.org/XiaoMi/mace) [![pipeline status](https://gitlab.com/llhe/mace/badges/master/pipeline.svg)](https://gitlab.com/llhe/mace/pipelines) [![doc build status](https://readthedocs.org/projects/mace/badge/?version=latest)](https://readthedocs.org/projects/mace/badge/?version=latest) -- GitLab