Skip to content

Commit

Permalink
Run coverity
Browse files Browse the repository at this point in the history
  • Loading branch information
TimoSairiala committed Nov 14, 2023
1 parent 9ec225d commit 77d2e3f
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 10 deletions.
29 changes: 22 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,41 @@ 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
with:
driver: docker
uses: docker/setup-buildx-action@v3

- 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

- name: Run coverity scan
run:
docker run --rm -e PROJECT_NAME=${{ github.event.repository.name }} dephai_ctrl_coverity:latest
docker run --rm \
-e PROJECT_NAME=${{ github.event.repository.name }} \
-v "$(pwd):/main_ws/src" \
dephai_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
22 changes: 19 additions & 3 deletions Dockerfile.coverity
Original file line number Diff line number Diff line change
@@ -1,8 +1,24 @@
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

WORKDIR /main_ws

RUN /packaging/build.sh
# RUN /packaging/build_colcon_sdk.sh ${TARGETARCH:-amd64}

0 comments on commit 77d2e3f

Please sign in to comment.