|
| 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 | + workflow_call: |
| 10 | + inputs: |
| 11 | + workflow_branch: |
| 12 | + description: "Branch for ci-gha-workflow repository" |
| 13 | + default: "main" |
| 14 | + required: false |
| 15 | + type: string |
| 16 | + |
| 17 | +concurrency: |
| 18 | + group: OCV-PR-Linux-${{ github.ref }} |
| 19 | + cancel-in-progress: true |
| 20 | + |
| 21 | +jobs: |
| 22 | + branch_eval: |
| 23 | + runs-on: ubuntu-latest |
| 24 | + outputs: |
| 25 | + branches: ${{ steps.determine-branches.outputs.branches }} |
| 26 | + steps: |
| 27 | + - id: determine-branches |
| 28 | + shell: bash |
| 29 | + run: | |
| 30 | + if [ "${{ github.event.repository.name == 'ci-gha-workflow' }}" = "true" ] ; then |
| 31 | + echo "branches=[ '4.x', '5.x' ]" >> "$GITHUB_OUTPUT" |
| 32 | + else |
| 33 | + echo "branches=[ '${{ github.base_ref }}' ]" >> "$GITHUB_OUTPUT" |
| 34 | + fi |
| 35 | +
|
| 36 | + Ubuntu: |
| 37 | + # runs-on: opencv-ru-lin-riscv |
| 38 | + runs-on: opencv-cn-lin-x86-64 |
| 39 | + needs: |
| 40 | + - branch_eval |
| 41 | + strategy: |
| 42 | + # Debugging |
| 43 | + # fail-fast: true |
| 44 | + # max-parallel: 3 |
| 45 | + fail-fast: false |
| 46 | + max-parallel: 3 |
| 47 | + matrix: |
| 48 | + version: |
| 49 | + - '24.04' |
| 50 | + - '22.04' |
| 51 | + - '20.04' |
| 52 | + branch: ${{ fromJSON(needs.branch_eval.outputs.branches )}} |
| 53 | + include: |
| 54 | + - version: '24.04' |
| 55 | + image: '24.04:20241031' |
| 56 | + jpegxl: true |
| 57 | + avx2: true |
| 58 | + - version: '22.04' |
| 59 | + image: '22.04:20230602' |
| 60 | + plugins: true |
| 61 | + - version: '20.04' |
| 62 | + image: '20.04:20230413' |
| 63 | + limited_api: true |
| 64 | + |
| 65 | + defaults: |
| 66 | + run: |
| 67 | + shell: bash |
| 68 | + container: |
| 69 | + image: 'quay.io/opencv-ci/opencv-ubuntu-${{ matrix.image }}' |
| 70 | + volumes: |
| 71 | + # - /mnt/cache/git_cache:/opt/git_cache |
| 72 | + # - /mnt/cache/ci_cache/opencv:/opt/.ccache |
| 73 | + # - /mnt/cache/binaries_cache:/opt/binaries_cache |
| 74 | + # - vol_dnn_models:/opt/dnn-models |
| 75 | + - /home/opencv-cn/git_cache:/opt/git_cache |
| 76 | + - /home/opencv-cn/ci_cache/opencv:/opt/.ccache |
| 77 | + - /home/opencv-cn/binaries_cache:/opt/binaries_cache |
| 78 | + - /home/opencv-cn/dnn-models:/opt/dnn-models |
| 79 | + options: '--user root:root' |
| 80 | + env: |
| 81 | + ANT_HOME: '/usr/share/ant' |
| 82 | + DNN_MODELS: '/opt/dnn-models' |
| 83 | + CCACHE_DIR: '/opt/.ccache' |
| 84 | + OPENCV_DOWNLOAD_PATH: '/opt/binaries_cache' |
| 85 | + CMAKE_OPT: >- |
| 86 | + -DBUILD_DOCS=ON |
| 87 | + -DBUILD_EXAMPLES=ON |
| 88 | + -DOPENCV_ENABLE_NONFREE=ON |
| 89 | + ${{ matrix.jpegxl && '-DWITH_JPEGXL=ON' }} |
| 90 | + ${{ matrix.avx2 && '-DCPU_BASELINE=AVX2'}} |
| 91 | + ${{ matrix.plugins && '-DVIDEOIO_PLUGIN_LIST=all -DHIGHGUI_PLUGIN_LIST=all' }} |
| 92 | + ${{ matrix.limited_api && '-DPYTHON3_LIMITED_API=ON' }} |
| 93 | + HOME: ${{ contains(matrix.image, '24.04') && '/home/ubuntu' || '/home/ci' }} |
| 94 | + OPENCV_FOR_THREADS_NUM: 8 |
| 95 | + CMAKE_BUILD_PARALLEL_LEVEL: 8 |
| 96 | + |
| 97 | + # ========== |
| 98 | + |
| 99 | + steps: |
| 100 | + |
| 101 | + - name: Checkout workflow repository |
| 102 | + uses: actions/checkout@v4 |
| 103 | + with: |
| 104 | + repository: opencv/ci-gha-workflow |
| 105 | + ref: ${{ github.repository == 'opencv/ci-gha-workflow' && github.ref || inputs.workflow_branch }} |
| 106 | + |
| 107 | + - name: Checkout and merge OpenCV |
| 108 | + uses: ./checkout-and-merge |
| 109 | + with: |
| 110 | + target_branch: ${{ matrix.branch }} |
| 111 | + author: ${{ github.event.pull_request.user.login }} |
| 112 | + source_branch: ${{ github.event.repository.name == 'ci-gha-workflow' && '' || github.head_ref }} |
| 113 | + gitcache: '/opt/git_cache' |
| 114 | + home: '${{ env.HOME }}' |
| 115 | + workdir: '${{ env.HOME }}' |
| 116 | + |
| 117 | + - name: Update extra dnn models |
| 118 | + timeout-minutes: 60 |
| 119 | + working-directory: '${{ env.HOME }}' |
| 120 | + run: | |
| 121 | + python3 opencv_extra/testdata/dnn/download_models.py \ |
| 122 | + --cleanup \ |
| 123 | + --dst '${{ env.DNN_MODELS }}/dnn' |
| 124 | + echo "OPENCV_DNN_TEST_DATA_PATH=${{ env.DNN_MODELS }}" >> $GITHUB_ENV |
| 125 | +
|
| 126 | + - name: Configure and build OpenCV |
| 127 | + uses: ./configure-and-build |
| 128 | + with: |
| 129 | + workdir: '${{ env.HOME }}' |
| 130 | + builddir: 'build' |
| 131 | + generator: 'Ninja' |
| 132 | + options: '${{ env.CMAKE_OPT }}' |
| 133 | + |
| 134 | + - name: Configure and build OpenCV with contrib |
| 135 | + uses: ./configure-and-build |
| 136 | + with: |
| 137 | + workdir: '${{ env.HOME }}' |
| 138 | + builddir: 'build-contrib' |
| 139 | + generator: 'Ninja' |
| 140 | + options: '-DOPENCV_EXTRA_MODULES_PATH=opencv_contrib/modules ${{ env.CMAKE_OPT }}' |
| 141 | + |
| 142 | + - name: Run OpenCV tests |
| 143 | + uses: ./run-tests |
| 144 | + env: |
| 145 | + OPENCV_TEST_DATA_PATH: '${{ env.HOME }}/opencv_extra/testdata' |
| 146 | + OPENCV_TEST_REQUIRE_DATA: 1 |
| 147 | + OPENCV_TEST_CHECK_OPTIONAL_DATA: 1 |
| 148 | + PYTHONPATH: '${{ env.HOME }}/build/python_loader:$PYTHONPATH' |
| 149 | + with: |
| 150 | + workdir: '${{ env.HOME }}' |
| 151 | + builddir: 'build' |
| 152 | + suite: "linux-${{ matrix.branch }}" |
| 153 | + filter: "[ 'ubuntu-common', ${{ matrix.avx2 && '''ubuntu-avx2''' }} ]" |
| 154 | + enable_python: "true" |
| 155 | + enable_java: "true" |
| 156 | + suffix: '${{ matrix.version }}_${{ matrix.branch }}' |
0 commit comments