build: switch to GH action for Windows build #6
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Windows | |
on: | |
pull_request: | |
push: | |
branches: | |
- dev | |
- release | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build-windows: | |
runs-on: windows-2022 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '1.22' | |
cache: true | |
- name: Restore cached OpenCV source | |
uses: actions/cache/restore@v4 | |
id: cache-opencv-source | |
with: | |
key: opencv-source-490-windows-v1 | |
path: | | |
./opencv/opencv-4.9.0 | |
./opencv/opencv_contrib-4.9.0 | |
- name: Download OpenCV source | |
if: steps.cache-opencv-source.outputs.cache-hit != 'true' | |
run: | | |
echo Downloading: opencv-4.9.0.zip | |
powershell -command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest -Uri https://github.com/opencv/opencv/archive/4.9.0.zip -OutFile .\opencv\opencv-4.9.0.zip" | |
echo Extracting... | |
powershell -command "$ProgressPreference = 'SilentlyContinue'; Expand-Archive -Path .\opencv\opencv-4.9.0.zip -DestinationPath .\opencv" | |
del .\opencv\opencv-4.9.0.zip /q | |
echo. | |
echo Downloading: opencv_contrib-4.9.0.zip | |
powershell -command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest -Uri https://github.com/opencv/opencv_contrib/archive/4.9.0.zip -OutFile .\opencv\opencv_contrib-4.9.0.zip" | |
echo Extracting... | |
powershell -command "$ProgressPreference = 'SilentlyContinue'; Expand-Archive -Path .\opencv\opencv_contrib-4.9.0.zip -DestinationPath .\opencv" | |
del .\opencv\opencv_contrib-4.9.0.zip /q | |
echo. | |
- name: Save cached OpenCV source | |
uses: actions/cache/save@v4 | |
if: steps.cache-opencv-source.outputs.cache-hit != 'true' | |
with: | |
key: ${{ steps.cache-opencv-source.outputs.cache-primary-key }} | |
path: | | |
./opencv/opencv-4.9.0 | |
./opencv/opencv_contrib-4.9.0 | |
- name: Restore cached OpenCV build | |
uses: actions/cache/restore@v4 | |
id: cache-opencv-build | |
with: | |
key: opencv-build-490-windows-v1 | |
path: | | |
./opencv/build | |
- name: Build OpenCV | |
if: steps.cache-opencv-build.outputs.cache-hit != 'true' | |
shell: powershell | |
run: | | |
cmake .\opencv\opencv-4.9.0 -G "MinGW Makefiles" -B.\opencv\build -DENABLE_CXX11=ON -DOPENCV_EXTRA_MODULES_PATH=.\opencv\opencv_contrib-4.9.0\modules -DBUILD_SHARED_LIBS=ON -DWITH_IPP=OFF -DWITH_MSMF=OFF -DBUILD_EXAMPLES=OFF -DBUILD_TESTS=OFF -DBUILD_PERF_TESTS=ON -DBUILD_opencv_java=OFF -DBUILD_opencv_python=OFF -DBUILD_opencv_python2=OFF -DBUILD_opencv_python3=OFF -DBUILD_DOCS=OFF -DENABLE_PRECOMPILED_HEADERS=OFF -DBUILD_opencv_saliency=OFF -DBUILD_opencv_wechat_qrcode=ON -DCPU_DISPATCH= -DOPENCV_GENERATE_PKGCONFIG=ON -DWITH_OPENCL_D3D11_NV=OFF -DOPENCV_ALLOCATOR_STATS_COUNTER_TYPE=int64_t -Wno-dev | |
mingw32-make -j%NUMBER_OF_PROCESSORS% | |
- name: Save cached OpenCV build | |
uses: actions/cache/save@v4 | |
if: steps.cache-opencv-build.outputs.cache-hit != 'true' | |
with: | |
key: ${{ steps.cache-opencv-build.outputs.cache-primary-key }} | |
path: | | |
./opencv/build | |
- name: Install OpenCV | |
shell: powershell | |
run: | | |
mingw32-make install | |
- name: Test GoCV | |
shell: bash | |
run: | | |
go test -v -tags matprofile . | |
- name: Test GoCV Contrib | |
shell: bash | |
run: | | |
go test -v -tags matprofile ./contrib | |