From d9c719940ed4d45f6e3466bd02bbc695b4e3b7fe Mon Sep 17 00:00:00 2001 From: BUG1989 <248857878@qq.com> Date: Sun, 2 May 2021 00:48:57 +0800 Subject: [PATCH] update ci, split the workflow file, add compilation test of vs2017 and vs2019 on x86_64 (#638) * update ci * fix error of ci on vs2017 * fix error of ci on vs2017 and add vs2019 * add the x86 platform for ci with vs17 vs19 --- .github/workflows/android-armv7-cpu.yml | 13 ++ .github/workflows/android-armv8-cpu.yml | 13 ++ .github/workflows/linux-armv7-cpu-gcc.yml | 57 ++++++ .github/workflows/linux-armv8-cpu-gcc.yml | 58 ++++++ .github/workflows/linux-x64-cpu-clang.yml | 36 ++++ .github/workflows/linux-x64-cpu-gcc.yml | 32 ++++ .github/workflows/linux-x64-cpu-timvx-gcc.yml | 28 +++ .github/workflows/windows-x64-cpu-vs2017.yml | 14 ++ .github/workflows/windows-x64-cpu-vs2019.yml | 14 ++ .github/workflows/windows-x86-cpu-vs2017.yml | 14 ++ .github/workflows/windows-x86-cpu-vs2019.yml | 14 ++ .github/workflows/workflows.yml | 180 ------------------ doc/compile.md | 21 +- 13 files changed, 304 insertions(+), 190 deletions(-) create mode 100644 .github/workflows/android-armv7-cpu.yml create mode 100644 .github/workflows/android-armv8-cpu.yml create mode 100644 .github/workflows/linux-armv7-cpu-gcc.yml create mode 100644 .github/workflows/linux-armv8-cpu-gcc.yml create mode 100644 .github/workflows/linux-x64-cpu-clang.yml create mode 100644 .github/workflows/linux-x64-cpu-gcc.yml create mode 100644 .github/workflows/linux-x64-cpu-timvx-gcc.yml create mode 100644 .github/workflows/windows-x64-cpu-vs2017.yml create mode 100644 .github/workflows/windows-x64-cpu-vs2019.yml create mode 100644 .github/workflows/windows-x86-cpu-vs2017.yml create mode 100644 .github/workflows/windows-x86-cpu-vs2019.yml delete mode 100644 .github/workflows/workflows.yml diff --git a/.github/workflows/android-armv7-cpu.yml b/.github/workflows/android-armv7-cpu.yml new file mode 100644 index 00000000..18986eb8 --- /dev/null +++ b/.github/workflows/android-armv7-cpu.yml @@ -0,0 +1,13 @@ +name: android-armv7-cpu + +on: [push, pull_request] + +jobs: + android-armv7-cpu: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - name: configure + run: mkdir build && cd build && cmake -DCMAKE_TOOLCHAIN_FILE=$ANDROID_HOME/ndk-bundle/build/cmake/android.toolchain.cmake -DANDROID_ABI="armeabi-v7a" -DANDROID_PLATFORM=android-19 .. + - name: build + run: cmake --build build -j 2 diff --git a/.github/workflows/android-armv8-cpu.yml b/.github/workflows/android-armv8-cpu.yml new file mode 100644 index 00000000..644302ef --- /dev/null +++ b/.github/workflows/android-armv8-cpu.yml @@ -0,0 +1,13 @@ +name: android-armv8-cpu + +on: [push, pull_request] + +jobs: + android-armv8-cpu: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - name: configure + run: mkdir build && cd build && cmake -DCMAKE_TOOLCHAIN_FILE=$ANDROID_HOME/ndk-bundle/build/cmake/android.toolchain.cmake -DANDROID_ABI="arm64-v8a" -DANDROID_PLATFORM=android-21 .. + - name: build + run: cmake --build build -j 2 diff --git a/.github/workflows/linux-armv7-cpu-gcc.yml b/.github/workflows/linux-armv7-cpu-gcc.yml new file mode 100644 index 00000000..d83805e9 --- /dev/null +++ b/.github/workflows/linux-armv7-cpu-gcc.yml @@ -0,0 +1,57 @@ +name: linux-armv7-cpu-gcc + +on: [push, pull_request] + +jobs: + linux-armv7-cpu-gcc: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + + - name: cache-qemu + id: cache-qemu + uses: actions/cache@v1 + with: + path: qemu-install + key: qemu-arm-install-1 + - name: checkout-qemu + if: steps.cache-qemu.outputs.cache-hit != 'true' + uses: actions/checkout@v2 + with: + repository: qemu/qemu + path: qemu + ref: 8746309137ba470d1b2e8f5ce86ac228625db940 + - name: qemu + if: steps.cache-qemu.outputs.cache-hit != 'true' + run: | + cd qemu + ./configure --prefix=install --target-list=arm-linux-user --disable-system + make -j2 + make install + cp -r arm-linux-user/install $GITHUB_WORKSPACE/qemu-install + + - name: arm-gnu-toolchain + run: | + sudo apt-get update + sudo apt-get install g++-arm-linux-gnueabi + + - name: configure + run: mkdir build && cd build && cmake -DCMAKE_TOOLCHAIN_FILE=../toolchains/arm-linux-gnueabi.toolchain.cmake -DTENGINE_BUILD_TESTS=ON .. + - name: build + run: cmake --build build -j 2 + - name: models + run: | + cd build + wget http://198.55.120.234/lite/models.zip + unzip models.zip + wget http://198.55.120.234/lite/arm32_data.zip + unzip arm32_data.zip + mv arm32_data data + wget http://198.55.120.234/lite/images.zip + unzip images.zip + - name: test + run: | + export PATH=$GITHUB_WORKSPACE/qemu-install/bin:$PATH + chmod +x ./tests/test_arm32.sh + cd build + ../tests/test_arm32.sh diff --git a/.github/workflows/linux-armv8-cpu-gcc.yml b/.github/workflows/linux-armv8-cpu-gcc.yml new file mode 100644 index 00000000..9074891f --- /dev/null +++ b/.github/workflows/linux-armv8-cpu-gcc.yml @@ -0,0 +1,58 @@ +name: linux-armv8-cpu-gcc + +on: [push, pull_request] + +jobs: + linux-armv8-cpu-gcc: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + + - name: cache-qemu + id: cache-qemu + uses: actions/cache@v1 + with: + path: qemu-install + key: qemu-aarch64-install-1 + - name: checkout-qemu + if: steps.cache-qemu.outputs.cache-hit != 'true' + uses: actions/checkout@v2 + with: + repository: qemu/qemu + path: qemu + ref: 8746309137ba470d1b2e8f5ce86ac228625db940 + - name: qemu + if: steps.cache-qemu.outputs.cache-hit != 'true' + run: | + cd qemu + ./configure --prefix=install --target-list=aarch64-linux-user --disable-system + make -j2 + make install + cp -r aarch64-linux-user/install $GITHUB_WORKSPACE/qemu-install + + - name: aarch64-gnu-toolchain + run: | + sudo apt-get update + sudo apt-get install g++-aarch64-linux-gnu + + - name: configure + run: mkdir build && cd build && cmake -DCMAKE_TOOLCHAIN_FILE=../toolchains/aarch64-linux-gnu.toolchain.cmake -DTENGINE_BUILD_TESTS=ON .. + - name: build + run: cmake --build build -j 2 + - name: models + run: | + cd build + wget http://198.55.120.234/lite/models.zip + unzip models.zip + wget http://198.55.120.234/lite/arm64_data.zip + unzip arm64_data.zip + mv arm64_data data + wget http://198.55.120.234/lite/images.zip + unzip images + - name: test + run: | + export PATH=$GITHUB_WORKSPACE/qemu-install/bin:$PATH + chmod +x ./tests/test_arm64.sh + cd build + ../tests/test_arm64.sh + \ No newline at end of file diff --git a/.github/workflows/linux-x64-cpu-clang.yml b/.github/workflows/linux-x64-cpu-clang.yml new file mode 100644 index 00000000..3605e88b --- /dev/null +++ b/.github/workflows/linux-x64-cpu-clang.yml @@ -0,0 +1,36 @@ +name: linux-x64-cpu-clang + +on: [push, pull_request] + +jobs: + linux-x64-cpu-clang: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - name: update + run: sudo apt-get update + - name: protobuf + run: sudo apt-get install libopencv-dev + - name: configure + env: + CC: clang + CXX: clang++ + run: mkdir build && cd build && cmake -DTENGINE_BUILD_TESTS=ON .. + - name: build + run: cmake --build build -j 2 + - name: models + run: | + cd build + wget http://198.55.120.234/lite/models.zip + unzip models.zip + wget http://198.55.120.234/lite/x86_data.zip + unzip x86_data.zip + mv x86_data data + wget http://198.55.120.234/lite/images.zip + unzip images.zip + - name: test + run: | + chmod +x ./tests/test.sh + cd build + ../tests/test.sh + \ No newline at end of file diff --git a/.github/workflows/linux-x64-cpu-gcc.yml b/.github/workflows/linux-x64-cpu-gcc.yml new file mode 100644 index 00000000..26b3fdc2 --- /dev/null +++ b/.github/workflows/linux-x64-cpu-gcc.yml @@ -0,0 +1,32 @@ +name: linux-x64-cpu-gcc + +on: [push, pull_request] + +jobs: + linux-x64-cpu-gcc: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - name: update + run: sudo apt-get update + - name: protobuf + run: sudo apt-get install libopencv-dev + - name: configure + run: mkdir build && cd build && cmake -DTENGINE_BUILD_TESTS=ON .. + - name: build + run: cmake --build build -j 2 + - name: models + run: | + cd build + wget http://198.55.120.234/lite/models.zip + unzip models.zip + wget http://198.55.120.234/lite/x86_data.zip + unzip x86_data.zip + mv x86_data data + wget http://198.55.120.234/lite/images.zip + unzip images.zip + - name: test + run: | + chmod +x ./tests/test.sh + cd build + ../tests/test.sh diff --git a/.github/workflows/linux-x64-cpu-timvx-gcc.yml b/.github/workflows/linux-x64-cpu-timvx-gcc.yml new file mode 100644 index 00000000..53e97ffc --- /dev/null +++ b/.github/workflows/linux-x64-cpu-timvx-gcc.yml @@ -0,0 +1,28 @@ +name: linux-x64-cpu-timvx-gcc + +on: [push, pull_request] + +jobs: + linux-x64-cpu-timvx-gcc: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - name: update + run: sudo apt-get update + - name: protobuf + run: sudo apt-get install libopencv-dev + - name: tim-vx + run: | + git clone https://github.com/VeriSilicon/TIM-VX.git + export LD_LIBRARY_PATH=${PWD}/3rdparty/tim-vx/lib/x86_64 + mkdir -p ./3rdparty/tim-vx/include + mkdir -p ./3rdparty/tim-vx/lib/x86_64 + cp -rvf ./TIM-VX/prebuilt-sdk/x86_64_linux/include/* ./3rdparty/tim-vx/include/ + cp -rvf ./TIM-VX/prebuilt-sdk/x86_64_linux/lib/* ./3rdparty/tim-vx/lib/x86_64/ + cp -rvf ./TIM-VX/include ./source/device/tim-vx/ + cp -rvf ./TIM-VX/src ./source/device/tim-vx/ + - name: configure + run: mkdir build && cd build && cmake -DTENGINE_ENABLE_TIM_VX=ON .. + - name: build + run: cmake --build build -j 2 + diff --git a/.github/workflows/windows-x64-cpu-vs2017.yml b/.github/workflows/windows-x64-cpu-vs2017.yml new file mode 100644 index 00000000..f558b1f4 --- /dev/null +++ b/.github/workflows/windows-x64-cpu-vs2017.yml @@ -0,0 +1,14 @@ +name: windows-x64-cpu-vs2017 + +on: [push, pull_request] + +jobs: + windows-x64-cpu-vs2017: + runs-on: windows-2016 + steps: + - uses: actions/checkout@v1 + - name: build + run: | + mkdir build; cd build + cmake -T v141,host=x64 -A x64 -DTENGINE_OPENMP=OFF -DTENGINE_BUILD_EXAMPLES=OFF .. + cmake --build . --config Release -j 2 diff --git a/.github/workflows/windows-x64-cpu-vs2019.yml b/.github/workflows/windows-x64-cpu-vs2019.yml new file mode 100644 index 00000000..6cbed3d3 --- /dev/null +++ b/.github/workflows/windows-x64-cpu-vs2019.yml @@ -0,0 +1,14 @@ +name: windows-x64-cpu-vs2019 + +on: [push, pull_request] + +jobs: + windows-x64-cpu-vs2019: + runs-on: windows-latest + steps: + - uses: actions/checkout@v1 + - name: build + run: | + mkdir build; cd build + cmake -A x64 -DTENGINE_OPENMP=OFF -DTENGINE_BUILD_EXAMPLES=OFF .. + cmake --build . --config Release -j 2 diff --git a/.github/workflows/windows-x86-cpu-vs2017.yml b/.github/workflows/windows-x86-cpu-vs2017.yml new file mode 100644 index 00000000..c2c25c35 --- /dev/null +++ b/.github/workflows/windows-x86-cpu-vs2017.yml @@ -0,0 +1,14 @@ +name: windows-x86-cpu-vs2017 + +on: [push, pull_request] + +jobs: + windows-x86-cpu-vs2017: + runs-on: windows-2016 + steps: + - uses: actions/checkout@v1 + - name: build + run: | + mkdir build; cd build + cmake -T v141,host=x64 -A Win32 -DTENGINE_OPENMP=OFF -DTENGINE_BUILD_EXAMPLES=OFF .. + cmake --build . --config Release -j 2 diff --git a/.github/workflows/windows-x86-cpu-vs2019.yml b/.github/workflows/windows-x86-cpu-vs2019.yml new file mode 100644 index 00000000..e8a28af8 --- /dev/null +++ b/.github/workflows/windows-x86-cpu-vs2019.yml @@ -0,0 +1,14 @@ +name: windows-x86-cpu-vs2019 + +on: [push, pull_request] + +jobs: + windows-x86-cpu-vs2019: + runs-on: windows-latest + steps: + - uses: actions/checkout@v1 + - name: build + run: | + mkdir build; cd build + cmake -T v142,host=x64 -A Win32 -DTENGINE_OPENMP=OFF -DTENGINE_BUILD_EXAMPLES=OFF .. + cmake --build . --config Release -j 2 diff --git a/.github/workflows/workflows.yml b/.github/workflows/workflows.yml deleted file mode 100644 index 34e404f7..00000000 --- a/.github/workflows/workflows.yml +++ /dev/null @@ -1,180 +0,0 @@ -name: tengine-lite-actions - -on: [push, pull_request] - -jobs: - linux-gcc-x86: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v1 - - name: update - run: sudo apt-get update - - name: protobuf - run: sudo apt-get install libopencv-dev - - name: configure - run: mkdir build && cd build && cmake -DTENGINE_BUILD_TESTS=ON .. - - name: build - run: cmake --build build -j 2 - - name: models - run: | - cd build - wget http://198.55.120.234/lite/models.zip - unzip models.zip - wget http://198.55.120.234/lite/x86_data.zip - unzip x86_data.zip - mv x86_data data - wget http://198.55.120.234/lite/images.zip - unzip images.zip - - name: test - run: | - chmod +x ./tests/test.sh - cd build - ../tests/test.sh - - - linux-gcc-arm32: - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v2 - - - name: cache-qemu - id: cache-qemu - uses: actions/cache@v1 - with: - path: qemu-install - key: qemu-arm-install-1 - - name: checkout-qemu - if: steps.cache-qemu.outputs.cache-hit != 'true' - uses: actions/checkout@v2 - with: - repository: qemu/qemu - path: qemu - ref: 8746309137ba470d1b2e8f5ce86ac228625db940 - - name: qemu - if: steps.cache-qemu.outputs.cache-hit != 'true' - run: | - cd qemu - ./configure --prefix=install --target-list=arm-linux-user --disable-system - make -j2 - make install - cp -r arm-linux-user/install $GITHUB_WORKSPACE/qemu-install - - name: arm-gnu-toolchain - run: | - sudo apt-get update - sudo apt-get install g++-arm-linux-gnueabi - - name: configure - run: mkdir build && cd build && cmake -DCMAKE_TOOLCHAIN_FILE=../toolchains/arm-linux-gnueabi.toolchain.cmake -DTENGINE_BUILD_TESTS=ON .. - - name: build - run: cmake --build build -j 2 - - name: models - run: | - cd build - wget http://198.55.120.234/lite/models.zip - unzip models.zip - wget http://198.55.120.234/lite/arm32_data.zip - unzip arm32_data.zip - mv arm32_data data - wget http://198.55.120.234/lite/images.zip - unzip images.zip - - name: test - run: | - export PATH=$GITHUB_WORKSPACE/qemu-install/bin:$PATH - chmod +x ./tests/test_arm32.sh - cd build - ../tests/test_arm32.sh - - - linux-gcc-aarch64: - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v2 - - - name: cache-qemu - id: cache-qemu - uses: actions/cache@v1 - with: - path: qemu-install - key: qemu-aarch64-install-1 - - name: checkout-qemu - if: steps.cache-qemu.outputs.cache-hit != 'true' - uses: actions/checkout@v2 - with: - repository: qemu/qemu - path: qemu - ref: 8746309137ba470d1b2e8f5ce86ac228625db940 - - name: qemu - if: steps.cache-qemu.outputs.cache-hit != 'true' - run: | - cd qemu - ./configure --prefix=install --target-list=aarch64-linux-user --disable-system - make -j2 - make install - cp -r aarch64-linux-user/install $GITHUB_WORKSPACE/qemu-install - - name: aarch64-gnu-toolchain - run: | - sudo apt-get update - sudo apt-get install g++-aarch64-linux-gnu - - name: configure - run: mkdir build && cd build && cmake -DCMAKE_TOOLCHAIN_FILE=../toolchains/aarch64-linux-gnu.toolchain.cmake -DTENGINE_BUILD_TESTS=ON .. - - name: build - run: cmake --build build -j 2 - - name: models - run: | - cd build - wget http://198.55.120.234/lite/models.zip - unzip models.zip - wget http://198.55.120.234/lite/arm64_data.zip - unzip arm64_data.zip - mv arm64_data data - wget http://198.55.120.234/lite/images.zip - unzip images - - name: test - run: | - export PATH=$GITHUB_WORKSPACE/qemu-install/bin:$PATH - chmod +x ./tests/test_arm64.sh - cd build - ../tests/test_arm64.sh - - - linux-gcc-x86-timvx-simulator: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v1 - - name: update - run: sudo apt-get update - - name: protobuf - run: sudo apt-get install libopencv-dev - - name: tim-vx - run: | - git clone https://github.com/VeriSilicon/TIM-VX.git - export LD_LIBRARY_PATH=${PWD}/3rdparty/tim-vx/lib/x86_64 - mkdir -p ./3rdparty/tim-vx/include - mkdir -p ./3rdparty/tim-vx/lib/x86_64 - cp -rvf ./TIM-VX/prebuilt-sdk/x86_64_linux/include/* ./3rdparty/tim-vx/include/ - cp -rvf ./TIM-VX/prebuilt-sdk/x86_64_linux/lib/* ./3rdparty/tim-vx/lib/x86_64/ - cp -rvf ./TIM-VX/include ./source/device/tim-vx/ - cp -rvf ./TIM-VX/src ./source/device/tim-vx/ - - name: configure - run: mkdir build && cd build && cmake -DTENGINE_ENABLE_TIM_VX=ON .. - - name: build - run: cmake --build build -j 2 - - - android-armv7-a: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v1 - - name: configure - run: mkdir build && cd build && cmake -DCMAKE_TOOLCHAIN_FILE=$ANDROID_HOME/ndk-bundle/build/cmake/android.toolchain.cmake -DANDROID_ABI="armeabi-v7a" -DANDROID_PLATFORM=android-19 .. - - name: build - run: cmake --build build -j 2 - - - android-armv8-a: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v1 - - name: configure - run: mkdir build && cd build && cmake -DCMAKE_TOOLCHAIN_FILE=$ANDROID_HOME/ndk-bundle/build/cmake/android.toolchain.cmake -DANDROID_ABI="arm64-v8a" -DANDROID_PLATFORM=android-21 .. - - name: build - run: cmake --build build -j 2 diff --git a/doc/compile.md b/doc/compile.md index da8e8705..ca1e52cb 100644 --- a/doc/compile.md +++ b/doc/compile.md @@ -21,16 +21,14 @@ ### 1.1 下载 Tengine Lite 源码 -下载 Tengine Lite 源码,位于 Tengine 的分支 tengine-lite 上: - ```bash -git clone -b tengine-lite https://github.com/OAID/Tengine.git Tengine-Lite +git clone https://github.com/OAID/Tengine.git tengine-lite ``` ### 1.2 编译 Tengine Lite ```bash -cd Tengine-Lite +cd tengine-lite mkdir build cd build cmake .. @@ -57,7 +55,7 @@ install ### 2.1 下载源码 ```bash -git clone -b tengine-lite https://github.com/OAID/Tengine.git Tengine-Lite +git clone https://github.com/OAID/Tengine.git tengine-lite ``` ### 2.2 安装交叉编译工具链 @@ -104,9 +102,12 @@ make install ### 3.1 安装 Android NDK -传送门 http://developer.android.com/ndk/downloads/index.html +下载 Android NDK http://developer.android.com/ndk/downloads/index.html 并安装,例如: -比如我把 android-ndk 解压到 /home/openailab/android-ndk-r18b +``` +unzip android-ndk-r21d-linux-x86_64.zip +export ANDROID_NDK= +``` ### 3.2 准备 android toolchain 文件 @@ -125,7 +126,7 @@ list(APPEND ANDROID_COMPILER_FLAGS ### 3.3 下载 Tengine Lite 源码 ```bash -git clone -b tengine-lite https://github.com/OAID/Tengine.git Tengine-Lite +git clone https://github.com/OAID/Tengine.git tengine-lite ``` ### 3.4 编译 Tengine Lite @@ -135,7 +136,7 @@ Arm64 Android 编译命令如下: ```bash mkdir build-android-aarch64 cd build-android-aarch64 -cmake -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build-android-aarch64/cmake/android.toolchain.cmake -DANDROID_ABI="arm64-v8a" -DANDROID_PLATFORM=android-21 .. +cmake -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake -DANDROID_ABI="arm64-v8a" -DANDROID_PLATFORM=android-21 .. make make install ``` @@ -197,7 +198,7 @@ list(APPEND ANDROID_COMPILER_FLAGS ### 5.3 下载 Tengine Lite 源码 ```bash -git clone -b tengine-lite https://github.com/OAID/Tengine.git Tengine-Lite +git clone https://github.com/OAID/Tengine.git tengine-lite ``` ### 5.4 编译 Tengine Lite -- GitLab