|
| 1 | +name: OCV Contrib PR:4.x O22 CANN |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + paths: |
| 8 | + - '.github/workflows/OCV-Contrib-PR-4.x-O22-CANN.yaml' |
| 9 | + workflow_call: |
| 10 | + |
| 11 | +concurrency: |
| 12 | + group: OCV-Contrib-PR-4.x-O22-CANN-${{ github.ref }} |
| 13 | + cancel-in-progress: true |
| 14 | + |
| 15 | +env: |
| 16 | + EXTRA_CMAKE_OPTIONS: '-DBUILD_DOCS=ON -DPYTHON_DEFAULT_EXECUTABLE=/usr/bin/python3 -DOPENCV_DOWNLOAD_PATH=/home/ci/binaries_cache -DBUILD_EXAMPLES=ON -DOPENCV_ENABLE_NONFREE=ON -DWITH_CANN=ON' |
| 17 | + PR_AUTHOR: ${{ github.event.pull_request.user.login }} |
| 18 | + PR_AUTHOR_FORK: ${{ github.event.pull_request.head.repo.full_name }} |
| 19 | + SOURCE_BRANCH_NAME: ${{ github.head_ref }} |
| 20 | + TARGET_BRANCH_NAME: ${{ github.base_ref }} |
| 21 | + GIT_CACHE_DOCKER: '/home/ci/git_cache' |
| 22 | + OPENCV_TEST_DATA_PATH: '/home/ci/opencv_extra/testdata' |
| 23 | + OPENCV_CONTRIB_DOCKER_WORKDIR: '/home/ci/opencv_contrib' |
| 24 | + PARALLEL_JOBS: 8 |
| 25 | + |
| 26 | +jobs: |
| 27 | + BuildAndTest: |
| 28 | + runs-on: opencv-cn-openeuler-ascend310-x86-64 |
| 29 | + defaults: |
| 30 | + run: |
| 31 | + shell: bash |
| 32 | + container: |
| 33 | + image: quay.io/opencv-ci/opencv-openeuler-22.03.sp2-ascend310:20231107 |
| 34 | + options: --device /dev/davinci0 --device /dev/davinci_manager --device /dev/devmm_svm --device /dev/hisi_hdc --env-file /home/opencv-cn/git_cache/proxy |
| 35 | + volumes: |
| 36 | + - /home/opencv-cn/git_cache:/home/ci/git_cache |
| 37 | + - /home/opencv-cn/ci_cache/opencv:/home/ci/.ccache |
| 38 | + - /home/opencv-cn/binaries_cache:/home/ci/binaries_cache |
| 39 | + - /usr/local/dcmi:/usr/local/dcmi |
| 40 | + - /usr/local/bin/npu-smi:/usr/local/bin/npu-smi |
| 41 | + - /usr/local/Ascend/driver/lib64/:/usr/local/Ascend/driver/lib64/ |
| 42 | + |
| 43 | + steps: |
| 44 | + - name: Brief system information |
| 45 | + timeout-minutes: 60 |
| 46 | + run: bash ${{ env.GIT_CACHE_DOCKER }}/print_system_information.sh |
| 47 | + - name: Define proper HOME path |
| 48 | + timeout-minutes: 60 |
| 49 | + run: echo "HOME=/home/ci" >> $GITHUB_ENV |
| 50 | + - name: Setup infra environment |
| 51 | + timeout-minutes: 60 |
| 52 | + if: ${{ github.event.repository.name == 'ci-gha-workflow' }} |
| 53 | + run: echo "TARGET_BRANCH_NAME=4.x" >> $GITHUB_ENV |
| 54 | + - name: Setup test environment |
| 55 | + if: ${{ github.event.repository.name != 'ci-gha-workflow' }} |
| 56 | + run: echo "EXTRA_GTEST_OPTIONS=--skip_unstable=1" >> $GITHUB_ENV |
| 57 | + - name: PR info |
| 58 | + timeout-minutes: 60 |
| 59 | + run: | |
| 60 | + echo "PR Author: ${{ env.PR_AUTHOR }}" |
| 61 | + echo "PR Author fork: ${{ env.PR_AUTHOR_FORK }}" |
| 62 | + echo "Source branch name: ${{ env.SOURCE_BRANCH_NAME }}" |
| 63 | + echo "Target branch name: ${{ env.TARGET_BRANCH_NAME }}" |
| 64 | + - name: Clean |
| 65 | + timeout-minutes: 60 |
| 66 | + run: find ${{ env.OPENCV_CONTRIB_DOCKER_WORKDIR }} -mindepth 1 -delete |
| 67 | + - name: Fetch opencv_contrib |
| 68 | + timeout-minutes: 60 |
| 69 | + run: git clone --branch ${{ env.TARGET_BRANCH_NAME }} --reference ${{ env.GIT_CACHE_DOCKER }}/opencv_contrib.git https://github.com/opencv/opencv_contrib.git ${{ env.OPENCV_CONTRIB_DOCKER_WORKDIR }} |
| 70 | + - name: Merge opencv_contrib with ${{ env.SOURCE_BRANCH_NAME }} branch |
| 71 | + timeout-minutes: 60 |
| 72 | + if: ${{ github.event.repository.name != 'ci-gha-workflow' }} |
| 73 | + run: | |
| 74 | + cd ${{ env.OPENCV_CONTRIB_DOCKER_WORKDIR }} |
| 75 | + git pull -v "https://github.com/${{ env.PR_AUTHOR_FORK }}" "${{ env.SOURCE_BRANCH_NAME }}" |
| 76 | + - name: Clone opencv |
| 77 | + timeout-minutes: 60 |
| 78 | + run: git clone --single-branch --branch ${{ env.TARGET_BRANCH_NAME }} --reference ${{ env.GIT_CACHE_DOCKER }}/opencv.git https://github.com/opencv/opencv.git $HOME/opencv |
| 79 | + - name: Merge opencv with ${{ env.SOURCE_BRANCH_NAME }} branch |
| 80 | + timeout-minutes: 60 |
| 81 | + if: ${{ github.event.repository.name != 'ci-gha-workflow' }} |
| 82 | + run: | |
| 83 | + OPENCV_FORK=$(git ls-remote --heads "https://github.com/${{ env.PR_AUTHOR }}/opencv" "${{ env.SOURCE_BRANCH_NAME }}") || true |
| 84 | + if [[ ! -z "$OPENCV_FORK" ]]; then |
| 85 | + echo "Merge opencv with ${{ env.SOURCE_BRANCH_NAME }} branch" |
| 86 | + cd $HOME/opencv |
| 87 | + git pull -v "https://github.com/${{ env.PR_AUTHOR }}/opencv" "${{ env.SOURCE_BRANCH_NAME }}" |
| 88 | + else |
| 89 | + echo "No merge since ${{ env.PR_AUTHOR }}/opencv does not have branch ${{ env.SOURCE_BRANCH_NAME }}" |
| 90 | + fi |
| 91 | + - name: Clone opencv_extra |
| 92 | + timeout-minutes: 60 |
| 93 | + run: git clone --single-branch --branch ${{ env.TARGET_BRANCH_NAME }} --reference ${{ env.GIT_CACHE_DOCKER }}/opencv_extra.git https://github.com/opencv/opencv_extra.git $HOME/opencv_extra |
| 94 | + - name: Merge opencv_extra with ${{ env.SOURCE_BRANCH_NAME }} branch |
| 95 | + timeout-minutes: 60 |
| 96 | + if: ${{ github.event.repository.name != 'ci-gha-workflow' }} |
| 97 | + run: | |
| 98 | + OPENCV_EXTRA_FORK=$(git ls-remote --heads "https://github.com/${{ env.PR_AUTHOR }}/opencv_extra" "${{ env.SOURCE_BRANCH_NAME }}") || true |
| 99 | + if [[ ! -z "$OPENCV_EXTRA_FORK" ]]; then |
| 100 | + echo "Merge opencv_extra with ${{ env.SOURCE_BRANCH_NAME }} branch" |
| 101 | + cd $HOME/opencv_extra |
| 102 | + git pull -v "https://github.com/${{ env.PR_AUTHOR }}/opencv_extra" "${{ env.SOURCE_BRANCH_NAME }}" |
| 103 | + else |
| 104 | + echo "No merge since ${{ env.PR_AUTHOR }}/opencv_extra does not have branch ${{ env.SOURCE_BRANCH_NAME }}" |
| 105 | + fi |
| 106 | + - name: Configure OpenCV |
| 107 | + timeout-minutes: 60 |
| 108 | + run: | |
| 109 | + cd $HOME/build |
| 110 | + cmake -G Ninja ${{ env.EXTRA_CMAKE_OPTIONS }} -DOPENCV_EXTRA_MODULES_PATH=${{ env.OPENCV_CONTRIB_DOCKER_WORKDIR }}/modules $HOME/opencv |
| 111 | + - name: Build OpenCV |
| 112 | + timeout-minutes: 60 |
| 113 | + id: build-opencv-contrib |
| 114 | + run: | |
| 115 | + cd $HOME/build |
| 116 | + cmake --build . --target opencv_test_cannops -j ${{ env.PARALLEL_JOBS }} | tee $HOME/build/build-log.txt |
| 117 | + - name: Accuracy:cannops |
| 118 | + timeout-minutes: 60 |
| 119 | + if: ${{ always() && steps.build-opencv-contrib.outcome == 'success' }} |
| 120 | + run: cd $HOME/build && xvfb-run -a bin/opencv_test_cannops --test_threads=${{ env.PARALLEL_JOBS }} ${{ env.EXTRA_GTEST_OPTIONS }} |
0 commit comments