Skip to content

Unified windows build #241

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 27 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
d0c73de
Unified windows build
mshabunin Apr 17, 2025
bb1876f
fixup! Unified windows build
mshabunin Apr 18, 2025
5a8d1ac
fixup! Unified windows build
mshabunin Apr 18, 2025
2511a34
fixup! Unified windows build
mshabunin Apr 18, 2025
2b96029
fixup! Unified windows build
mshabunin Apr 18, 2025
43eae6f
fixup! Unified windows build
mshabunin Apr 18, 2025
0a8c0d3
fixup! Unified windows build
mshabunin Apr 18, 2025
5bc809f
fixup! Unified windows build
mshabunin Apr 18, 2025
3859a0b
fixup! Unified windows build
mshabunin Apr 18, 2025
98cf51f
fixup! Unified windows build
mshabunin Apr 18, 2025
eefc46c
fixup! Unified windows build
mshabunin Apr 18, 2025
8c0a9d2
fixup! Unified windows build
mshabunin Apr 18, 2025
0ab6fa2
fixup! Unified windows build
mshabunin Apr 18, 2025
3ea9492
fixup! Unified windows build
mshabunin Apr 18, 2025
cf2b8e6
fixup! Unified windows build
mshabunin Apr 18, 2025
b0d0e4a
fixup! Unified windows build
mshabunin Apr 18, 2025
147ae7e
fixup! Unified windows build
mshabunin Apr 18, 2025
97ba74c
fixup! Unified windows build
mshabunin Apr 18, 2025
4c11f0c
fixup! Unified windows build
mshabunin Apr 18, 2025
de96d15
fixup! Unified windows build
mshabunin Apr 18, 2025
78e67e9
fixup! Unified windows build
mshabunin Apr 18, 2025
9b3584a
fixup! Unified windows build
mshabunin Apr 18, 2025
d779291
fixup! Unified windows build
mshabunin Apr 18, 2025
1ed6ab2
fixup! Unified windows build
mshabunin Apr 18, 2025
39da691
fixup! Unified windows build
mshabunin Apr 18, 2025
1738546
fixup! Unified windows build
mshabunin Apr 18, 2025
249b7c3
fixup! Unified windows build
mshabunin Apr 28, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/OCV-PR-Linux.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
145 changes: 145 additions & 0 deletions .github/workflows/OCV-PR-Windows.yaml
Original file line number Diff line number Diff line change
@@ -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 }}'
12 changes: 3 additions & 9 deletions checkout-and-merge/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand All @@ -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::"

Expand All @@ -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 \
Expand All @@ -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::"

Expand All @@ -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 \
Expand All @@ -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::"
12 changes: 6 additions & 6 deletions configure-and-build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,27 +20,27 @@ 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::"

- working-directory: ${{ inputs.workdir }}
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
Loading