diff --git a/.github/workflows/ubuntu20.yml b/.github/workflows/ubuntu20.yml new file mode 100644 index 0000000000..a97c318359 --- /dev/null +++ b/.github/workflows/ubuntu20.yml @@ -0,0 +1,169 @@ +name: Ubuntu 20.04 + +on: + pull_request: + types: [synchronize, opened] + push: + branches: + - master + +env: + DEBIAN_FRONTEND: noninteractive + OPENCV_VERSION: 4.6.0 + +jobs: + build: + + runs-on: ubuntu-20.04 + + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 1 + + - name: Install dependencies + run: | + pwd + echo ${GITHUB_WORKSPACE} + current_path=$(pwd) + sudo apt-get update -y + sudo apt-get install -y --no-install-recommends \ + apt-transport-https \ + software-properties-common \ + wget \ + unzip \ + ca-certificates \ + build-essential \ + cmake \ + git \ + libtbb-dev \ + libatlas-base-dev \ + libgtk2.0-dev \ + libavcodec-dev \ + libavformat-dev \ + libswscale-dev \ + libdc1394-22-dev \ + libxine2-dev \ + libv4l-dev \ + libtheora-dev \ + libvorbis-dev \ + libxvidcore-dev \ + libopencore-amrnb-dev \ + libopencore-amrwb-dev \ + libavresample-dev \ + x264 \ + libtesseract-dev + + - name: Cache OpenCV + id: opencv-cache + uses: actions/cache@v2 + with: + path: ${{ github.workspace }}/opencv_ubuntu/ + key: opencv-${{ env.OPENCV_VERSION }}-rev1 + + - name: Build OpenCV + if: steps.opencv-cache.outputs.cache-hit != 'true' + run: | + wget https://github.com/opencv/opencv/archive/${OPENCV_VERSION}.zip -Oopencv-${OPENCV_VERSION}.zip && unzip opencv-${OPENCV_VERSION}.zip + wget https://github.com/opencv/opencv_contrib/archive/${OPENCV_VERSION}.zip -Oopencv_contrib-${OPENCV_VERSION}.zip && unzip opencv_contrib-${OPENCV_VERSION}.zip + cd opencv-${OPENCV_VERSION} && mkdir build && cd build + cmake \ + -D CMAKE_BUILD_TYPE=Release \ + -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-${OPENCV_VERSION}/modules \ + -D BUILD_SHARED_LIBS=OFF \ + -D ENABLE_CXX11=ON \ + -D BUILD_EXAMPLES=OFF \ + -D BUILD_DOCS=OFF \ + -D BUILD_PERF_TESTS=OFF \ + -D BUILD_TESTS=OFF \ + -D BUILD_JAVA=OFF \ + -D BUILD_opencv_apps=OFF \ + -D BUILD_opencv_barcode=OFF \ + -D BUILD_opencv_java_bindings_generator=OFF \ + -D BUILD_opencv_python_bindings_generator=OFF \ + -D BUILD_opencv_python_tests=OFF \ + -D BUILD_opencv_ts=OFF \ + -D BUILD_opencv_js=OFF \ + -D BUILD_opencv_js_bindings_generator=OFF \ + -D BUILD_opencv_bioinspired=OFF \ + -D BUILD_opencv_ccalib=OFF \ + -D BUILD_opencv_datasets=OFF \ + -D BUILD_opencv_dnn_objdetect=OFF \ + -D BUILD_opencv_dpm=OFF \ + -D BUILD_opencv_fuzzy=OFF \ + -D BUILD_opencv_gapi=ON \ + -D BUILD_opencv_intensity_transform=OFF \ + -D BUILD_opencv_mcc=OFF \ + -D BUILD_opencv_objc_bindings_generator=OFF \ + -D BUILD_opencv_rapid=OFF \ + -D BUILD_opencv_reg=OFF \ + -D BUILD_opencv_stereo=OFF \ + -D BUILD_opencv_structured_light=OFF \ + -D BUILD_opencv_surface_matching=OFF \ + -D BUILD_opencv_wechat_qrcode=ON \ + -D BUILD_opencv_videostab=OFF \ + -D WITH_GSTREAMER=OFF \ + -D WITH_ADE=OFF \ + -D OPENCV_ENABLE_NONFREE=ON \ + -D CMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/opencv_ubuntu .. + make -j2 + make install + sudo ldconfig + cd ${GITHUB_WORKSPACE} + ls + + - name: Build OpenCvSharpExtern + run: | + ls ${GITHUB_WORKSPACE}/opencv_ubuntu + echo "-----" + ls ${GITHUB_WORKSPACE}/opencv_ubuntu/lib + echo "-----" + mkdir src/build && cd $_ + cmake -D CMAKE_PREFIX_PATH=${GITHUB_WORKSPACE}/opencv_ubuntu .. + make -j2 + ls OpenCvSharpExtern + cp OpenCvSharpExtern/libOpenCvSharpExtern.so ${GITHUB_WORKSPACE}/nuget/ + ldd OpenCvSharpExtern/libOpenCvSharpExtern.so + + - name: Check OpenCvSharpExtern + run: | + cd ${GITHUB_WORKSPACE}/nuget/ + ldd libOpenCvSharpExtern.so + nm libOpenCvSharpExtern.so + echo -ne "#include \n int core_Mat_sizeof(); int main(){ int i = core_Mat_sizeof(); printf(\"sizeof(Mat) = %d\", i); return 0; }" > test.c + gcc -I./ -L./ test.c -o test -lOpenCvSharpExtern + LD_LIBRARY_PATH=. ./test + + - name: Install .NET + uses: actions/setup-dotnet@v1 + with: + dotnet-version: '6.0.x' + + - name: Create NuGet package + env: + BETA: "" + run: | + yyyymmdd=`date '+%Y%m%d'` + echo $yyyymmdd + sed -E --in-place=.bak "s/[0-9]\.[0-9]{1,2}\.[0-9]{1,2}.[0-9]{8}(-beta[0-9]*)?<\/version>/${OPENCV_VERSION}.${yyyymmdd}${BETA}<\/version>/" ${GITHUB_WORKSPACE}/nuget/OpenCvSharp4.runtime.ubuntu.20.04-x64.nuspec + cat ${GITHUB_WORKSPACE}/nuget/OpenCvSharp4.runtime.ubuntu.20.04-x64.nuspec + dotnet pack ${GITHUB_WORKSPACE}/nuget/OpenCvSharp4.runtime.ubuntu.20.04-x64.csproj -o ${GITHUB_WORKSPACE}/artifacts_ubuntu + ls ${GITHUB_WORKSPACE}/artifacts_ubuntu + + - uses: actions/upload-artifact@v1 + with: + name: artifacts_ubuntu_20 + path: artifacts_ubuntu + + - name: Test + run: | + cd ${GITHUB_WORKSPACE}/test/OpenCvSharp.Tests + dotnet build -c Release -f net6.0 + cp ${GITHUB_WORKSPACE}/nuget/libOpenCvSharpExtern.so ${GITHUB_WORKSPACE}/test/OpenCvSharp.Tests/bin/Release/net6.0/ + cp ${GITHUB_WORKSPACE}/nuget/libOpenCvSharpExtern.so ${GITHUB_WORKSPACE}/test/OpenCvSharp.Tests/ + sudo cp ${GITHUB_WORKSPACE}/nuget/libOpenCvSharpExtern.so /usr/lib/ + # ls ${GITHUB_WORKSPACE}/test/OpenCvSharp.Tests/bin/Release/net6.0/ + # ls + LD_LIBRARY_PATH=. dotnet test OpenCvSharp.Tests.csproj -c Release -f net6.0 --runtime ubuntu.20.04-x64 --logger "trx;LogFileName=test-results.trx" < /dev/null + # ls + # ls TestResults diff --git a/nuget/OpenCvSharp4.runtime.ubuntu.20.04-x64.csproj b/nuget/OpenCvSharp4.runtime.ubuntu.20.04-x64.csproj new file mode 100644 index 0000000000..f4e960bdbf --- /dev/null +++ b/nuget/OpenCvSharp4.runtime.ubuntu.20.04-x64.csproj @@ -0,0 +1,12 @@ + + + netstandard2.0;netstandard2.1;netcoreapp2.1; + true + false + OpenCvSharp4.runtime.ubuntu.20.04-x64.nuspec + + + + + diff --git a/nuget/OpenCvSharp4.runtime.ubuntu.20.04-x64.nuspec b/nuget/OpenCvSharp4.runtime.ubuntu.20.04-x64.nuspec new file mode 100644 index 0000000000..87d89284a6 --- /dev/null +++ b/nuget/OpenCvSharp4.runtime.ubuntu.20.04-x64.nuspec @@ -0,0 +1,30 @@ + + + + OpenCvSharp4.runtime.ubuntu.20.04-x64 + 4.6.0.20220608 + OpenCvSharp native bindings for ubuntu.20.04-x64 + shimat + Apache-2.0 + + https://github.com/shimat/opencvsharp + https://raw.githubusercontent.com/shimat/opencvsharp/master/nuget/icon/opencvsharp.png + false + Internal implementation package for OpenCvSharp to work on Ubuntu 20.04 + Internal implementation package for OpenCvSharp to work on Ubuntu 20.04 + + Copyright 2008-2019 + Image Processing OpenCV Wrapper FFI opencvsharp + + + + + + + + + + + + + \ No newline at end of file