static code analysis: introduce automated scans via SonarCloud
This adds Travis and Docker configurations for automated scans, both for master branch and internal PRs. External PRs won't be checked due to security concerns (and Travis limitation related to that) - GH and SonarCloud tokens are not propagated to those. An organization and project must be created in SonarCloud for reporting, as well as a technical GH user with mraa repo commit permission, to set PR statuses in the "checks" section. Signed-off-by: Alex Tereschenko <alext.mkrs@gmail.com>
This commit is contained in:
20
Dockerfile
20
Dockerfile
@@ -7,7 +7,7 @@ RUN apt-get -y update && \
|
||||
# Install apt-utils
|
||||
apt-get -y --no-install-recommends install apt-utils && \
|
||||
# Main Build Dependencies
|
||||
apt-get -y --no-install-recommends install git build-essential cmake clang-3.8 g++-4.8 wget libpcre3 libpcre3-dev \
|
||||
apt-get -y --no-install-recommends install git build-essential cmake clang-3.8 g++-4.8 wget unzip libpcre3 libpcre3-dev \
|
||||
# Docs Build Dependencies
|
||||
python-sphinx doxygen graphviz \
|
||||
# Python Build Dependencies
|
||||
@@ -25,8 +25,22 @@ RUN wget http://iotdk.intel.com/misc/tr/swig-3.0.10.tar.gz && \
|
||||
# Node.js Build Dependencies
|
||||
RUN wget -q -O - https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash
|
||||
|
||||
# Static code analysis scanner
|
||||
ENV SONAR_DIR /usr/sonar
|
||||
ENV SONAR_VER "3.0.3.778"
|
||||
WORKDIR $SONAR_DIR
|
||||
|
||||
RUN wget https://sonarsource.bintray.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-${SONAR_VER}-linux.zip && \
|
||||
wget https://sonarqube.com/static/cpp/build-wrapper-linux-x86.zip && \
|
||||
unzip sonar-scanner-cli-${SONAR_VER}-linux.zip && \
|
||||
unzip build-wrapper-linux-x86.zip && \
|
||||
rm sonar-scanner-cli-${SONAR_VER}-linux.zip build-wrapper-linux-x86.zip
|
||||
|
||||
ENV PATH $SONAR_DIR/sonar-scanner-${SONAR_VER}-linux/bin:$SONAR_DIR/build-wrapper-linux-x86:$PATH
|
||||
|
||||
# Set Workdir
|
||||
WORKDIR /usr/src/app
|
||||
ARG MRAA_SRC_DIR
|
||||
WORKDIR $MRAA_SRC_DIR
|
||||
|
||||
# Configure Build Arguments
|
||||
ARG BUILDARCH
|
||||
@@ -72,7 +86,7 @@ RUN tr -d "\r" < src/doxy2swig.py > src/_doxy2swig.py && \
|
||||
chmod u+x src/doxy2swig.py
|
||||
|
||||
# Change Workdir to build directory
|
||||
WORKDIR /usr/src/app/build
|
||||
WORKDIR $MRAA_SRC_DIR/build
|
||||
|
||||
# Run cmake
|
||||
RUN . $NVM_DIR/nvm.sh && cmake \
|
||||
|
||||
Reference in New Issue
Block a user