Skip to content

Force OPENCV_TEST_REQUIRE_DATA in CI environments in 4.x #36

Force OPENCV_TEST_REQUIRE_DATA in CI environments in 4.x

Force OPENCV_TEST_REQUIRE_DATA in CI environments in 4.x #36

name: OCV PR:4.x U20 CUDA
on:
pull_request:
branches:
- main
paths:
- '.github/workflows/OCV-PR-4.x-U20-Cuda.yaml'
workflow_call:
concurrency:
group: OCV-PR-4.x-U20-Cuda-${{ github.ref }}
cancel-in-progress: true
env:
EXTRA_CMAKE_OPTIONS: '-DBUILD_DOCS=ON -DPYTHON_DEFAULT_EXECUTABLE=/usr/bin/python3 -DOPENCV_DOWNLOAD_PATH=/home/ci/binaries_cache -DBUILD_EXAMPLES=ON -DOPENCV_ENABLE_NONFREE=ON -DWITH_CUDA=ON -DBUILD_LIST=dnn,cudev,ts -DCUDA_ARCH_BIN=6.1 -DWITH_VA=OFF'
PR_AUTHOR: ${{ github.event.pull_request.user.login }}
PR_AUTHOR_FORK: ${{ github.event.pull_request.head.repo.full_name }}
SOURCE_BRANCH_NAME: ${{ github.head_ref }}
TARGET_BRANCH_NAME: ${{ github.base_ref }}
ANT_HOME: '/usr/share/ant'
GIT_CACHE_DOCKER: '/home/ci/git_cache'
OPENCV_TEST_DATA_PATH: '/home/ci/opencv_extra/testdata'
OPENCV_TEST_REQUIRE_DATA: 1
OPENCV_DOCKER_WORKDIR: '/home/ci/opencv'
DNN_MODELS: '/home/ci/dnn-models'
PARALLEL_JOBS: 8
jobs:
BuildAndTest:
runs-on: opencv-cn-lin-x86-64
defaults:
run:
shell: bash
container:
image: quay.io/opencv-ci/opencv-ubuntu-20.04:20230413
options: --gpus all -m 8G
volumes:
- /home/opencv-cn/git_cache:/home/ci/git_cache
- /home/opencv-cn/ci_cache/opencv:/home/ci/.ccache
- /home/opencv-cn/binaries_cache:/home/ci/binaries_cache
- /home/opencv-cn/dnn-models:/home/ci/dnn-models
- /usr/local/cuda:/usr/local/cuda
steps:
- name: Brief system information
timeout-minutes: 60
run: bash ${{ env.GIT_CACHE_DOCKER }}/print_system_information.sh
- name: Define proper HOME path
timeout-minutes: 60
run: echo "HOME=/home/ci" >> $GITHUB_ENV
- name: Setup infra environment
timeout-minutes: 60
if: ${{ github.event.repository.name == 'ci-gha-workflow' }}
run: |
echo "TARGET_BRANCH_NAME=4.x" >> $GITHUB_ENV
- name: Setup test environment
if: ${{ github.event.repository.name != 'ci-gha-workflow' }}
run: |
echo "EXTRA_GTEST_OPTIONS=--skip_unstable=1" >> $GITHUB_ENV
- name: PR info
timeout-minutes: 60
run: |
echo "PR Author: ${{ env.PR_AUTHOR }}"
echo "PR Author fork: ${{ env.PR_AUTHOR_FORK }}"
echo "Source branch name: ${{ env.SOURCE_BRANCH_NAME }}"
echo "Target branch name: ${{ env.TARGET_BRANCH_NAME }}"
- name: Clean
timeout-minutes: 60
run: find ${{ env.OPENCV_DOCKER_WORKDIR }} -mindepth 1 -delete
- name: Fetch opencv
timeout-minutes: 60
run: git clone --branch ${{ env.TARGET_BRANCH_NAME }} --reference ${{ env.GIT_CACHE_DOCKER }}/opencv.git https://github.com/opencv/opencv.git ${{ env.OPENCV_DOCKER_WORKDIR }}
- name: Merge opencv with ${{ env.SOURCE_BRANCH_NAME }} branch
timeout-minutes: 60
if: ${{ github.event.repository.name != 'ci-gha-workflow' }}
run: |
cd ${{ env.OPENCV_DOCKER_WORKDIR }}
git pull -v "https://github.com/${{ env.PR_AUTHOR_FORK }}" "${{ env.SOURCE_BRANCH_NAME }}"
- name: Clone opencv_contrib
timeout-minutes: 60
run: git clone --single-branch --branch ${{ env.TARGET_BRANCH_NAME }} --reference ${{ env.GIT_CACHE_DOCKER }}/opencv_contrib.git https://github.com/opencv/opencv_contrib.git $HOME/opencv_contrib
- name: Merge opencv_contrib with ${{ env.SOURCE_BRANCH_NAME }} branch
timeout-minutes: 60
if: ${{ github.event.repository.name != 'ci-gha-workflow' }}
run: |
OPENCV_CONTRIB_FORK=$(git ls-remote --heads "https://github.com/${{ env.PR_AUTHOR }}/opencv_contrib" "${{ env.SOURCE_BRANCH_NAME }}") || true
if [[ ! -z "$OPENCV_CONTRIB_FORK" ]]; then
echo "Merge opencv_contrib with ${{ env.SOURCE_BRANCH_NAME }} branch"
cd $HOME/opencv_contrib
git pull -v "https://github.com/${{ env.PR_AUTHOR }}/opencv_contrib" "${{ env.SOURCE_BRANCH_NAME }}"
else
echo "No merge since ${{ env.PR_AUTHOR }}/opencv_contrib does not have branch ${{ env.SOURCE_BRANCH_NAME }}"
fi
- name: Clone opencv_extra
timeout-minutes: 60
run: git clone --single-branch --branch ${{ env.TARGET_BRANCH_NAME }} --reference ${{ env.GIT_CACHE_DOCKER }}/opencv_extra.git https://github.com/opencv/opencv_extra.git $HOME/opencv_extra
- name: Merge opencv_extra with ${{ env.SOURCE_BRANCH_NAME }} branch
timeout-minutes: 60
if: ${{ github.event.repository.name != 'ci-gha-workflow' }}
run: |
OPENCV_EXTRA_FORK=$(git ls-remote --heads "https://github.com/${{ env.PR_AUTHOR }}/opencv_extra" "${{ env.SOURCE_BRANCH_NAME }}") || true
if [[ ! -z "$OPENCV_EXTRA_FORK" ]]; then
echo "Merge opencv_extra with ${{ env.SOURCE_BRANCH_NAME }} branch"
cd $HOME/opencv_extra
git pull -v "https://github.com/${{ env.PR_AUTHOR }}/opencv_extra" "${{ env.SOURCE_BRANCH_NAME }}"
else
echo "No merge since ${{ env.PR_AUTHOR }}/opencv_extra does not have branch ${{ env.SOURCE_BRANCH_NAME }}"
fi
- name: Extra DNN models update
timeout-minutes: 60
run: |
DOWNLOAD_MODELS_FILE='download_models.py'
LATEST_SAVED_HASH=$(cat ${{ env.DNN_MODELS }}/dnn/latest-hash-${{ env.TARGET_BRANCH_NAME }}.txt)
LATEST_HASH=$(sha256sum $HOME/opencv_extra/testdata/dnn/$DOWNLOAD_MODELS_FILE | awk '{print $1}')
if [[ $LATEST_HASH == $LATEST_SAVED_HASH ]]; then
echo "DNN models are up to date"
echo "OPENCV_DNN_TEST_DATA_PATH=${{ env.DNN_MODELS }}" >> $GITHUB_ENV
else
echo "Updating DNN models list"
echo "OPENCV_DNN_TEST_DATA_PATH=/home/ci/new-dnn-models" >> $GITHUB_ENV && OPENCV_DNN_TEST_DATA_PATH='/home/ci/new-dnn-models'
mkdir -p "$OPENCV_DNN_TEST_DATA_PATH"
rsync -a --exclude=$DOWNLOAD_MODELS_FILE ${{ env.DNN_MODELS }}/* $OPENCV_DNN_TEST_DATA_PATH
cp $HOME/opencv_extra/testdata/dnn/download_models.py $OPENCV_DNN_TEST_DATA_PATH/dnn
cd $OPENCV_DNN_TEST_DATA_PATH/dnn && python3 download_models.py
fi
- name: Configure OpenCV
timeout-minutes: 60
run: |
cd $HOME/build
cmake -G Ninja ${{ env.EXTRA_CMAKE_OPTIONS }} -DOPENCV_EXTRA_MODULES_PATH=$HOME/opencv_contrib/modules ${{ env.OPENCV_DOCKER_WORKDIR }}
- name: Build OpenCV
timeout-minutes: 60
id: build-opencv
run: |
cd $HOME/build
ninja -j ${{ env.PARALLEL_JOBS }} | tee $HOME/build/build-log.txt
- name: Accuracy:dnn
timeout-minutes: 60
if: ${{ always() && steps.build-opencv.outcome == 'success' }}
run: cd $HOME/build && xvfb-run -a bin/opencv_test_dnn --test_threads=${{ env.PARALLEL_JOBS }} --gtest_filter=${{ env.GTEST_FILTER_STRING }} ${{ env.EXTRA_GTEST_OPTIONS }}
env:
GTEST_FILTER_STRING: '-Test_Model.TextRecognition/0:Test_Model.TextRecognition/1:Test_Model.TextRecognitionWithCTCPrefixBeamSearch/0:Test_Model.TextRecognitionWithCTCPrefixBeamSearch/1:Test_ONNX_layers.Convolution3D/1:Test_ONNX_layers.Convolution3D_bias/1:Test_ONNX_layers.Shape/0:Test_ONNX_layers.Shape/1:Test_ONNX_layers.Power/0:Test_ONNX_layers.Power/1:Test_ONNX_layers.Elementwise_Log/0:Test_ONNX_layers.Elementwise_Log/1:Test_ONNX_layers.Elementwise_not/0:Test_ONNX_layers.Elementwise_not/1:Test_ONNX_layers.Compare_EQ/0:Test_ONNX_layers.Compare_EQ/1:Test_ONNX_layers.Compare_GT/0:Test_ONNX_layers.Compare_GT/1:Test_ONNX_layers.Compare_LT/0:Test_ONNX_layers.Compare_LT/1:Test_ONNX_layers.Compare_GTorEQ/0:Test_ONNX_layers.Compare_GTorEQ/1:Test_ONNX_layers.Compare_LEorEQ/0:Test_ONNX_layers.Compare_LEorEQ/1:Test_ONNX_layers.Eltwise3D/0:Test_ONNX_layers.Eltwise3D/1:Test_ONNX_layers.PoolConv3D/1:Test_ONNX_layers.Div/0:Test_ONNX_layers.Div/1:Test_ONNX_layers.Split/0:Test_ONNX_layers.Split/1:Test_ONNX_layers.SubFromConst/0:Test_ONNX_layers.SubFromConst/1:Test_TensorFlow_layers.Convolution3D/1:Test_TensorFlow_layers.concat_3d/1:Test_ONNX_layers.LSTM_Activations/0:Test_ONNX_nets.LResNet100E_IR/1:Test_ONNX_nets.Emotion_ferplus/0:Test_ONNX_nets.Emotion_ferplus/1:Test_ONNX_nets.Resnet34_kinetics/1'