build-and-test.yml 15.1 KB
Newer Older
D
daquexian 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142
name: Build and test

on:
  push:
    branches: [tengine-lite]
    paths:
    paths-ignore: 
    - 'doc/**'
    - 'README.md'
    - 'README_EN.md'
  pull_request:
    branches: [tengine-lite]
    paths-ignore: 
    - 'doc/**'
    - 'README.md'
    - 'README_EN.md'

jobs:
  android-armv7-cpu:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2.3.4
    - 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-cpu:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2.3.4
    - 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

  linux-armv7-cpu-gcc:
    runs-on: ubuntu-20.04
    steps:
    - uses: actions/checkout@v2.3.4

    - name: cache-qemu
      id: cache-qemu
      uses: actions/cache@v2.1.6
      with:
        path: qemu-install
        key: qemu-arm-install-1
    - name: checkout-qemu
      if: steps.cache-qemu.outputs.cache-hit != 'true'
      uses: actions/checkout@v2.3.4
      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 ftp://219.139.34.182/tengine/ci_test/models.zip
        unzip models.zip
        wget ftp://219.139.34.182/tengine/ci_test/arm32_data.zip
        unzip arm32_data.zip
        mv arm32_data data
        wget ftp://219.139.34.182/tengine/ci_test/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-armv8-cpu-gcc:
    runs-on: ubuntu-20.04
    steps:
    - uses: actions/checkout@v2.3.4

    - name: cache-qemu
      id: cache-qemu
      uses: actions/cache@v2.1.6
      with:
        path: qemu-install
        key: qemu-aarch64-install-1
    - name: checkout-qemu
      if: steps.cache-qemu.outputs.cache-hit != 'true'
      uses: actions/checkout@v2.3.4
      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 ftp://219.139.34.182/tengine/ci_test/models.zip
        unzip models.zip
        wget ftp://219.139.34.182/tengine/ci_test/arm64_data.zip
        unzip arm64_data.zip
        mv arm64_data data
        wget ftp://219.139.34.182/tengine/ci_test/images.zip
        unzip images.zip
    - name: test
      run: |
        export PATH=$GITHUB_WORKSPACE/qemu-install/bin:$PATH
        chmod +x ./tests/test_arm64.sh
        cd build
        ../tests/test_arm64.sh

reachfoo's avatar
reachfoo 已提交
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191
  linux-armv8-cpu-gcc-timvx:
    runs-on: khadas-vim3
    steps:
    - uses: actions/checkout@v2.3.4
    - name: tim-vx
      run: |
        git clone https://github.com/VeriSilicon/TIM-VX.git
        cp -rvf ./TIM-VX/include  ./source/device/tim-vx/
        cp -rvf ./TIM-VX/src      ./source/device/tim-vx/
        rm ./source/device/tim-vx/src/tim/vx/*_test.cc
        rm ./source/device/tim-vx/src/tim/vx/ops/*_test.cc
    - name: configure
      run: mkdir build && cd build && cmake -GNinja -DTENGINE_BUILD_TESTS=ON -DTENGINE_ENABLE_TIM_VX=ON ..
    - name: build
      run: cmake --build build -j 6
    - name: models
      run: |
        cd build
        actions=/home/khadas/actions-runner
        ln -s ${actions}/ci_test/models/      models
        ln -s ${actions}/ci_test/images/      images
        ln -s ${actions}/ci_test/arm64_data/  data
    - name: test
      run: |
        chmod +x ./tests/test_arm64_real.sh
        cd build
        ../tests/test_arm64_real.sh
        
  linux-armv8-cpu-gcc-AGX-Xaiver:
    runs-on: AGX-xaiver
    steps:
    - uses: actions/checkout@v2.3.4
    - name: configure
      run: mkdir build && cd build && cmake -GNinja -DTENGINE_BUILD_TESTS=ON -DTENGINE_ENABLE_TENSORRT=ON ..
    - name: build
      run: cmake --build build -j 8
    - name: models
      run: |
        cd build
        actions=/home/nvidia/actions-runner
        ln -s ${actions}/ci_test/models/      models
        ln -s ${actions}/ci_test/images/      images
        ln -s ${actions}/ci_test/arm64_data/  data
    - name: test
      run: |
        chmod +x ./tests/test_arm64_real.sh
        cd build
        ../tests/test_arm64_real.sh
        
D
daquexian 已提交
192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477
  linux-gcc-mipsisa64r6el:
    runs-on: ubuntu-20.04
    steps:
    - name: cancel-previous-runs
      uses: styfle/cancel-workflow-action@0.9.1
      with:
        access_token: ${{ secrets.GITHUB_TOKEN }}
    - uses: actions/checkout@v2.3.4

    - name: cache-qemu
      id: cache-qemu
      uses: actions/cache@v2.1.6
      with:
        path: qemu-install
        key: qemu-mips64el-install-1
    - name: checkout-qemu
      if: steps.cache-qemu.outputs.cache-hit != 'true'
      uses: actions/checkout@v2.3.4
      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=mips64el-linux-user --disable-system
        make -j2
        make install
        cp -r mips64el-linux-user/install $GITHUB_WORKSPACE/qemu-install

    - name: mipsisa64r6el-gnuabi64-toolchain
      run: |
        sudo apt-get update
        sudo apt-get install g++-mipsisa64r6el-linux-gnuabi64

    - name: configure
      run: mkdir build && cd build && cmake -DCMAKE_TOOLCHAIN_FILE=../toolchains/mipsisa64r6el-linux-gnuabi64.toolchain.cmake -DTENGINE_BUILD_EXAMPLES=OFF ..
    - name: build
      run: cmake --build build -j 2

  windows-x64-cpu-vs2017:
    runs-on: windows-2016
    steps:
    - uses: actions/checkout@v2.3.4
    - 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

  windows-x64-cpu-vs2019:
    runs-on: windows-latest
    steps:
    - uses: actions/checkout@v2.3.4
    - name: build
      run: |
        mkdir build; cd build
        cmake -A x64 -DTENGINE_BUILD_EXAMPLES=OFF ..
        cmake --build . --config Release -j 2

  windows-x86-cpu-vs2017:
    runs-on: windows-2016
    steps:
    - uses: actions/checkout@v2.3.4
    - 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

  windows-x86-cpu-vs2019:
    runs-on: windows-latest
    steps:
    - uses: actions/checkout@v2.3.4
    - name: build
      run: |
        mkdir build; cd build
        cmake -T v142,host=x64 -A Win32 -DTENGINE_BUILD_EXAMPLES=OFF ..
        cmake --build . --config Release -j 2

  linux-x64-cpu-timvx-gcc:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2.3.4
    - 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/
        rm ./source/device/tim-vx/src/tim/vx/*_test.cc
        rm ./source/device/tim-vx/src/tim/vx/ops/*_test.cc
    - name: configure
      run: mkdir build && cd build && cmake -DTENGINE_ENABLE_TIM_VX=ON ..
    - name: build
      run: cmake --build build -j 2

  linux-x64-cpu-gcc:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2.3.4
    - name: update
      run: sudo apt-get update
    - name: depends
      run: sudo apt-get install libprotobuf-dev protobuf-compiler libopencv-dev
    - name: configure
      run: mkdir build && cd build && cmake -DTENGINE_BUILD_TESTS=ON ..
    - name: build
      run: cmake --build build -j 2
    - name: optest
      run: |
        cd build
        git clone https://github.com/BUG1989/onnx_op_test_data.git
        mv onnx_op_test_data onnx_node
        export TG_DEBUG_REF=1
        ctest --output-on-failure
    - name: test-data
      run: |
        cd build
        wget ftp://219.139.34.182/tengine/ci_test/models.zip
        unzip models.zip
        wget ftp://219.139.34.182/tengine/ci_test/x86_data.zip
        unzip x86_data.zip
        mv x86_data data
        wget ftp://219.139.34.182/tengine/ci_test/images.zip
        unzip images.zip
        git clone https://github.com/BUG1989/onnx_op_test_data.git
        mv onnx_op_test_data onnx_node            
    - name: test-models
      run: |
        chmod +x ./tests/test.sh
        cd build
        ../tests/test.sh
    - name: test-op
      run: |
        cd build
        export TG_DEBUG_REF=1
        ctest --output-on-failure       

  linux-x64-cpu-clang:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2.3.4
    - name: update
      run: sudo apt-get update
    - name: depends
      run: sudo apt-get install libprotobuf-dev protobuf-compiler 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: test-data
      run: |
        cd build
        wget ftp://219.139.34.182/tengine/ci_test/models.zip
        unzip models.zip
        wget ftp://219.139.34.182/tengine/ci_test/x86_data.zip
        unzip x86_data.zip
        mv x86_data data
        wget ftp://219.139.34.182/tengine/ci_test/images.zip
        unzip images.zip
        git clone https://github.com/BUG1989/onnx_op_test_data.git
        mv onnx_op_test_data onnx_node            
    - name: test-models
      run: |
        chmod +x ./tests/test.sh
        cd build
        ../tests/test.sh
    - name: test-op
      run: |
        cd build
        export TG_DEBUG_REF=1
        ctest --output-on-failure        
        
  linux-x64-cpu-tools-convert:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2.3.4
    - uses: actions/checkout@v2.3.4
      with:
        repository: protocolbuffers/protobuf
        ref: v3.17.3
        path: protobuf
        submodules: recursive
    - name: Build AppImage
      run: |
        docker run --network=host --env PROTOBUF_REPO_DIR=$PWD/protobuf -v $PWD:$PWD -w $PWD --privileged --ipc=host centos:7 $PWD/.github/workflows/build-package-and-test-convert-tools.sh
    - name: Install dependencies for test
      run: |
        sudo apt-get update
        sudo apt-get install libopencv-dev
    - name: Configure
      run: mkdir build && cd build && cmake -DTENGINE_BUILD_TESTS=ON ..
    - name: Build test
      run: cmake --build build -j 2          
    - name: Download and unzip test data
      run: |
        cd build
        wget ftp://219.139.34.182/tengine/ci_test/model_test_convert/onnx_models.zip
        unzip onnx_models.zip
        wget ftp://219.139.34.182/tengine/ci_test/model_test_convert/onnx_models_output.zip
        unzip onnx_models_output.zip
    - name: Run tests
      run: |
        chmod +x ./tests/test_onnx_model.sh
        cd build
        ../tests/test_onnx_model.sh ../convert_tool-x86_64.AppImage
    - name: Upload AppImage
      uses: actions/upload-artifact@v2
      with:
        name: convert_tool_AppImage
        path: convert_tool-x86_64.AppImage

  linux-x64-cpu-tools-quant:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2.3.4
    - uses: actions/checkout@v2.3.4
      with:
        repository: opencv/opencv
        ref: 4.5.3
        path: opencv
        submodules: recursive
    - name: Build AppImage
      run: |
        docker run --network=host --env OPENCV_REPO_DIR=$PWD/opencv -v $PWD:$PWD -w $PWD --privileged --ipc=host centos:7 $PWD/.github/workflows/build-quant-tool-appimage.sh
    - name: update
      run: sudo apt-get update
    - name: opencv
      run: sudo apt-get install libopencv-dev
    - name: configure
      run: mkdir build && cd build && cmake -DTENGINE_BUILD_EXAMPLES=ON ..
    - name: build
      run: cmake --build build -j 2
    - name: depends
      run: |
        git clone https://github.com/BUG1989/tengine_test_data.git
        cp ./tengine_test_data/mobilenet.tmfile ./
        cp -rf ./tengine_test_data/dataset ./
        wget ftp://219.139.34.182/tengine/ci_test/images.zip
        unzip images.zip
    - name: quant-tools-test
      run: |
        ./quant_tool_uint8-x86_64.AppImage -m mobilenet.tmfile -o mobilenet_uint8.tmfile -i ./dataset -g 3,224,224 -s 0.017,0.017,0.017 -c 1
    - name: uint8-model-test
      run: |
        ./build/examples/tm_classification_uint8 -m mobilenet_uint8.tmfile -i images/cat.jpg -g 224,224 -s 0.017,0.017,0.017
    - name: Upload AppImage
      uses: actions/upload-artifact@v2
      with:
        name: quant_tool_AppImage
        path: quant_tool_uint8-x86_64.AppImage

  publish-releases:
    runs-on: ubuntu-latest
    if: github.ref == 'refs/heads/tengine-lite'
    needs: [linux-x64-cpu-tools-convert, linux-x64-cpu-tools-quant]
    steps:
    - uses: actions/checkout@v2.3.4
    - uses: actions/download-artifact@v2
      with:
        path: artifacts
    - name: Display structure of downloaded files
      run: ls -R
      working-directory: artifacts
    - uses: "marvinpinto/action-automatic-releases@latest"
      with:
        repo_token: "${{ secrets.GITHUB_TOKEN }}"
        automatic_release_tag: "latest"
        prerelease: true
        title: "Development Build"
        files: |
          artifacts/**/*.AppImage