diff --git a/.github/workflows/OCV-PR-Linux.yaml b/.github/workflows/OCV-PR-Linux.yaml index 213800bc..75dc83a3 100644 --- a/.github/workflows/OCV-PR-Linux.yaml +++ b/.github/workflows/OCV-PR-Linux.yaml @@ -7,11 +7,11 @@ on: paths: - '.github/workflows/OCV-PR-Linux.yaml' # TODO: are following paths necessary? - - 'checkout-and-merge/*' - - 'configure-and-build/*' - - 'run-tests/*' - - 'scripts/runner.py' - - 'scripts/test-plan.json' + # - 'checkout-and-merge/*' + # - 'configure-and-build/*' + # - 'run-tests/*' + # - 'scripts/runner.py' + # - 'scripts/test-plan.json' workflow_call: inputs: workflow_branch: @@ -91,7 +91,7 @@ jobs: # - /mnt/cache/binaries_cache:/opt/binaries_cache # - vol_dnn_models:/opt/dnn-models # NOTE: CN config - - /home/opencv-cn/git_cache/${{ matrix.version }}:/opt/git_cache + - /home/opencv-cn/git_cache:/opt/git_cache - /home/opencv-cn/ci_cache/opencv/${{ matrix.version }}:/opt/.ccache - /home/opencv-cn/binaries_cache/${{ matrix.version }}:/opt/binaries_cache - /home/opencv-cn/dnn-models:/opt/dnn-models diff --git a/.github/workflows/OCV-PR-Windows.yaml b/.github/workflows/OCV-PR-Windows.yaml new file mode 100644 index 00000000..839a8b44 --- /dev/null +++ b/.github/workflows/OCV-PR-Windows.yaml @@ -0,0 +1,145 @@ +name: OCV PR Windows + +on: + pull_request: + branches: + - main + paths: + - '.github/workflows/OCV-PR-Windows.yaml' + # TODO: are following paths necessary? + - 'checkout-and-merge/*' + - 'configure-and-build/*' + - 'run-tests/*' + - 'scripts/runner.py' + - 'scripts/test-plan.json' + workflow_call: + inputs: + workflow_branch: + description: "Branch for ci-gha-workflow repository" + default: "main" + required: false + type: string + +concurrency: + group: OCV-PR-Windows-${{ github.ref }} + cancel-in-progress: true + +jobs: + + branch_eval: + runs-on: ubuntu-24.04 + outputs: + branches: ${{ steps.determine-branches.outputs.branches }} + steps: + - id: determine-branches + shell: bash + run: | + if [ "${{ github.event.repository.name == 'ci-gha-workflow' }}" = "true" ] ; then + echo "branches=[ '4.x', '5.x' ]" >> "$GITHUB_OUTPUT" + else + echo "branches=[ '${{ github.base_ref }}' ]" >> "$GITHUB_OUTPUT" + fi + + Windows: + runs-on: opencv-cn-win + needs: + - branch_eval + strategy: + # NOTE: Debugging + fail-fast: true + # fail-fast: false + max-parallel: 3 + matrix: + config: + - 'base' + - 'vulkan' + - 'uwp' + include: + - config: 'vulkan' + vulkan: true + - config: 'uwp' + uwp: true + + branch: ${{ fromJSON(needs.branch_eval.outputs.branches )}} + + defaults: + run: + shell: bash + env: + CMAKE_OPT: >- + -DCL_Z_OPTION=/Z7 + -DBUILD_EXAMPLES=ON + -DOPENCV_ENABLE_NONFREE=ON + ${{ matrix.uwp && '-DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0 -DCMAKE_SYSTEM_PROCESSOR=x86_64 -DBUILD_opencv_gapi=OFF -DWITH_MSMF=OFF -DBUILD_TESTS=OFF -DBUILD_PERF_TESTS=OFF -DBUILD_EXAMPLES=OFF -DBUILD_opencv_apps=OFF' }} + ${{ matrix.vulkan && '-DWITH_OPENCL=OFF -DWITH_VULKAN=ON' }} + MAIN_BUILD_DIR: "${{ (github.event.repository.name != 'opencv_contrib') && 'build' || 'build-contrib' }}" + OPENCV_FOR_THREADS_NUM: 8 + CMAKE_BUILD_PARALLEL_LEVEL: 8 + + # ========== + + steps: + + - name: Propagate environment + run: | + echo "GIT_CACHE=$(cygpath -u "$GIT_CACHE")" >> "$GITHUB_ENV" + echo "DNN_MODELS=$(cygpath -u "$DNN_MODELS")" >> "$GITHUB_ENV" + echo "BINARIES_CACHE=$(cygpath -u "$BINARIES_CACHE")" >> "$GITHUB_ENV" + echo "OPENCV_DOWNLOAD_PATH=$(cygpath -u "$BINARIES_CACHE")" >> "$GITHUB_ENV" + + + - name: Checkout workflow repository + uses: actions/checkout@v4 + with: + repository: opencv/ci-gha-workflow + ref: "${{ github.repository == 'opencv/ci-gha-workflow' && github.ref || inputs.workflow_branch }}" + + - working-directory: '${{ github.workspace }}' + shell: bash + run: | + ls -l + export + whoami + id + which bash + echo "GIT_CACHE=$GIT_CACHE" + echo "DNN_MODELS=$DNN_MODELS" + echo "BINARIES_CACHE=$BINARIES_CACHE" + echo "OPENCV_DOWNLOAD_PATH=$BINARIES_CACHE" + + + - name: Checkout and merge OpenCV + uses: ./checkout-and-merge + with: + target_branch: '${{ matrix.branch }}' + author: '${{ github.event.pull_request.user.login }}' + source_branch: "${{ github.event.repository.name == 'ci-gha-workflow' && '' || github.head_ref }}" + gitcache: '${{ env.GIT_CACHE }}' + workdir: '${{ github.workspace }}' + + - name: Update extra dnn models + timeout-minutes: 60 + working-directory: '${{ github.workspace }}' + run: | + python opencv_extra/testdata/dnn/download_models.py \ + --cleanup \ + --dst '${{ env.DNN_MODELS }}/dnn' + echo "OPENCV_DNN_TEST_DATA_PATH=${{ env.DNN_MODELS }}" >> $GITHUB_ENV + + + - if: ${{ github.event.repository.name != 'opencv_contrib' }} + name: Configure and build OpenCV + uses: ./configure-and-build + with: + workdir: '${{ github.workspace }}' + builddir: 'build' + generator: 'Visual Studio 16 2019' + options: '-A x64 ${{ env.CMAKE_OPT }}' + + - name: Configure and build OpenCV with contrib + uses: ./configure-and-build + with: + workdir: '${{ github.workspace }}' + builddir: 'build-contrib' + generator: 'Visual Studio 16 2019' + options: '-A x64 -DOPENCV_EXTRA_MODULES_PATH=opencv_contrib/modules ${{ env.CMAKE_OPT }}' diff --git a/checkout-and-merge/action.yaml b/checkout-and-merge/action.yaml index c20e2945..cb1668e7 100644 --- a/checkout-and-merge/action.yaml +++ b/checkout-and-merge/action.yaml @@ -32,7 +32,6 @@ runs: run: | echo "::group::Clone opencv" rm -rf opencv - HOME=${{ inputs.home }} \ git clone \ --reference-if-able ${{ inputs.gitcache }}/opencv.git \ --single-branch \ @@ -44,14 +43,13 @@ runs: working-directory: ${{ inputs.workdir }} shell: bash run: | - echo "OPENCV_MAIN_FORK=$(HOME=${{ inputs.home }} git ls-remote --heads https://github.com/${{ inputs.author }}/opencv ${{ inputs.source_branch }})" >> $GITHUB_ENV + echo "OPENCV_MAIN_FORK=$(git ls-remote --heads https://github.com/${{ inputs.author }}/opencv ${{ inputs.source_branch }})" >> $GITHUB_ENV - if: ${{ github.event.repository.name != 'ci-gha-workflow' && contains(inputs.repos, 'main') && inputs.source_branch && env.OPENCV_MAIN_FORK }} working-directory: ${{ inputs.workdir }} shell: bash run: | echo "::group::Merge opencv" - HOME=${{ inputs.home }} \ git -C opencv pull -v "https://github.com/${{ inputs.author }}/opencv" "${{ inputs.source_branch }}" echo "::endgroup::" @@ -63,7 +61,6 @@ runs: run: | echo "::group::Clone opencv_contrib" rm -rf opencv_contrib - HOME=${{ inputs.home }} \ git clone \ --reference-if-able ${{ inputs.gitcache }}/opencv_contrib.git \ --single-branch \ @@ -75,14 +72,13 @@ runs: working-directory: ${{ inputs.workdir }} shell: bash run: | - echo "OPENCV_CONTRIB_FORK=$(HOME=${{ inputs.home }} git ls-remote --heads https://github.com/${{ inputs.author }}/opencv_contrib ${{ inputs.source_branch }})" >> $GITHUB_ENV + echo "OPENCV_CONTRIB_FORK=$(git ls-remote --heads https://github.com/${{ inputs.author }}/opencv_contrib ${{ inputs.source_branch }})" >> $GITHUB_ENV - if: ${{ github.event.repository.name != 'ci-gha-workflow' && contains(inputs.repos, 'contrib') && inputs.source_branch && env.OPENCV_CONTRIB_FORK }} working-directory: ${{ inputs.workdir }} shell: bash run: | echo "::group::Merge opencv_contrib" - HOME=${{ inputs.home }} \ git -C opencv_contrib pull -v "https://github.com/${{ inputs.author }}/opencv_contrib" "${{ inputs.source_branch }}" echo "::endgroup::" @@ -94,7 +90,6 @@ runs: run: | echo "::group::Clone opencv_extra" rm -rf opencv_extra - HOME=${{ inputs.home }} \ git clone \ --reference-if-able ${{ inputs.gitcache }}/opencv_extra.git \ --single-branch \ @@ -106,13 +101,12 @@ runs: working-directory: ${{ inputs.workdir }} shell: bash run: | - echo "OPENCV_EXTRA_FORK=$(HOME=${{ inputs.home }} git ls-remote --heads https://github.com/${{ inputs.author }}/opencv_extra ${{ inputs.source_branch }})" >> $GITHUB_ENV + echo "OPENCV_EXTRA_FORK=$(git ls-remote --heads https://github.com/${{ inputs.author }}/opencv_extra ${{ inputs.source_branch }})" >> $GITHUB_ENV - if: ${{ github.event.repository.name != 'ci-gha-workflow' && contains(inputs.repos, 'extra') && inputs.source_branch && env.OPENCV_EXTRA_FORK }} working-directory: ${{ inputs.workdir }} shell: bash run: | echo "::group::Merge opencv_extra" - HOME=${{ inputs.home }} \ git -C opencv_extra pull -v "https://github.com/${{ inputs.author }}/opencv_extra" "${{ inputs.source_branch }}" echo "::endgroup::" diff --git a/configure-and-build/action.yml b/configure-and-build/action.yml index 0fde5ebb..aadc8a4c 100644 --- a/configure-and-build/action.yml +++ b/configure-and-build/action.yml @@ -20,12 +20,12 @@ runs: shell: bash run: | echo "::group::Configure" - rm -rf ${{ inputs.builddir }} - mkdir -p ${{ inputs.builddir }} + rm -rf '${{ inputs.builddir }}' + mkdir -p '${{ inputs.builddir }}' cmake \ -S opencv \ - -B ${{ inputs.builddir }} \ - -G ${{ inputs.generator }} \ + -B '${{ inputs.builddir }}' \ + -G '${{ inputs.generator }}' \ ${{ inputs.options }} echo "::endgroup::" @@ -33,14 +33,14 @@ runs: shell: bash run: | echo "::group::Build" - cmake --build ${{ inputs.builddir }} 2>&1 | tee ${{ inputs.builddir }}/log.txt + cmake --build '${{ inputs.builddir }}' 2>&1 | tee '${{ inputs.builddir }}/log.txt' echo "::endgroup::" - shell: bash run: | set +e python3 ./scripts/warnings-handling.py \ - ${{ inputs.workdir }}/${{ inputs.builddir }}/log.txt + '${{ inputs.workdir }}/${{ inputs.builddir }}/log.txt' if [ $? -ne 0 ]; then echo "WARNINGS=1" >> $GITHUB_ENV fi