Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run coverity #73

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 24 additions & 7 deletions .github/workflows/tii-depthai-ctrl-coverity.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: tii-depthai-ctrl-coverity

on:
repository_dispatch:
workflow_dispatch:
push:
branches:
- main
Expand All @@ -11,26 +11,43 @@ jobs:
coverity:
runs-on: depthai-ctrl-self-hosted-coverity
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3
with:
driver: docker

- name: Build and push
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile.coverity
push: false
tags: dephai_ctrl_coverity:latest
tags: depthai_ctrl_coverity:latest

- name: Run coverity scan
run:
docker run --rm -e PROJECT_NAME=${{ github.event.repository.name }} dephai_ctrl_coverity:latest
run: |
docker run --rm \
-e PROJECT_NAME=${{ github.event.repository.name }} \
-v "$(pwd):/main_ws/src" \
depthai_ctrl_coverity:latest

- name: Update summary
run: |
cat cov-analyze-result.txt >> $GITHUB_STEP_SUMMARY

- name: Upload coverity scan results
uses: actions/upload-artifact@v3
with:
name: coverity-html-report-${{ github.event.repository.name }}
path: coverity-output
20 changes: 17 additions & 3 deletions Dockerfile.coverity
Original file line number Diff line number Diff line change
@@ -1,8 +1,22 @@
FROM ghcr.io/tiiuae/fog-ros-baseimage-builder-coverity:main
FROM --platform=${BUILDPLATFORM:-linux/amd64} ghcr.io/tiiuae/fog-ros-baseimage-builder-coverity:sha-4da4f0d AS builder

RUN apt update \
&& apt install -y --no-install-recommends \
curl

RUN curl https://artifacts.luxonis.com/artifactory/luxonis-depthai-data-local/network/yolo-v4-tiny-tf_openvino_2021.4_6shave.blob \
-o /tmp/yolo-v4-tiny-tf_openvino_2021.4_6shave.blob

COPY . /main_ws/src/
# There is a file at /sdk_install/sysroots/core2-64-oe-linux/usr/include/depthai-shared/common/optional.hpp which has the
# which has the line '#include "tl/optional.hpp"', change it to this with sed: '#include "depthai-shared/3rdparty/tl/optional.hpp"'
RUN YOCTO_TARGET_ARCH=$(/packaging/arch_translation.sh ${TARGETARCH:-amd64}) && \
sed -i 's/#include "tl\/optional.hpp"/#include "depthai-shared\/3rdparty\/tl\/optional.hpp"/g' /sdk_install/sysroots/${YOCTO_TARGET_ARCH}-oe-linux/usr/include/depthai-shared/common/optional.hpp && \
sed -i 's/#include "tl\/optional.hpp"/#include "depthai-shared\/3rdparty\/tl\/optional.hpp"/g' /sdk_install/sysroots/${YOCTO_TARGET_ARCH}-oe-linux/usr/include/depthai/pipeline/Node.hpp

# CV Bridge cmake file has host contamination, which leads to failure in the build.
# This hardcoded path will be different for each of the build. So, the sed command should find the place using OpenCV_CONFIG_PATH and OpenCV_INSTALL_PATH tags
RUN YOCTO_TARGET_ARCH=$(/packaging/arch_translation.sh ${TARGETARCH:-amd64}) && \
sed -i 's/set(OpenCV_CONFIG_PATH .*)/set(OpenCV_CONFIG_PATH \/sdk_install\/sysroots\/${YOCTO_TARGET_ARCH}-oe-linux\/usr\/lib\/cmake\/opencv4)/g' /sdk_install/sysroots/${YOCTO_TARGET_ARCH}-oe-linux/usr/share/cv_bridge/cmake/cv_bridge-extras.cmake && \
sed -i 's/set(OpenCV_INSTALL_PATH .*)/set(OpenCV_INSTALL_PATH \/sdk_install\/sysroots\/${YOCTO_TARGET_ARCH}-oe-linux\/usr)/g' /sdk_install/sysroots/${YOCTO_TARGET_ARCH}-oe-linux/usr/share/cv_bridge/cmake/cv_bridge-extras.cmake

RUN /packaging/build.sh
WORKDIR /main_ws
Loading