|
| 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 | + Ubuntu: |
| 36 | + runs-on: opencv-cn-lin-x86-64 |
| 37 | + needs: |
| 38 | + - branch_eval |
| 39 | + strategy: |
| 40 | + fail-fast: false |
| 41 | + max-parallel: 2 |
| 42 | + matrix: |
| 43 | + version: |
| 44 | + - '24.04' |
| 45 | + - '22.04' |
| 46 | + - '20.04' |
| 47 | + branch: ${{ fromJSON(needs.branch_eval.outputs.branches )}} |
| 48 | + include: |
| 49 | + - version: '24.04' |
| 50 | + image: '24.04:20241031' |
| 51 | + - version: '22.04' |
| 52 | + image: '22.04:20230602' |
| 53 | + - version: '20.04' |
| 54 | + image: '20.04:20230413' |
| 55 | + - version: '24.04' |
| 56 | + jpegxl: "true" |
| 57 | + - branch: '4.x' |
| 58 | + amodules: 'calib3d core dnn features2d flann gapi highgui imgcodecs imgproc ml objdetect photo stitching video videoio' |
| 59 | + pmodules: 'calib3d core dnn features2d gapi imgcodecs imgproc objdetect photo stitching video videoio' |
| 60 | + - branch: '5.x' |
| 61 | + amodules: '3d core dnn features flann gapi highgui imgcodecs imgproc ml objdetect photo stitching video videoio' |
| 62 | + pmodules: '3d core dnn features gapi imgcodecs imgproc objdetect photo stitching video videoio' |
| 63 | + defaults: |
| 64 | + run: |
| 65 | + shell: bash |
| 66 | + container: |
| 67 | + image: 'quay.io/opencv-ci/opencv-ubuntu-${{ matrix.image }}' |
| 68 | + volumes: |
| 69 | + - /home/opencv-cn/git_cache:/opt/git_cache |
| 70 | + - /home/opencv-cn/ci_cache/opencv:/opt/.ccache |
| 71 | + - /home/opencv-cn/binaries_cache:/opt/binaries_cache |
| 72 | + - /home/opencv-cn/dnn-models:/opt/dnn-models |
| 73 | + env: |
| 74 | + ANT_HOME: '/usr/share/ant' |
| 75 | + DNN_MODELS: '/opt/dnn-models' |
| 76 | + CCACHE_DIR: '/opt/.ccache' |
| 77 | + OPENCV_DOWNLOAD_PATH: '/opt/binaries_cache' |
| 78 | + CMAKE_OPT: "-DBUILD_DOCS=ON -DBUILD_EXAMPLES=ON -DOPENCV_ENABLE_NONFREE=ON ${{ matrix.jpegxl && '-DWITH_JPEGXL=ON' }}" |
| 79 | + HOME: ${{ contains(matrix.image, '24.04') && '/home/ubuntu' || '/home/ci' }} |
| 80 | + OPENCV_FOR_THREADS_NUM: 4 |
| 81 | + CMAKE_BUILD_PARALLEL_LEVEL: 4 |
| 82 | + |
| 83 | + # ========== |
| 84 | + |
| 85 | + steps: |
| 86 | + |
| 87 | + - name: Checkout workflow repository |
| 88 | + uses: actions/checkout@v4 |
| 89 | + with: |
| 90 | + repository: opencv/ci-gha-workflow |
| 91 | + ref: ${{ github.repository == 'opencv/ci-gha-workflow' && github.ref || inputs.workflow_branch }} |
| 92 | + |
| 93 | + - name: Checkout and merge OpenCV |
| 94 | + uses: ./checkout-and-merge |
| 95 | + with: |
| 96 | + target_branch: ${{ matrix.branch }} |
| 97 | + author: ${{ github.event.pull_request.user.login }} |
| 98 | + source_branch: ${{ github.event.repository.name == 'ci-gha-workflow' && '' || github.head_ref }} |
| 99 | + gitcache: '/opt/git_cache' |
| 100 | + home: '${{ env.HOME }}' |
| 101 | + workdir: '${{ env.HOME }}' |
| 102 | + |
| 103 | + - name: Update extra dnn models |
| 104 | + timeout-minutes: 60 |
| 105 | + working-directory: '${{ env.HOME }}' |
| 106 | + run: | |
| 107 | + python3 opencv_extra/testdata/dnn/download_models.py -d '${{ env.DNN_MODELS }}/dnn' |
| 108 | + echo "OPENCV_DNN_TEST_DATA_PATH=${{ env.DNN_MODELS }}" >> $GITHUB_ENV |
| 109 | +
|
| 110 | + - name: Configure and build OpenCV |
| 111 | + uses: ./configure-and-build |
| 112 | + with: |
| 113 | + workdir: '${{ env.HOME }}' |
| 114 | + builddir: 'build' |
| 115 | + generator: 'Ninja' |
| 116 | + enable_contrib: false |
| 117 | + options: '${{ env.CMAKE_OPT }}' |
| 118 | + |
| 119 | + - name: Configure and build OpenCV with contrib |
| 120 | + uses: ./configure-and-build |
| 121 | + with: |
| 122 | + workdir: '${{ env.HOME }}' |
| 123 | + builddir: 'build-contrib' |
| 124 | + generator: 'Ninja' |
| 125 | + enable_contrib: true |
| 126 | + options: '${{ env.CMAKE_OPT }}' |
| 127 | + |
| 128 | + - name: Run OpenCV tests |
| 129 | + uses: ./run-tests |
| 130 | + env: |
| 131 | + OPENCV_TEST_DATA_PATH: '${{ env.HOME }}/opencv_extra/testdata' |
| 132 | + OPENCV_TEST_REQUIRE_DATA: 1 |
| 133 | + OPENCV_TEST_CHECK_OPTIONAL_DATA: 1 |
| 134 | + PYTHONPATH: '${{ env.HOME }}/build/python_loader:$PYTHONPATH' |
| 135 | + with: |
| 136 | + workdir: '${{ env.HOME }}' |
| 137 | + builddir: 'build' |
| 138 | + wrapper: 'xvfb-run -a' |
| 139 | + accuracy_modules: ${{ matrix.amodules }} |
| 140 | + performance_modules: ${{ matrix.pmodules }} |
| 141 | + skipgroup: "ubuntu24-list" |
| 142 | + enable_python: "true" |
| 143 | + enable_java: "true" |
| 144 | + suffix: '${{ matrix.image }}_${{ matrix.branch }}' |
0 commit comments