make: improve Linux distro dtection code, and add specific dependendc… #425
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: Linux | |
on: | |
pull_request: | |
push: | |
branches: | |
- dev | |
- release | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
container: ghcr.io/hybridgroup/opencv:4.10.0 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Enforce Go formatted code | |
run: "test -z $(gofmt -l .) || gofmt -d ." | |
- name: Install dependencies | |
run: apt-get update -yqq && apt-get install xvfb unzip -y | |
- name: Install WeChat test model | |
run: | | |
mkdir -p ${GITHUB_WORKSPACE}/testdata | |
curl -sL https://raw.githubusercontent.com/WeChatCV/opencv_3rdparty/wechat_qrcode/detect.caffemodel > ${GITHUB_WORKSPACE}/testdata/detect.caffemodel | |
curl -sL https://raw.githubusercontent.com/WeChatCV/opencv_3rdparty/wechat_qrcode/detect.prototxt > ${GITHUB_WORKSPACE}/testdata/detect.prototxt | |
curl -sL https://raw.githubusercontent.com/WeChatCV/opencv_3rdparty/wechat_qrcode/sr.caffemodel > ${GITHUB_WORKSPACE}/testdata/sr.caffemodel | |
curl -sL https://raw.githubusercontent.com/WeChatCV/opencv_3rdparty/wechat_qrcode/sr.prototxt > ${GITHUB_WORKSPACE}/testdata/sr.prototxt | |
- name: Install GOTURN test model | |
run: | | |
mkdir -p ${GITHUB_WORKSPACE}/testdata | |
curl -sL https://raw.githubusercontent.com/opencv/opencv_extra/c4219d5eb3105ed8e634278fad312a1a8d2c182d/testdata/tracking/goturn.prototxt > ${GITHUB_WORKSPACE}/testdata/goturn.prototxt | |
curl -sL https://github.com/opencv/opencv_extra/raw/c4219d5eb3105ed8e634278fad312a1a8d2c182d/testdata/tracking/goturn.caffemodel.zip.001 > ${GITHUB_WORKSPACE}/testdata/goturn.caffemodel.zip.001 | |
curl -sL https://github.com/opencv/opencv_extra/raw/c4219d5eb3105ed8e634278fad312a1a8d2c182d/testdata/tracking/goturn.caffemodel.zip.002 > ${GITHUB_WORKSPACE}/testdata/goturn.caffemodel.zip.002 | |
curl -sL https://github.com/opencv/opencv_extra/raw/c4219d5eb3105ed8e634278fad312a1a8d2c182d/testdata/tracking/goturn.caffemodel.zip.003 > ${GITHUB_WORKSPACE}/testdata/goturn.caffemodel.zip.003 | |
curl -sL https://github.com/opencv/opencv_extra/raw/c4219d5eb3105ed8e634278fad312a1a8d2c182d/testdata/tracking/goturn.caffemodel.zip.004 > ${GITHUB_WORKSPACE}/testdata/goturn.caffemodel.zip.004 | |
cat ${GITHUB_WORKSPACE}/testdata/goturn.caffemodel.zip.001 ${GITHUB_WORKSPACE}/testdata/goturn.caffemodel.zip.002 ${GITHUB_WORKSPACE}/testdata/goturn.caffemodel.zip.003 ${GITHUB_WORKSPACE}/testdata/goturn.caffemodel.zip.004 > ${GITHUB_WORKSPACE}/testdata/goturn.caffemodel.zip | |
unzip -o ${GITHUB_WORKSPACE}/testdata/goturn.caffemodel.zip goturn.caffemodel -d ${GITHUB_WORKSPACE}/testdata | |
- name: Install Tensorflow test model | |
run: | | |
mkdir -p ${GITHUB_WORKSPACE}/testdata | |
curl -sL https://storage.googleapis.com/download.tensorflow.org/models/inception5h.zip > ${GITHUB_WORKSPACE}/testdata/inception5h.zip | |
unzip -o ${GITHUB_WORKSPACE}/testdata/inception5h.zip tensorflow_inception_graph.pb -d ${GITHUB_WORKSPACE}/testdata | |
- name: Install ONNX test model | |
run: | | |
mkdir -p ${GITHUB_WORKSPACE}/testdata | |
curl -sL https://github.com/onnx/models/raw/main/validated/vision/classification/inception_and_googlenet/googlenet/model/googlenet-9.onnx > ${GITHUB_WORKSPACE}/testdata/googlenet-9.onnx | |
curl -sL https://github.com/opencv/opencv_zoo/raw/refs/heads/main/models/face_recognition_sface/face_recognition_sface_2021dec.onnx > ${GITHUB_WORKSPACE}/testdata/face_recognition_sface_2021dec.onnx | |
curl -sL https://github.com/opencv/opencv_zoo/raw/refs/heads/main/models/face_detection_yunet/face_detection_yunet_2023mar.onnx > ${GITHUB_WORKSPACE}/testdata/face_detection_yunet_2023mar.onnx | |
- name: Run main tests | |
run: xvfb-run -a --error-file /var/log/xvfb_error.log --server-args="-screen 0 1024x768x24 +extension RANDR" go test -v -coverprofile=/tmp/coverage.out -count=1 -tags matprofile . | |
env: | |
DISPLAY: 99.0 | |
GOCV_TENSORFLOW_TEST_FILES: ${{ github.workspace }}/testdata | |
GOCV_ONNX_TEST_FILES: ${{ github.workspace }}/testdata | |
GOCV_TRACKER_GOTURN_TEST_FILES: ${{ github.workspace }}/testdata | |
- name: Run contrib tests | |
run: xvfb-run -a --error-file /var/log/xvfb_error.log --server-args="-screen 0 1024x768x24 +extension RANDR" go test -v -coverprofile=/tmp/contrib.out -count=1 -tags matprofile ./contrib | |
env: | |
DISPLAY: 99.0 | |
- name: Code coverage | |
run: | | |
go tool cover -html=/tmp/coverage.out -o /tmp/coverage.html | |
go tool cover -html=/tmp/contrib.out -o /tmp/contrib.html | |
- name: Archive code coverage results | |
uses: actions/upload-artifact@v3 | |
with: | |
name: code-coverage-report | |
path: /tmp/*.html |