Skip to content

Commit 2eccdcd

Browse files
avdivanmshabuninivan
authored
Unified windows build ver2 (#263)
* Unified windows build * fixup! Unified windows build * fixup! Unified windows build * fixup! Unified windows build * fixup! Unified windows build * fixup! Unified windows build * fixup! Unified windows build * fixup! Unified windows build * fixup! Unified windows build * fixup! Unified windows build * fixup! Unified windows build * fixup! Unified windows build * fixup! Unified windows build * fixup! Unified windows build * fixup! Unified windows build * fixup! Unified windows build * fixup! Unified windows build * fixup! Unified windows build * fixup! Unified windows build * fixup! Unified windows build * fixup! Unified windows build * fixup! Unified windows build * fixup! Unified windows build * fixup! Unified windows build * fixup! Unified windows build * fixup! Unified windows build * fixup! Unified windows build * Update OCV-PR-Windows.yaml * Test add ARM to OCV-PR-Windows.yaml * Update OCV-PR-Windows.yaml * Update OCV-PR-Windows.yaml * Update OCV-PR-Windows.yaml * Update OCV-PR-Windows.yaml * Test add x86 OCV-PR-Windows.yaml * Update OCV-PR-Windows.yaml * Update OCV-PR-Windows.yaml * Update OCV-PR-Windows.yaml --------- Co-authored-by: Maksim Shabunin <maksim.shabunin@gmail.com> Co-authored-by: ivan <ivan@MacBook-Pro-Ivan.local>
1 parent 1cf182e commit 2eccdcd

File tree

4 files changed

+170
-21
lines changed

4 files changed

+170
-21
lines changed

.github/workflows/OCV-PR-Linux.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ on:
77
paths:
88
- '.github/workflows/OCV-PR-Linux.yaml'
99
# 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'
10+
# - 'checkout-and-merge/*'
11+
# - 'configure-and-build/*'
12+
# - 'run-tests/*'
13+
# - 'scripts/runner.py'
14+
# - 'scripts/test-plan.json'
1515
workflow_call:
1616
inputs:
1717
workflow_branch:
@@ -91,7 +91,7 @@ jobs:
9191
# - /mnt/cache/binaries_cache:/opt/binaries_cache
9292
# - vol_dnn_models:/opt/dnn-models
9393
# NOTE: CN config
94-
- /home/opencv-cn/git_cache/:/opt/git_cache
94+
- /home/opencv-cn/git_cache:/opt/git_cache
9595
- /home/opencv-cn/ci_cache/opencv/${{ matrix.version }}:/opt/.ccache
9696
- /home/opencv-cn/binaries_cache/${{ matrix.version }}:/opt/binaries_cache
9797
- /home/opencv-cn/dnn-models:/opt/dnn-models
Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
name: OCV PR Windows
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
paths:
8+
- '.github/workflows/OCV-PR-Windows.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-Windows-${{ 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+
Windows:
44+
runs-on: ${{ matrix.runner }}
45+
needs:
46+
- branch_eval
47+
strategy:
48+
# NOTE: Debugging
49+
fail-fast: true
50+
# fail-fast: false
51+
max-parallel: 3
52+
matrix:
53+
arch: [ x86, x64, arm64 ]
54+
config: [ base ]
55+
include:
56+
- arch: x86
57+
config: base
58+
runner: opencv-cn-win
59+
vs: 'Visual Studio 16 2019'
60+
cmake_arch: Win32
61+
- arch: x64
62+
config: base
63+
runner: opencv-cn-win
64+
vs: 'Visual Studio 16 2019'
65+
cmake_arch: x64
66+
- arch: arm64
67+
config: base
68+
runner: windows-11-arm
69+
vs: 'Visual Studio 17 2022'
70+
cmake_arch: ARM64
71+
no_opencl: true
72+
73+
branch: ${{ fromJSON(needs.branch_eval.outputs.branches )}}
74+
defaults:
75+
run:
76+
shell: bash
77+
env:
78+
CMAKE_OPT: >-
79+
-DCL_Z_OPTION=/Z7
80+
-DBUILD_EXAMPLES=ON
81+
-DOPENCV_ENABLE_NONFREE=ON
82+
${{ matrix.no_opencl && '-DWITH_OPENCL=OFF' || '' }}
83+
${{ matrix.arch == 'arm64' && '-DWITH_VULKAN=OFF -DBUILD_opencv_vulkan=OFF -DOPENCV_DNN_VULKAN=OFF -DCMAKE_DISABLE_FIND_PACKAGE_Vulkan=ON -DBUILD_LIST=core,imgproc,highgui,videoio' || '' }}
84+
${{ matrix.arch == 'x86' && '-DBUILD_opencv_python3=OFF' || '' }}
85+
MAIN_BUILD_DIR: "${{ (github.event.repository.name != 'opencv_contrib') && 'build' || 'build-contrib' }}"
86+
OPENCV_FOR_THREADS_NUM: 8
87+
CMAKE_BUILD_PARALLEL_LEVEL: 8
88+
89+
# ==========
90+
91+
steps:
92+
93+
- name: Propagate environment
94+
run: |
95+
echo "GIT_CACHE=$(cygpath -u "$GIT_CACHE")" >> "$GITHUB_ENV"
96+
echo "DNN_MODELS=$(cygpath -u "$DNN_MODELS")" >> "$GITHUB_ENV"
97+
echo "BINARIES_CACHE=$(cygpath -u "$BINARIES_CACHE")" >> "$GITHUB_ENV"
98+
echo "OPENCV_DOWNLOAD_PATH=$(cygpath -u "$BINARIES_CACHE")" >> "$GITHUB_ENV"
99+
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+
- working-directory: '${{ github.workspace }}'
108+
shell: bash
109+
run: |
110+
ls -l
111+
export
112+
whoami
113+
id
114+
which bash
115+
echo "GIT_CACHE=$GIT_CACHE"
116+
echo "DNN_MODELS=$DNN_MODELS"
117+
echo "BINARIES_CACHE=$BINARIES_CACHE"
118+
echo "OPENCV_DOWNLOAD_PATH=$BINARIES_CACHE"
119+
120+
121+
- name: Checkout and merge OpenCV
122+
uses: ./checkout-and-merge
123+
with:
124+
target_branch: '${{ matrix.branch }}'
125+
author: '${{ github.event.pull_request.user.login }}'
126+
source_branch: "${{ github.event.repository.name == 'ci-gha-workflow' && '' || github.head_ref }}"
127+
gitcache: '${{ env.GIT_CACHE }}'
128+
workdir: '${{ github.workspace }}'
129+
130+
- name: Update extra dnn models
131+
if: ${{ matrix.arch != 'arm64' }}
132+
timeout-minutes: 60
133+
working-directory: '${{ github.workspace }}'
134+
run: |
135+
python opencv_extra/testdata/dnn/download_models.py \
136+
--cleanup \
137+
--dst '${{ env.DNN_MODELS }}/dnn'
138+
echo "OPENCV_DNN_TEST_DATA_PATH=${{ env.DNN_MODELS }}" >> $GITHUB_ENV
139+
140+
- if: ${{ github.event.repository.name != 'opencv_contrib' }}
141+
name: Configure and build OpenCV
142+
uses: ./configure-and-build
143+
with:
144+
workdir: '${{ github.workspace }}'
145+
builddir: 'build'
146+
generator: '${{ matrix.vs }}'
147+
options: '-A ${{ matrix.cmake_arch }} ${{ env.CMAKE_OPT }}'
148+
149+
- name: Configure and build OpenCV with contrib
150+
uses: ./configure-and-build
151+
with:
152+
workdir: '${{ github.workspace }}'
153+
builddir: 'build-contrib'
154+
generator: '${{ matrix.vs }}'
155+
options: '-A ${{ matrix.cmake_arch }} -DOPENCV_EXTRA_MODULES_PATH=opencv_contrib/modules ${{ env.CMAKE_OPT }}'

checkout-and-merge/action.yaml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ runs:
3232
run: |
3333
echo "::group::Clone opencv"
3434
rm -rf opencv
35-
HOME=${{ inputs.home }} \
3635
git clone \
3736
--reference-if-able ${{ inputs.gitcache }}/opencv.git \
3837
--single-branch \
@@ -44,14 +43,13 @@ runs:
4443
working-directory: ${{ inputs.workdir }}
4544
shell: bash
4645
run: |
47-
echo "OPENCV_MAIN_FORK=$(HOME=${{ inputs.home }} git ls-remote --heads https://github.com/${{ inputs.author }}/opencv ${{ inputs.source_branch }})" >> $GITHUB_ENV
46+
echo "OPENCV_MAIN_FORK=$(git ls-remote --heads https://github.com/${{ inputs.author }}/opencv ${{ inputs.source_branch }})" >> $GITHUB_ENV
4847
4948
- if: ${{ github.event.repository.name != 'ci-gha-workflow' && contains(inputs.repos, 'main') && inputs.source_branch && env.OPENCV_MAIN_FORK }}
5049
working-directory: ${{ inputs.workdir }}
5150
shell: bash
5251
run: |
5352
echo "::group::Merge opencv"
54-
HOME=${{ inputs.home }} \
5553
git -C opencv pull -v "https://github.com/${{ inputs.author }}/opencv" "${{ inputs.source_branch }}"
5654
echo "::endgroup::"
5755
@@ -63,7 +61,6 @@ runs:
6361
run: |
6462
echo "::group::Clone opencv_contrib"
6563
rm -rf opencv_contrib
66-
HOME=${{ inputs.home }} \
6764
git clone \
6865
--reference-if-able ${{ inputs.gitcache }}/opencv_contrib.git \
6966
--single-branch \
@@ -75,14 +72,13 @@ runs:
7572
working-directory: ${{ inputs.workdir }}
7673
shell: bash
7774
run: |
78-
echo "OPENCV_CONTRIB_FORK=$(HOME=${{ inputs.home }} git ls-remote --heads https://github.com/${{ inputs.author }}/opencv_contrib ${{ inputs.source_branch }})" >> $GITHUB_ENV
75+
echo "OPENCV_CONTRIB_FORK=$(git ls-remote --heads https://github.com/${{ inputs.author }}/opencv_contrib ${{ inputs.source_branch }})" >> $GITHUB_ENV
7976
8077
- if: ${{ github.event.repository.name != 'ci-gha-workflow' && contains(inputs.repos, 'contrib') && inputs.source_branch && env.OPENCV_CONTRIB_FORK }}
8178
working-directory: ${{ inputs.workdir }}
8279
shell: bash
8380
run: |
8481
echo "::group::Merge opencv_contrib"
85-
HOME=${{ inputs.home }} \
8682
git -C opencv_contrib pull -v "https://github.com/${{ inputs.author }}/opencv_contrib" "${{ inputs.source_branch }}"
8783
echo "::endgroup::"
8884
@@ -94,7 +90,6 @@ runs:
9490
run: |
9591
echo "::group::Clone opencv_extra"
9692
rm -rf opencv_extra
97-
HOME=${{ inputs.home }} \
9893
git clone \
9994
--reference-if-able ${{ inputs.gitcache }}/opencv_extra.git \
10095
--single-branch \
@@ -106,13 +101,12 @@ runs:
106101
working-directory: ${{ inputs.workdir }}
107102
shell: bash
108103
run: |
109-
echo "OPENCV_EXTRA_FORK=$(HOME=${{ inputs.home }} git ls-remote --heads https://github.com/${{ inputs.author }}/opencv_extra ${{ inputs.source_branch }})" >> $GITHUB_ENV
104+
echo "OPENCV_EXTRA_FORK=$(git ls-remote --heads https://github.com/${{ inputs.author }}/opencv_extra ${{ inputs.source_branch }})" >> $GITHUB_ENV
110105
111106
- if: ${{ github.event.repository.name != 'ci-gha-workflow' && contains(inputs.repos, 'extra') && inputs.source_branch && env.OPENCV_EXTRA_FORK }}
112107
working-directory: ${{ inputs.workdir }}
113108
shell: bash
114109
run: |
115110
echo "::group::Merge opencv_extra"
116-
HOME=${{ inputs.home }} \
117111
git -C opencv_extra pull -v "https://github.com/${{ inputs.author }}/opencv_extra" "${{ inputs.source_branch }}"
118112
echo "::endgroup::"

configure-and-build/action.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,27 +20,27 @@ runs:
2020
shell: bash
2121
run: |
2222
echo "::group::Configure"
23-
rm -rf ${{ inputs.builddir }}
24-
mkdir -p ${{ inputs.builddir }}
23+
rm -rf '${{ inputs.builddir }}'
24+
mkdir -p '${{ inputs.builddir }}'
2525
cmake \
2626
-S opencv \
27-
-B ${{ inputs.builddir }} \
28-
-G ${{ inputs.generator }} \
27+
-B '${{ inputs.builddir }}' \
28+
-G '${{ inputs.generator }}' \
2929
${{ inputs.options }}
3030
echo "::endgroup::"
3131
3232
- working-directory: ${{ inputs.workdir }}
3333
shell: bash
3434
run: |
3535
echo "::group::Build"
36-
cmake --build ${{ inputs.builddir }} 2>&1 | tee ${{ inputs.builddir }}/log.txt
36+
cmake --build '${{ inputs.builddir }}' 2>&1 | tee '${{ inputs.builddir }}/log.txt'
3737
echo "::endgroup::"
3838
3939
- shell: bash
4040
run: |
4141
set +e
4242
python3 ./scripts/warnings-handling.py \
43-
${{ inputs.workdir }}/${{ inputs.builddir }}/log.txt
43+
'${{ inputs.workdir }}/${{ inputs.builddir }}/log.txt'
4444
if [ $? -ne 0 ]; then
4545
echo "WARNINGS=1" >> $GITHUB_ENV
4646
fi

0 commit comments

Comments
 (0)