-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
28 additions
and
19 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,33 @@ | ||
FROM ubuntu:latest | ||
LABEL title="C++ Analysis" | ||
LABEL version=0.2 | ||
ENV CXXFLAGS=-std=c++17 | ||
LABEL title="CPP Container" | ||
LABEL version=0.1 | ||
ENV GTEST_REPO=/googletest | ||
ENV GTEST_DIR=${GTEST_REPO}/googletest | ||
ENV WORKDIR=/usr/src | ||
WORKDIR /usr/src | ||
|
||
# Set Docker arguments | ||
ARG DEBIAN_FRONTEND=noninteractive | ||
|
||
# Install dependencies | ||
RUN apt-get update && \ | ||
DEBIAN_FRONTEND=noninteractive \ | ||
apt-get install -y -f \ | ||
dos2unix \ | ||
apt-get install -y \ | ||
build-essential \ | ||
g++ \ | ||
cmake \ | ||
git-all \ | ||
pmccabe \ | ||
cccc | ||
dos2unix | ||
|
||
# Get source and make sure it uses unix line feed (no carriage return) | ||
COPY . ./ | ||
RUN dos2unix * | ||
# Setup GoogleTest | ||
RUN git clone --depth=1 https://github.com/google/googletest ${GTEST_REPO} | ||
RUN mkdir ${GTEST_REPO}/build && cd ${GTEST_REPO}/build \ | ||
&& cmake .. -DBUILD_GMOCK=OFF && make && cd ${WORKDIR} | ||
|
||
# Load repo into image | ||
# Copy repo source into container | ||
COPY . ${WORKDIR} | ||
|
||
# Run static analysis | ||
CMD pmccabe *.cpp -v && \ | ||
cccc --lang=c++ --outdir=report *.cpp | ||
# Assure Unix linefeed for all files | ||
RUN find . -type f -print0 | xargs -0 dos2unix -- | ||
|
||
# Build project | ||
CMD sh -c ${WORKDIR}/test_runner.sh |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
|
||
apt-get -y install pmccabe | ||
pmccabe -v *.cpp | ||
make clean && make |