Skip to content

Commit 620edca

Browse files
authored
Enable Vulkan tests for 5.x branch after 4.x->5.x merge. (#104)
1 parent d61de34 commit 620edca

File tree

2 files changed

+247
-0
lines changed

2 files changed

+247
-0
lines changed
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
name: OCV PR:5.x W10 Vulkan
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
paths:
8+
- '.github/workflows/OCV-PR-5.x-W10-Vulkan.yaml'
9+
workflow_call:
10+
11+
concurrency:
12+
group: OCV-PR-5.x-W10-Vulkan-${{ github.ref }}
13+
cancel-in-progress: true
14+
15+
env:
16+
EXTRA_CMAKE_OPTIONS: '-DCL_Z_OPTION=/Z7 -DOPENCV_DOWNLOAD_PATH=%BINARIES_CACHE% -DOPENCV_ENABLE_NONFREE=ON -DCMAKE_BUILD_TYPE=Release -DWITH_OPENCL=OFF -DWITH_VULKAN=ON'
17+
OPENCV_TEST_DATA_PATH: ${{ github.workspace }}\opencv_extra\testdata
18+
PR_AUTHOR: ${{ github.event.pull_request.user.login }}
19+
PR_AUTHOR_FORK: ${{ github.event.pull_request.head.repo.full_name }}
20+
SOURCE_BRANCH_NAME: ${{ github.head_ref }}
21+
TARGET_BRANCH_NAME: ${{ github.base_ref }}
22+
GTEST_FILTER_STRING: '-Samples.findFile:videoio/videocapture_acceleration.read/122:videoio/videocapture_acceleration.read/126:Drawing.ttf_text'
23+
DOWNLOAD_DNN_MODELS_FILE: 'download_models.py'
24+
OPENCV_VULKAN_RUNTIME: 'C:\VulkanSDK\1.3.239.0\Bin\vulkan-1.dll'
25+
26+
jobs:
27+
BuildAndTest:
28+
runs-on: opencv-cn-win
29+
defaults:
30+
run:
31+
shell: cmd
32+
steps:
33+
- name: Brief system information
34+
timeout-minutes: 60
35+
run: bash %GIT_CACHE%\print_system_information.sh
36+
- name: Setup infra environment
37+
timeout-minutes: 60
38+
if: ${{ github.event.repository.name == 'ci-gha-workflow' }}
39+
shell: bash
40+
run: echo "TARGET_BRANCH_NAME=5.x" >> $GITHUB_ENV
41+
- name: PR info
42+
timeout-minutes: 60
43+
run: |
44+
echo "PR Author: ${{ env.PR_AUTHOR }}"
45+
echo "PR Author fork: ${{ env.PR_AUTHOR_FORK }}"
46+
echo "Source branch name: ${{ env.SOURCE_BRANCH_NAME }}"
47+
echo "Target branch name: ${{ env.TARGET_BRANCH_NAME }}"
48+
- name: Clean
49+
timeout-minutes: 60
50+
run: cd ${{ github.workspace }} && rm -rf *
51+
- name: Fetch opencv
52+
timeout-minutes: 60
53+
run: cd ${{ github.workspace }} && git clone --branch ${{ env.TARGET_BRANCH_NAME }} --reference %GIT_CACHE%\opencv.git git@github.com:opencv/opencv.git
54+
- name: Merge opencv with ${{ env.SOURCE_BRANCH_NAME }} branch
55+
timeout-minutes: 60
56+
if: ${{ github.event.repository.name != 'ci-gha-workflow' }}
57+
run: |
58+
cd ${{ github.workspace }}\opencv
59+
git pull -v "git@github.com:${{ env.PR_AUTHOR_FORK }}" "${{ env.SOURCE_BRANCH_NAME }}"
60+
- name: Fetch opencv_extra
61+
timeout-minutes: 60
62+
run: cd ${{ github.workspace }} && git clone --single-branch --branch ${{ env.TARGET_BRANCH_NAME }} --reference %GIT_CACHE%\opencv_extra.git git@github.com:opencv/opencv_extra.git
63+
- name: Merge opencv_extra with ${{ env.SOURCE_BRANCH_NAME }} branch
64+
timeout-minutes: 60
65+
if: ${{ github.event.repository.name != 'ci-gha-workflow' }}
66+
shell: bash
67+
run: |
68+
OPENCV_EXTRA_FORK=$(git ls-remote --heads "git@github.com:/${{ env.PR_AUTHOR }}/opencv_extra" "${{ env.SOURCE_BRANCH_NAME }}") || true
69+
if [[ ! -z "$OPENCV_EXTRA_FORK" ]]; then
70+
echo "Merge opencv_extra with ${{ env.SOURCE_BRANCH_NAME }} branch"
71+
cd opencv_extra
72+
git pull -v "git@github.com:${{ env.PR_AUTHOR }}/opencv_extra" "${{ env.SOURCE_BRANCH_NAME }}"
73+
else
74+
echo "No merge since ${{ env.PR_AUTHOR }}/opencv_extra does not have branch ${{ env.SOURCE_BRANCH_NAME }}"
75+
fi
76+
- name: Check DNN models update
77+
timeout-minutes: 60
78+
shell: bash
79+
working-directory: ${{ github.workspace }}
80+
run: |
81+
LATEST_SAVED_HASH=$(cat $DNN_MODELS\\dnn\\latest-hash-${{ env.TARGET_BRANCH_NAME }}.txt)
82+
LATEST_HASH=$(sha256sum opencv_extra\\testdata\\dnn\\${{ env.DOWNLOAD_DNN_MODELS_FILE }} | awk '{print $1}')
83+
if [[ "$LATEST_SAVED_HASH" == "$LATEST_HASH" ]]; then
84+
echo "MATCHER=true" >> $GITHUB_ENV && MATCHER=true
85+
fi
86+
if [[ $MATCHER == 'true' ]]; then
87+
echo "OPENCV_DNN_TEST_DATA_PATH=$DNN_MODELS" >> $GITHUB_ENV
88+
else
89+
echo "OPENCV_DNN_TEST_DATA_PATH=${{ github.workspace }}\\opencv_extra\\testdata" >> $GITHUB_ENV
90+
fi
91+
- name: Extra DNN models update
92+
timeout-minutes: 60
93+
if: ${{ env.MATCHER != 'true' }}
94+
run: |
95+
dir /b /a-d %DNN_MODELS%\\dnn\\|findstr /b ${{ env.DOWNLOAD_DNN_MODELS_FILE }} >excluded.tmp
96+
xcopy %DNN_MODELS%\\dnn\\* "%OPENCV_DNN_TEST_DATA_PATH%\\dnn\\" /EXCLUDE:excluded.tmp /S /y
97+
cd %OPENCV_DNN_TEST_DATA_PATH%\\dnn
98+
python ${{ env.DOWNLOAD_DNN_MODELS_FILE }}
99+
- name: Configure OpenCV
100+
timeout-minutes: 60
101+
run: |
102+
mkdir ${{ github.workspace }}\build && cd ${{ github.workspace }}\build
103+
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat"
104+
cmake -G Ninja ${{ env.EXTRA_CMAKE_OPTIONS }} ${{ github.workspace }}\opencv
105+
- name: Build OpenCV
106+
timeout-minutes: 60
107+
id: build-opencv
108+
run: |
109+
cd ${{ github.workspace }}\build
110+
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat"
111+
ninja -j %PARALLEL_JOBS% | tee ${{ github.workspace }}\build\build-log.txt
112+
- name: Warnings check
113+
timeout-minutes: 60
114+
run: cd ${{ github.workspace }}\build && python %CI_SCRIPTS%\warnings-handling.py
115+
- name: Accuracy:dnn
116+
timeout-minutes: 60
117+
if: ${{ always() && steps.build-opencv.outcome == 'success' }}
118+
run: cd ${{ github.workspace }}\build && bin\opencv_test_dnn.exe --skip_unstable --gtest_filter=${{ env.GTEST_FILTER_STRING }} --test_threads=%PARALLEL_JOBS%
119+
# TODO! After further optimizing the vulkan backend on the discrete graphics card, we can open the following perf_test.
120+
#- name: Performance:dnn
121+
#timeout-minutes: 60
122+
#if: ${{ always() && steps.build-opencv.outcome == 'success' }}
123+
#run: cd ${{ github.workspace }}\build && bin\opencv_perf_dnn.exe --perf_impl=plain --perf_min_samples=1 --perf_force_samples=1 --perf_verify_sanity --skip_unstable=1 --gtest_filter=${{ env.GTEST_FILTER_STRING }} --perf_threads=%PARALLEL_JOBS%
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
name: OCV PR:5.x macOS ARM64 Vulkan
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
paths:
8+
- '.github/workflows/OCV-PR-5.x-macOS-ARM64-Vulkan.yaml'
9+
workflow_call:
10+
11+
concurrency:
12+
group: OCV-PR-5.x-macOS-ARM64-Vulkan-${{ github.ref }}
13+
cancel-in-progress: true
14+
15+
env:
16+
EXTRA_CMAKE_OPTIONS: '-DPYTHON_DEFAULT_EXECUTABLE=/usr/bin/python3 -DOPENCV_DOWNLOAD_PATH=$BINARIES_CACHE -DOPENCV_ENABLE_NONFREE=ON -DBUILD_ZLIB=OFF -DWITH_OPENCL=OFF -DWITH_VULKAN=ON'
17+
PR_AUTHOR: ${{ github.event.pull_request.user.login }}
18+
PR_AUTHOR_FORK: ${{ github.event.pull_request.head.repo.full_name }}
19+
SOURCE_BRANCH_NAME: ${{ github.head_ref }}
20+
TARGET_BRANCH_NAME: ${{ github.base_ref }}
21+
ANT_HOME: '/usr/share/ant'
22+
PYTHONPATH: '${{ github.workspace }}/build/python_loader:$PYTHONPATH'
23+
OPENCV_TEST_DATA_PATH: '${{ github.workspace }}/opencv_extra/testdata'
24+
GTEST_FILTER_STRING: '-GOTURN.memory_usage:DaSiamRPN.memory_usage:videoio/videocapture_acceleration.read/64:videoio/videocapture_acceleration.read/65:videoio/videocapture_acceleration.read/66:videoio/videocapture_acceleration.read/67'
25+
OPENCV_VULKAN_RUNTIME: '/opt/VulkanSDK/1.3.239.0/MoltenVK/dylib/macOS/libMoltenVK.dylib'
26+
27+
jobs:
28+
BuildAndTest:
29+
runs-on: opencv-cn-mac-arm64
30+
defaults:
31+
run:
32+
shell: bash
33+
steps:
34+
- name: Brief system information
35+
timeout-minutes: 60
36+
run: bash $GIT_CACHE/print_system_information.sh
37+
- name: Setup infra environment
38+
timeout-minutes: 60
39+
if: ${{ github.event.repository.name == 'ci-gha-workflow' }}
40+
run: |
41+
echo "TARGET_BRANCH_NAME=5.x" >> $GITHUB_ENV
42+
- name: Setup test environment
43+
if: ${{ github.event.repository.name != 'ci-gha-workflow' }}
44+
run: |
45+
echo "EXTRA_GTEST_OPTIONS=--skip_unstable=1" >> $GITHUB_ENV
46+
- name: PR info
47+
timeout-minutes: 60
48+
run: |
49+
echo "PR Author: ${{ env.PR_AUTHOR }}"
50+
echo "PR Author fork: ${{ env.PR_AUTHOR_FORK }}"
51+
echo "Source branch name: ${{ env.SOURCE_BRANCH_NAME }}"
52+
echo "Target branch name: ${{ env.TARGET_BRANCH_NAME }}"
53+
- name: Clean
54+
timeout-minutes: 60
55+
run: find . -mindepth 1 -delete
56+
working-directory: ${{ github.workspace }}
57+
- name: Fetch opencv
58+
timeout-minutes: 60
59+
run: git clone --branch ${{ env.TARGET_BRANCH_NAME }} --reference $GIT_CACHE/opencv.git https://github.com/opencv/opencv.git
60+
working-directory: ${{ github.workspace }}
61+
- name: Merge opencv with ${{ env.SOURCE_BRANCH_NAME }} branch
62+
timeout-minutes: 60
63+
if: ${{ github.event.repository.name != 'ci-gha-workflow' }}
64+
run: git pull -v "https://github.com/${{ env.PR_AUTHOR_FORK }}" "${{ env.SOURCE_BRANCH_NAME }}"
65+
working-directory: ${{ github.workspace }}/opencv
66+
- name: Clone opencv_extra
67+
timeout-minutes: 60
68+
run: git clone --single-branch --branch ${{ env.TARGET_BRANCH_NAME }} --reference $GIT_CACHE/opencv_extra.git https://github.com/opencv/opencv_extra.git
69+
working-directory: ${{ github.workspace }}
70+
- name: Merge opencv_extra with ${{ env.SOURCE_BRANCH_NAME }} branch
71+
timeout-minutes: 60
72+
if: ${{ github.event.repository.name != 'ci-gha-workflow' }}
73+
run: |
74+
OPENCV_EXTRA_FORK=$(git ls-remote --heads "https://github.com/${{ env.PR_AUTHOR }}/opencv_extra" "${{ env.SOURCE_BRANCH_NAME }}") || true
75+
if [[ ! -z "$OPENCV_EXTRA_FORK" ]]; then
76+
echo "Merge opencv_extra with ${{ env.SOURCE_BRANCH_NAME }} branch"
77+
git pull -v "https://github.com/${{ env.PR_AUTHOR }}/opencv_extra" "${{ env.SOURCE_BRANCH_NAME }}"
78+
else
79+
echo "No merge since ${{ env.PR_AUTHOR }}/opencv_extra does not have branch ${{ env.SOURCE_BRANCH_NAME }}"
80+
fi
81+
working-directory: ${{ github.workspace }}/opencv_extra
82+
- name: Extra DNN models update
83+
timeout-minutes: 60
84+
run: |
85+
DOWNLOAD_MODELS_FILE='download_models.py'
86+
LATEST_SAVED_HASH=$(cat $DNN_MODELS/dnn/latest-hash-${{ env.TARGET_BRANCH_NAME }}.txt)
87+
LATEST_HASH=$(sha256sum opencv_extra/testdata/dnn/$DOWNLOAD_MODELS_FILE | awk '{print $1}')
88+
if [[ $LATEST_HASH == $LATEST_SAVED_HASH ]]; then
89+
echo "DNN models are up to date"
90+
echo "OPENCV_DNN_TEST_DATA_PATH=$DNN_MODELS" >> $GITHUB_ENV
91+
else
92+
echo "Updating DNN models list"
93+
echo "OPENCV_DNN_TEST_DATA_PATH=${{ github.workspace }}/new-dnn-models" >> $GITHUB_ENV && OPENCV_DNN_TEST_DATA_PATH="${{ github.workspace }}/new-dnn-models"
94+
mkdir -p "$OPENCV_DNN_TEST_DATA_PATH"
95+
rsync -a --exclude=$DOWNLOAD_MODELS_FILE $DNN_MODELS/* $OPENCV_DNN_TEST_DATA_PATH
96+
cp opencv_extra/testdata/dnn/download_models.py $OPENCV_DNN_TEST_DATA_PATH/dnn
97+
cd $OPENCV_DNN_TEST_DATA_PATH/dnn && python3 download_models.py
98+
fi
99+
working-directory: ${{ github.workspace }}
100+
- name: Configure OpenCV
101+
timeout-minutes: 60
102+
run: |
103+
cmake -B build -G Ninja ${{ env.EXTRA_CMAKE_OPTIONS }} opencv
104+
working-directory: ${{ github.workspace }}
105+
- name: Build OpenCV
106+
timeout-minutes: 60
107+
id: build-opencv
108+
run: |
109+
ninja -j $PARALLEL_JOBS | tee ${{ github.workspace }}/build/build-log.txt
110+
working-directory: ${{ github.workspace }}/build
111+
- name: Warnings check
112+
timeout-minutes: 60
113+
run: python3 $GIT_CACHE/warnings-handling.py
114+
working-directory: ${{ github.workspace }}/build
115+
- name: Accuracy:dnn
116+
timeout-minutes: 60
117+
if: ${{ always() && steps.build-opencv.outcome == 'success' }}
118+
run: ./bin/opencv_test_dnn --gtest_filter=${{ env.GTEST_FILTER_STRING }} --test_threads=$PARALLEL_JOBS ${{ env.EXTRA_GTEST_OPTIONS }}
119+
working-directory: ${{ github.workspace }}/build
120+
- name: Performance:dnn
121+
timeout-minutes: 60
122+
if: ${{ always() && steps.build-opencv.outcome == 'success' }}
123+
run: ./bin/opencv_perf_dnn --perf_impl=plain --perf_min_samples=1 --perf_force_samples=1 --perf_verify_sanity --skip_unstable=1 --gtest_filter=${{ env.GTEST_FILTER_STRING }} --perf_threads=$PARALLEL_JOBS
124+
working-directory: ${{ github.workspace }}/build

0 commit comments

Comments
 (0)