.gitlab-ci.yml 4.8 KB
Newer Older
Y
yejianwu 已提交
1
stages:
L
Liangliang He 已提交
2
  - cpplint
L
Liangliang He 已提交
3
  - pycodestyle
L
Liangliang He 已提交
4
  - docs
L
liutuo 已提交
5 6
  - platform_compatible_tests
  - ndk_versions_compatible_tests
Y
yejianwu 已提交
7
  - ops_test
L
liuqi 已提交
8
  - api_test
L
liuqi 已提交
9
  - python_tools_tests
Y
yejianwu 已提交
10
  - ops_benchmark
Y
yejianwu 已提交
11
  - extra_tests
12 13 14 15 16

cpplint:
  stage: cpplint
  script:
    - curl -o cpplint.py https://raw.githubusercontent.com/google/styleguide/gh-pages/cpplint/cpplint.py
L
Liangliang He 已提交
17 18 19 20 21 22
    - python cpplint.py --linelength=80 --counting=detailed $(find mace -name "*.h" -or -name "*.cc")

pycodestyle:
  stage: pycodestyle
  script:
    - pycodestyle $(find -name "*.py")
Y
yejianwu 已提交
23

L
Liangliang He 已提交
24 25 26 27 28 29
docs:
  stage: docs
  script:
    - cd docs
    - make html
    - CI_LATEST_OUTPUT_PATH=/mace-build-output/$CI_PROJECT_NAME/latest
L
Liangliang He 已提交
30 31
    - CI_JOB_OUTPUT_PATH=/mace-build-output/$CI_PROJECT_NAME/$CI_PIPELINE_ID
    - rm -rf $CI_JOB_OUTPUT_PATH
L
Liangliang He 已提交
32 33 34 35 36 37 38 39 40 41
    - mkdir -p $CI_JOB_OUTPUT_PATH
    - cp -r _build/html $CI_JOB_OUTPUT_PATH/docs
    - rm -rf $CI_LATEST_OUTPUT_PATH
    - mkdir -p $CI_LATEST_OUTPUT_PATH
    - cp -r _build/html $CI_LATEST_OUTPUT_PATH/docs

  artifacts:
    paths:
      - docs/_build

Y
yejianwu 已提交
42 43 44
ops_test:
  stage: ops_test
  script:
L
Liangliang He 已提交
45
    - if [ -z "$TARGET_SOCS" ]; then TARGET_SOCS=random; fi
L
liuqi 已提交
46
    - python tools/bazel_adb_run.py --target="//mace/ops:ops_test" --run_target=True --stdout_processor=unittest_stdout_processor --target_abis=armeabi-v7a,arm64-v8a --target_socs=$TARGET_SOCS
李寅 已提交
47
    - python tools/bazel_adb_run.py --target="//mace/ops:ops_test" --run_target=True --stdout_processor=unittest_stdout_processor --target_abis=armeabi-v7a,arm64-v8a --target_socs=$TARGET_SOCS --enable_neon=false
L
liuqi 已提交
48 49 50 51 52 53

api_test:
  stage: api_test
  script:
    - if [ -z "$TARGET_SOCS" ]; then TARGET_SOCS=random; fi
    - python tools/bazel_adb_run.py --target="//mace/test:mace_api_test" --run_target=True --stdout_processor=unittest_stdout_processor --target_abis=armeabi-v7a,arm64-v8a --target_socs=$TARGET_SOCS
54
    - python tools/bazel_adb_run.py --target="//mace/test:mace_api_mt_test" --run_target=True --stdout_processor=unittest_stdout_processor --target_abis=armeabi-v7a,arm64-v8a --target_socs=$TARGET_SOCS
Y
yejianwu 已提交
55 56 57 58

ops_benchmark:
  stage: ops_benchmark
  script:
L
Liangliang He 已提交
59
    - if [ -z "$TARGET_SOCS" ]; then TARGET_SOCS=random; fi
L
Liangliang He 已提交
60
    - python tools/bazel_adb_run.py --target="//mace/ops:ops_benchmark" --run_target=True --stdout_processor=ops_benchmark_stdout_processor --target_abis=armeabi-v7a,arm64-v8a --target_socs=$TARGET_SOCS --args="--filter=.*CONV.*"
Y
yejianwu 已提交
61 62 63 64 65

extra_tests:
  stage: extra_tests
  script:
    - if [ -z "$TARGET_SOCS" ]; then TARGET_SOCS=random; fi
L
Liangliang He 已提交
66 67
    - python tools/bazel_adb_run.py --target="//mace/kernels:kernels_test" --run_target=True --stdout_processor=unittest_stdout_processor --target_abis=armeabi-v7a,arm64-v8a --target_socs=$TARGET_SOCS
    - python tools/bazel_adb_run.py --target="//mace/utils:tuner_test" --run_target=True --stdout_processor=unittest_stdout_processor --target_abis=armeabi-v7a,arm64-v8a --target_socs=$TARGET_SOCS
李寅 已提交
68

L
liutuo 已提交
69 70
platform_compatible_tests:
  stage: platform_compatible_tests
李寅 已提交
71
  script:
Y
yejianwu 已提交
72
    - mkdir -p mace/codegen/version && bash mace/tools/git/gen_version_source.sh mace/codegen/version/version.cc
73
    - mkdir -p mace/codegen/tuning && python mace/python/tools/binary_codegen.py --output_path=mace/codegen/tuning/tuning_params.cc
李寅 已提交
74
    - bazel build mace/core:core
L
liutuo 已提交
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94

ndk_versions_compatible_tests:
  stage: ndk_versions_compatible_tests
  script:
    - DEFAULT_NDK_PATH=$ANDROID_NDK_HOME
    - prefix_path=${DEFAULT_NDK_PATH%android-ndk-*}
    - >
      for ndk in android-ndk-r12b android-ndk-r15c android-ndk-r16;
      do
      new_ndk_path=${prefix_path}${ndk};
      if [ "$new_ndk_path" != "$DEFAULT_NDK_PATH" ]; then
        export ANDROID_NDK_HOME=$new_ndk_path;
        export PATH=$ANDROID_NDK_HOME:$PATH;
        echo "ndk path: $ANDROID_NDK_HOME";
        if [ -z "$TARGET_SOCS" ]; then TARGET_SOCS=random; fi
        python tools/bazel_adb_run.py --target="//mace/ops:ops_test" --run_target=True --stdout_processor=unittest_stdout_processor --target_abis=armeabi-v7a,arm64-v8a --target_socs=$TARGET_SOCS --args="--gtest_filter=ActivationOpTest*";
        python tools/bazel_adb_run.py --target="//mace/ops:ops_test" --run_target=True --stdout_processor=unittest_stdout_processor --target_abis=armeabi-v7a,arm64-v8a --target_socs=$TARGET_SOCS --enable_neon=false --args="--gtest_filter=ActivationOpTest*";
      fi
      done
    - export ANDROID_NDK_HOME=$DEFAULT_NDK_PATH
L
liuqi 已提交
95 96 97 98 99 100 101 102 103
    - export PATH=$ANDROID_NDK_HOME:$PATH

python_tools_tests:
  stage: python_tools_tests
  script:
    - pwd
    - rm -rf mace-models
    - GIT_SSH_COMMAND="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" git clone git@v9.git.n.xiaomi.com:deep-computing/mace-models.git
    - CONF_FILE=mace-models/mobilenet-v2/mobilenet-v2.yml
L
liuqi 已提交
104
    - sh -c "python tools/converter.py build --config=${CONF_FILE} --disable_tuning && python tools/converter.py run --config=${CONF_FILE} --round=1 --validate && python tools/converter.py run --config=${CONF_FILE} --example --round=1 --validate" || exit 1
L
liuqi 已提交
105
    - rm -rf mace-models