|
| 1 | +name: OCV PR:5.x RISC-V |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + paths: |
| 8 | + - '.github/workflows/OCV-PR-5.x-RISCV.yaml' |
| 9 | + workflow_call: |
| 10 | + |
| 11 | +concurrency: |
| 12 | + group: OCV-PR-5.x-RISCV-${{ github.ref }} |
| 13 | + cancel-in-progress: true |
| 14 | + |
| 15 | +env: |
| 16 | + EXTRA_CMAKE_OPTIONS: '-DCMAKE_TOOLCHAIN_FILE=$HOME/opencv/platforms/linux/riscv64-clang.toolchain.cmake -DBUILD_EXAMPLES=ON -DOPENCV_ENABLE_NONFREE=ON -DCPU_BASELINE=RVV -DCPU_BASELINE_REQUIRE=RVV -DRISCV_RVV_SCALABLE=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 | + CCACHE_DIR: '/home/ci/.ccache' |
| 22 | + GIT_CACHE_DOCKER: '/home/ci/git_cache' |
| 23 | + OPENCV_DOWNLOAD_PATH: '/home/ci/binaries_cache' |
| 24 | + OPENCV_TEST_DATA_PATH: '/home/ci/opencv_extra/testdata' |
| 25 | + OPENCV_CONTRIB_DOCKER_WORKDIR: '/home/ci/opencv_contrib' |
| 26 | + OPENCV_DOCKER_WORKDIR: '/home/ci/opencv' |
| 27 | + PYTHONPATH: '/home/ci/build/python_loader:$PYTHONPATH' |
| 28 | + TEST_RUNNER: '/opt/riscv/bin/qemu-riscv64 -cpu rv64,v=true,vext_spec=v1.0 -L /opt/riscv/sysroot' |
| 29 | + GIT_COMMITTER_NAME: 'nouser' |
| 30 | + GIT_COMMITTER_EMAIL: 'noemail' |
| 31 | + |
| 32 | +jobs: |
| 33 | + BuildAndTest: |
| 34 | + runs-on: opencv-ru-lin-riscv |
| 35 | + defaults: |
| 36 | + run: |
| 37 | + shell: bash |
| 38 | + container: |
| 39 | + image: quay.io/opencv-ci/opencv-ubuntu-22.04-riscv-main:20230910 |
| 40 | + volumes: |
| 41 | + - /mnt/cache/git_cache:/home/ci/git_cache |
| 42 | + - /mnt/cache/ci_cache/opencv:/home/ci/.ccache |
| 43 | + - /mnt/cache/binaries_cache:/home/ci/binaries_cache |
| 44 | + steps: |
| 45 | + - name: Brief system information |
| 46 | + timeout-minutes: 60 |
| 47 | + run: bash ${{ env.GIT_CACHE_DOCKER }}/print_system_information.sh |
| 48 | + - name: Define proper HOME path |
| 49 | + timeout-minutes: 60 |
| 50 | + run: echo "HOME=/home/ci" >> $GITHUB_ENV |
| 51 | + - name: Setup infra environment |
| 52 | + timeout-minutes: 60 |
| 53 | + if: ${{ github.event.repository.name == 'ci-gha-workflow' }} |
| 54 | + run: | |
| 55 | + echo "TARGET_BRANCH_NAME=5.x" >> $GITHUB_ENV |
| 56 | + - name: Setup test environment |
| 57 | + if: ${{ github.event.repository.name != 'ci-gha-workflow' }} |
| 58 | + run: | |
| 59 | + echo "EXTRA_GTEST_OPTIONS=--skip_unstable=1" >> $GITHUB_ENV |
| 60 | + - name: PR info |
| 61 | + timeout-minutes: 60 |
| 62 | + run: | |
| 63 | + echo "PR Author: ${{ env.PR_AUTHOR }}" |
| 64 | + echo "PR Author fork: ${{ env.PR_AUTHOR_FORK }}" |
| 65 | + echo "Source branch name: ${{ env.SOURCE_BRANCH_NAME }}" |
| 66 | + echo "Target branch name: ${{ env.TARGET_BRANCH_NAME }}" |
| 67 | + - name: Clean |
| 68 | + timeout-minutes: 60 |
| 69 | + run: find ${{ env.OPENCV_DOCKER_WORKDIR }} -mindepth 1 -delete |
| 70 | + - name: Fetch opencv |
| 71 | + timeout-minutes: 60 |
| 72 | + run: | |
| 73 | + git clone \ |
| 74 | + --branch ${{ env.TARGET_BRANCH_NAME }} \ |
| 75 | + --reference-if-able ${{ env.GIT_CACHE_DOCKER }}/opencv.git \ |
| 76 | + https://github.com/opencv/opencv.git \ |
| 77 | + ${{ env.OPENCV_DOCKER_WORKDIR }} |
| 78 | + - name: Merge opencv with ${{ env.SOURCE_BRANCH_NAME }} branch |
| 79 | + timeout-minutes: 60 |
| 80 | + if: ${{ github.event.repository.name != 'ci-gha-workflow' }} |
| 81 | + run: | |
| 82 | + git -C ${{ env.OPENCV_DOCKER_WORKDIR }} \ |
| 83 | + pull \ |
| 84 | + --no-rebase --no-ff --no-commit \ |
| 85 | + -v "https://github.com/${{ env.PR_AUTHOR_FORK }}" \ |
| 86 | + "${{ env.SOURCE_BRANCH_NAME }}" |
| 87 | + - name: Clone opencv_extra |
| 88 | + timeout-minutes: 60 |
| 89 | + run: | |
| 90 | + git clone \ |
| 91 | + --single-branch \ |
| 92 | + --branch ${{ env.TARGET_BRANCH_NAME }} \ |
| 93 | + --reference-if-able ${{ env.GIT_CACHE_DOCKER }}/opencv_extra.git \ |
| 94 | + https://github.com/opencv/opencv_extra.git \ |
| 95 | + $HOME/opencv_extra |
| 96 | + - name: Merge opencv_extra with ${{ env.SOURCE_BRANCH_NAME }} branch |
| 97 | + timeout-minutes: 60 |
| 98 | + if: ${{ github.event.repository.name != 'ci-gha-workflow' }} |
| 99 | + run: | |
| 100 | + OPENCV_EXTRA_FORK=$(git ls-remote --heads "https://github.com/${{ env.PR_AUTHOR }}/opencv_extra" "${{ env.SOURCE_BRANCH_NAME }}") || true |
| 101 | + if [[ ! -z "$OPENCV_EXTRA_FORK" ]]; then |
| 102 | + echo "Merge opencv_extra with ${{ env.SOURCE_BRANCH_NAME }} branch" |
| 103 | + cd $HOME/opencv_extra |
| 104 | + git pull --no-rebase --no-ff --no-commit -v "https://github.com/${{ env.PR_AUTHOR }}/opencv_extra" "${{ env.SOURCE_BRANCH_NAME }}" |
| 105 | + else |
| 106 | + echo "No merge since ${{ env.PR_AUTHOR }}/opencv_extra does not have branch ${{ env.SOURCE_BRANCH_NAME }}" |
| 107 | + fi |
| 108 | + - name: Configure OpenCV |
| 109 | + timeout-minutes: 60 |
| 110 | + run: | |
| 111 | + cmake -G Ninja \ |
| 112 | + -S ${{ env.OPENCV_DOCKER_WORKDIR }} \ |
| 113 | + -B $HOME/build \ |
| 114 | + ${{ env.EXTRA_CMAKE_OPTIONS }} |
| 115 | + - name: Build OpenCV |
| 116 | + timeout-minutes: 60 |
| 117 | + id: build-opencv |
| 118 | + run: | |
| 119 | + ninja -C $HOME/build | tee $HOME/build/build-log.txt |
| 120 | + - name: Warnings check |
| 121 | + timeout-minutes: 60 |
| 122 | + run: cd $HOME/build && python3 $HOME/scripts/warnings-handling.py |
| 123 | + - name: Accuracy:core |
| 124 | + timeout-minutes: 60 |
| 125 | + if: ${{ always() && steps.build-opencv.outcome == 'success' }} |
| 126 | + run: | |
| 127 | + cd $HOME/build |
| 128 | + ${{ env.TEST_RUNNER }} bin/opencv_test_core \ |
| 129 | + ${{ env.EXTRA_GTEST_OPTIONS }} \ |
| 130 | + --gtest_filter=* |
| 131 | + - name: Accuracy:imgproc |
| 132 | + timeout-minutes: 60 |
| 133 | + if: ${{ always() && steps.build-opencv.outcome == 'success' }} |
| 134 | + run: | |
| 135 | + cd $HOME/build |
| 136 | + ${{ env.TEST_RUNNER }} bin/opencv_test_imgproc \ |
| 137 | + ${{ env.EXTRA_GTEST_OPTIONS }} \ |
| 138 | + --gtest_filter=*:-Imgproc_Hist_Compare.accuracy |
| 139 | + - name: Accuracy:dnn |
| 140 | + timeout-minutes: 60 |
| 141 | + if: ${{ always() && steps.build-opencv.outcome == 'success' }} |
| 142 | + run: | |
| 143 | + cd $HOME/build |
| 144 | + ${{ env.TEST_RUNNER }} bin/opencv_test_dnn \ |
| 145 | + ${{ env.EXTRA_GTEST_OPTIONS }} \ |
| 146 | + --gtest_filter=* |
| 147 | +
|
| 148 | + BuildContrib: |
| 149 | + runs-on: opencv-ru-lin-riscv |
| 150 | + defaults: |
| 151 | + run: |
| 152 | + shell: bash |
| 153 | + container: |
| 154 | + image: quay.io/opencv-ci/opencv-ubuntu-22.04-riscv-main:20230910 |
| 155 | + volumes: |
| 156 | + - /mnt/cache/git_cache:/home/ci/git_cache |
| 157 | + - /mnt/cache/ci_cache/opencv:/home/ci/.ccache |
| 158 | + - /mnt/cache/binaries_cache:/home/ci/binaries_cache |
| 159 | + steps: |
| 160 | + - name: Brief system information |
| 161 | + timeout-minutes: 60 |
| 162 | + run: bash ${{ env.GIT_CACHE_DOCKER }}/print_system_information.sh |
| 163 | + - name: Define proper HOME path |
| 164 | + timeout-minutes: 60 |
| 165 | + run: echo "HOME=/home/ci" >> $GITHUB_ENV |
| 166 | + - name: Setup infra environment |
| 167 | + timeout-minutes: 60 |
| 168 | + if: ${{ github.event.repository.name == 'ci-gha-workflow' }} |
| 169 | + run: echo "TARGET_BRANCH_NAME=5.x" >> $GITHUB_ENV |
| 170 | + - name: PR info |
| 171 | + timeout-minutes: 60 |
| 172 | + run: | |
| 173 | + echo "PR Author: ${{ env.PR_AUTHOR }}" |
| 174 | + echo "PR Author fork: ${{ env.PR_AUTHOR_FORK }}" |
| 175 | + echo "Source branch name: ${{ env.SOURCE_BRANCH_NAME }}" |
| 176 | + echo "Target branch name: ${{ env.TARGET_BRANCH_NAME }}" |
| 177 | + - name: Clean |
| 178 | + timeout-minutes: 60 |
| 179 | + run: find ${{ env.OPENCV_DOCKER_WORKDIR }} -mindepth 1 -delete |
| 180 | + - name: Fetch opencv |
| 181 | + timeout-minutes: 60 |
| 182 | + run: | |
| 183 | + git clone \ |
| 184 | + --branch ${{ env.TARGET_BRANCH_NAME }} \ |
| 185 | + --reference-if-able ${{ env.GIT_CACHE_DOCKER }}/opencv.git \ |
| 186 | + https://github.com/opencv/opencv.git \ |
| 187 | + ${{ env.OPENCV_DOCKER_WORKDIR }} |
| 188 | + - name: Merge opencv with a test branch |
| 189 | + timeout-minutes: 60 |
| 190 | + if: ${{ github.event.repository.name != 'ci-gha-workflow' }} |
| 191 | + run: | |
| 192 | + git -C ${{ env.OPENCV_DOCKER_WORKDIR }} \ |
| 193 | + pull \ |
| 194 | + --no-rebase --no-ff --no-commit \ |
| 195 | + -v "https://github.com/${{ env.PR_AUTHOR_FORK }}" \ |
| 196 | + "${{ env.SOURCE_BRANCH_NAME }}" |
| 197 | + - name: Clone opencv_contrib |
| 198 | + timeout-minutes: 60 |
| 199 | + run: | |
| 200 | + git clone \ |
| 201 | + --single-branch \ |
| 202 | + --branch ${{ env.TARGET_BRANCH_NAME }} \ |
| 203 | + --reference-if-able ${{ env.GIT_CACHE_DOCKER }}/opencv_contrib.git \ |
| 204 | + https://github.com/opencv/opencv_contrib.git \ |
| 205 | + $HOME/opencv_contrib |
| 206 | + - name: Merge opencv_contrib with ${{ env.SOURCE_BRANCH_NAME }} branch |
| 207 | + timeout-minutes: 60 |
| 208 | + if: ${{ github.event.repository.name != 'ci-gha-workflow' }} |
| 209 | + run: | |
| 210 | + OPENCV_CONTRIB_FORK=$(git ls-remote --heads "https://github.com/${{ env.PR_AUTHOR }}/opencv_contrib" "${{ env.SOURCE_BRANCH_NAME }}") || true |
| 211 | + if [[ ! -z "$OPENCV_CONTRIB_FORK" ]]; then |
| 212 | + echo "Merge opencv_contrib with ${{ env.SOURCE_BRANCH_NAME }} branch" |
| 213 | + cd $HOME/opencv_contrib |
| 214 | + git pull --no-rebase --no-ff --no-commit -v "https://github.com/${{ env.PR_AUTHOR }}/opencv_contrib" "${{ env.SOURCE_BRANCH_NAME }}" |
| 215 | + else |
| 216 | + echo "No merge since ${{ env.PR_AUTHOR }}/opencv_contrib does not have branch ${{ env.SOURCE_BRANCH_NAME }}" |
| 217 | + fi |
| 218 | + - name: Configure OpenCV Contrib |
| 219 | + timeout-minutes: 60 |
| 220 | + run: | |
| 221 | + cmake -G Ninja \ |
| 222 | + -S ${{ env.OPENCV_DOCKER_WORKDIR }} \ |
| 223 | + -B $HOME/build \ |
| 224 | + -DOPENCV_EXTRA_MODULES_PATH=$HOME/opencv_contrib/modules \ |
| 225 | + ${{ env.EXTRA_CMAKE_OPTIONS }} |
| 226 | + - name: Build OpenCV Contrib |
| 227 | + timeout-minutes: 60 |
| 228 | + run: | |
| 229 | + ninja -C $HOME/build | tee $HOME/build/build-log.txt |
| 230 | + - name: Warnings check |
| 231 | + timeout-minutes: 60 |
| 232 | + run: cd $HOME/build && python3 $HOME/scripts/warnings-handling.py |
0 commit comments