|
| 1 | +name: OCV PR Linux |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + paths: |
| 8 | + - '.github/workflows/OCV-PR-Linux.yaml' |
| 9 | + # TODO: are following paths necessary? |
| 10 | + - 'checkout-and-merge/*' |
| 11 | + - 'configure-and-build/*' |
| 12 | + - 'run-tests/*' |
| 13 | + - 'scripts/runner.py' |
| 14 | + - 'scripts/test-plan.json' |
| 15 | + workflow_call: |
| 16 | + inputs: |
| 17 | + workflow_branch: |
| 18 | + description: "Branch for ci-gha-workflow repository" |
| 19 | + default: "main" |
| 20 | + required: false |
| 21 | + type: string |
| 22 | + |
| 23 | +concurrency: |
| 24 | + group: OCV-PR-Linux-${{ github.ref }} |
| 25 | + cancel-in-progress: true |
| 26 | + |
| 27 | +jobs: |
| 28 | + |
| 29 | + branch_eval: |
| 30 | + runs-on: ubuntu-24.04 |
| 31 | + outputs: |
| 32 | + branches: ${{ steps.determine-branches.outputs.branches }} |
| 33 | + steps: |
| 34 | + - id: determine-branches |
| 35 | + shell: bash |
| 36 | + run: | |
| 37 | + if [ "${{ github.event.repository.name == 'ci-gha-workflow' }}" = "true" ] ; then |
| 38 | + echo "branches=[ '4.x', '5.x' ]" >> "$GITHUB_OUTPUT" |
| 39 | + else |
| 40 | + echo "branches=[ '${{ github.base_ref }}' ]" >> "$GITHUB_OUTPUT" |
| 41 | + fi |
| 42 | +
|
| 43 | + Ubuntu: |
| 44 | + # runs-on: opencv-ru-lin-riscv |
| 45 | + runs-on: opencv-cn-lin-x86-64 |
| 46 | + needs: |
| 47 | + - branch_eval |
| 48 | + strategy: |
| 49 | + # NOTE: Debugging |
| 50 | + # fail-fast: true |
| 51 | + # max-parallel: 3 |
| 52 | + fail-fast: false |
| 53 | + max-parallel: 3 |
| 54 | + matrix: |
| 55 | + version: |
| 56 | + - '24.04' |
| 57 | + - '22.04' |
| 58 | + - '20.04' |
| 59 | + # TODO: enable later |
| 60 | + # - '24.04_asan' |
| 61 | + branch: ${{ fromJSON(needs.branch_eval.outputs.branches )}} |
| 62 | + include: |
| 63 | + - version: '24.04' |
| 64 | + image: '24.04:20241031' |
| 65 | + jpegxl: true |
| 66 | + avif: true |
| 67 | + avx2: true |
| 68 | + # TODO: enable later |
| 69 | + # - version: '24.04_asan' |
| 70 | + # image: '24.04:20241031' |
| 71 | + # asan: true |
| 72 | + # jpegxl: true |
| 73 | + # avif: true |
| 74 | + - version: '22.04' |
| 75 | + image: '22.04:20230602' |
| 76 | + avif: true |
| 77 | + plugins: true |
| 78 | + - version: '20.04' |
| 79 | + image: '20.04:20230413' |
| 80 | + limited_api: true |
| 81 | + |
| 82 | + defaults: |
| 83 | + run: |
| 84 | + shell: bash |
| 85 | + container: |
| 86 | + image: 'quay.io/opencv-ci/opencv-ubuntu-${{ matrix.image }}' |
| 87 | + volumes: |
| 88 | + # NOTE: RU config |
| 89 | + # - /mnt/cache/git_cache:/opt/git_cache |
| 90 | + # - /mnt/cache/ci_cache/opencv:/opt/.ccache |
| 91 | + # - /mnt/cache/binaries_cache:/opt/binaries_cache |
| 92 | + # - vol_dnn_models:/opt/dnn-models |
| 93 | + # NOTE: CN config |
| 94 | + - /home/opencv-cn/git_cache:/opt/git_cache |
| 95 | + - /home/opencv-cn/ci_cache/opencv:/opt/.ccache |
| 96 | + - /home/opencv-cn/binaries_cache:/opt/binaries_cache |
| 97 | + - /home/opencv-cn/dnn-models:/opt/dnn-models |
| 98 | + options: '--user root:root' |
| 99 | + env: |
| 100 | + ANT_HOME: '/usr/share/ant' |
| 101 | + DNN_MODELS: '/opt/dnn-models' |
| 102 | + CCACHE_DIR: '/opt/.ccache' |
| 103 | + CCACHE_MAXSIZE: '3G' |
| 104 | + OPENCV_DOWNLOAD_PATH: '/opt/binaries_cache' |
| 105 | + CMAKE_OPT: >- |
| 106 | + -DBUILD_DOCS=ON |
| 107 | + -DBUILD_EXAMPLES=ON |
| 108 | + -DOPENCV_ENABLE_NONFREE=ON |
| 109 | + -DWITH_IMGCODEC_GIF=ON |
| 110 | + ${{ matrix.jpegxl && '-DWITH_JPEGXL=ON' }} |
| 111 | + ${{ matrix.avif && '-DWITH_AVIF=ON' }} |
| 112 | + ${{ matrix.avx2 && '-DCPU_BASELINE=AVX2'}} |
| 113 | + ${{ matrix.plugins && '-DVIDEOIO_PLUGIN_LIST=all -DHIGHGUI_PLUGIN_LIST=all' }} |
| 114 | + ${{ matrix.limited_api && '-DPYTHON3_LIMITED_API=ON' }} |
| 115 | + ${{ matrix.asan && '-DENABLE_OMIT_FRAME_POINTER=OFF -DCMAKE_CXX_FLAGS="-fsanitize=address"' }} |
| 116 | + HOME: ${{ contains(matrix.image, '24.04') && '/home/ubuntu' || '/home/ci' }} |
| 117 | + MAIN_BUILD_DIR: "${{ (github.event.repository.name != 'opencv_contrib') && 'build' || 'build-contrib' }}" |
| 118 | + # NOTE: CN config |
| 119 | + OPENCV_FOR_THREADS_NUM: 8 |
| 120 | + CMAKE_BUILD_PARALLEL_LEVEL: 8 |
| 121 | + # NOTE: RU config |
| 122 | + # OPENCV_FOR_THREADS_NUM: 10 |
| 123 | + # CMAKE_BUILD_PARALLEL_LEVEL: 20 |
| 124 | + |
| 125 | + # ========== |
| 126 | + |
| 127 | + steps: |
| 128 | + |
| 129 | + - name: Checkout workflow repository |
| 130 | + uses: actions/checkout@v4 |
| 131 | + with: |
| 132 | + repository: opencv/ci-gha-workflow |
| 133 | + ref: "${{ github.repository == 'opencv/ci-gha-workflow' && github.ref || inputs.workflow_branch }}" |
| 134 | + |
| 135 | + - name: Checkout and merge OpenCV |
| 136 | + uses: ./checkout-and-merge |
| 137 | + with: |
| 138 | + target_branch: "${{ matrix.branch }}" |
| 139 | + author: "${{ github.event.pull_request.user.login }}" |
| 140 | + source_branch: "${{ github.event.repository.name == 'ci-gha-workflow' && '' || github.head_ref }}" |
| 141 | + gitcache: '/opt/git_cache' |
| 142 | + home: '${{ env.HOME }}' |
| 143 | + workdir: '${{ env.HOME }}' |
| 144 | + |
| 145 | + - name: Update extra dnn models |
| 146 | + timeout-minutes: 60 |
| 147 | + working-directory: '${{ env.HOME }}' |
| 148 | + run: | |
| 149 | + ls -lR ${{ env.DNN_MODELS }} |
| 150 | + python3 opencv_extra/testdata/dnn/download_models.py \ |
| 151 | + --cleanup \ |
| 152 | + --dst '${{ env.DNN_MODELS }}/dnn' |
| 153 | + echo "OPENCV_DNN_TEST_DATA_PATH=${{ env.DNN_MODELS }}" >> $GITHUB_ENV |
| 154 | +
|
| 155 | + - if: ${{ github.event.repository.name != 'opencv_contrib' }} |
| 156 | + name: Configure and build OpenCV |
| 157 | + uses: ./configure-and-build |
| 158 | + with: |
| 159 | + workdir: '${{ env.HOME }}' |
| 160 | + builddir: 'build' |
| 161 | + generator: 'Ninja' |
| 162 | + options: '${{ env.CMAKE_OPT }}' |
| 163 | + |
| 164 | + - name: Configure and build OpenCV with contrib |
| 165 | + uses: ./configure-and-build |
| 166 | + with: |
| 167 | + workdir: '${{ env.HOME }}' |
| 168 | + builddir: 'build-contrib' |
| 169 | + generator: 'Ninja' |
| 170 | + options: '-DOPENCV_EXTRA_MODULES_PATH=opencv_contrib/modules ${{ env.CMAKE_OPT }}' |
| 171 | + |
| 172 | + - name: Run OpenCV tests |
| 173 | + uses: ./run-tests |
| 174 | + env: |
| 175 | + OPENCV_TEST_DATA_PATH: '${{ env.HOME }}/opencv_extra/testdata' |
| 176 | + OPENCV_TEST_REQUIRE_DATA: 1 |
| 177 | + OPENCV_TEST_CHECK_OPTIONAL_DATA: 1 |
| 178 | + PYTHONPATH: '${{ env.HOME }}/${{ env.MAIN_BUILD_DIR }}/python_loader:$PYTHONPATH' |
| 179 | + # TODO: enable later |
| 180 | + # ASAN_OPTIONS: 'detect_leaks=0' |
| 181 | + with: |
| 182 | + workdir: '${{ env.HOME }}' |
| 183 | + builddir: '${{ env.MAIN_BUILD_DIR }}' |
| 184 | + plan: "test-plan-${{ matrix.branch }}.json" |
| 185 | + # NOTE: Just keeping this construction here for possible future use: |
| 186 | + # ${{ (github.event.repository.name == 'opencv_contrib') && format('''linux-contrib-{0}''', matrix.branch) || '' }} |
| 187 | + suite: "[ ${{ (github.event.repository.name == 'opencv_contrib') && '''linux-contrib''' || '''linux''' }} ]" |
| 188 | + filter: "[ 'ubuntu-common', ${{ matrix.avx2 && '''ubuntu-avx2''' }} ]" |
| 189 | + enable_python: "true" |
| 190 | + enable_java: "true" |
| 191 | + suffix: '${{ matrix.version }}_${{ matrix.branch }}' |
| 192 | + |
| 193 | + - if: ${{ always() }} |
| 194 | + name: Finalize |
| 195 | + run: | |
| 196 | + if [ "$WARNINGS" -ne 0 ]; then |
| 197 | + echo "Warnings detected. Exiting with non-zero status." |
| 198 | + exit 1 |
| 199 | + fi |
0 commit comments