forked from srv/avt_vimba_camera
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from usdot-fhwa-stol/release/RX7
Release/rx7
- Loading branch information
Showing
21 changed files
with
669 additions
and
77 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 |
---|---|---|
@@ -0,0 +1,97 @@ | ||
version: 2 | ||
|
||
# Copyright (C) 2018-2019 LEIDOS. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); you may not | ||
# use this file except in compliance with the License. You may obtain a copy of | ||
# the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
# License for the specific language governing permissions and limitations under | ||
# the License. | ||
# | ||
|
||
# Configuration file for Circle CI | ||
# CI will report failure if any executed command returns and error status | ||
# Operations performed are as follows | ||
# Build source code | ||
# Run unit tests for C++ and Java | ||
# Run static code analyzer for SourceCloud | ||
# Upload test results | ||
# Every run command should start with source ${INIT_ENV} to ensure all default dependancies are available | ||
jobs: | ||
build: | ||
# Pull docker image from docker hub | ||
# XTERM used for better catkin_make output | ||
docker: | ||
- image: usdotfhwastol/carma-base-ci:2.8.4 | ||
user: carma | ||
environment: | ||
TERM: xterm | ||
INIT_ENV: /home/carma/.base-image/init-env.sh | ||
# Set working directory | ||
working_directory: "/opt/carma/" | ||
# Pull code and execute tests | ||
# Name of each run command defines purpose use | ||
steps: | ||
- run: | ||
name: Create src folder | ||
command: | | ||
source ${INIT_ENV} | ||
mkdir src | ||
cd src | ||
mkdir CARMAAvtVimbaDriver | ||
mkdir CARMAMsgs | ||
# Checkout PR branch | ||
- checkout: | ||
path: src/CARMAAvtVimbaDriver | ||
- run: | ||
name: Pull CARMAMsgs | ||
command: | | ||
source ${INIT_ENV} | ||
git clone -b develop --depth 1 git@github.com:usdot-fhwa-stol/CARMAMsgs.git src/CARMAMsgs | ||
- run: | ||
name: Build Driver | ||
command: | | ||
source ${INIT_ENV} | ||
build-wrapper-linux-x86-64 --out-dir /opt/carma/bw-output bash make_with_coverage.bash -m -e /opt/carma/ -o ./coverage_reports/gcov | ||
- run: | ||
name: Run C++ Tests | ||
command: | | ||
source ${INIT_ENV} | ||
bash make_with_coverage.bash -t -e /opt/carma/ -o ./coverage_reports/gcov | ||
# Run SonarCloud analysis | ||
# PR Branchs and number extracted from Circle variables and github api | ||
# Circle CI seems to make a change to the base branch, so we must fetch --force to ensure correct git file change stats | ||
# SONAR_SCANNER_TOKEN MUST be secured as an environment variable in Circle CI NOT in this file. | ||
# The following sonar settings MUST be set in SonarCloud UI NOT in this file | ||
# sonar.pullrequest.provider | ||
# sonar.pullrequest.github.endpoint | ||
# sonar.pullrequest.github.token.secured | ||
# sonar.pullrequest.github.repository | ||
# Use -X on sonar-scanner to enable debug output | ||
- run: | ||
name: Run Sonar Scanner | ||
command: | | ||
source ${INIT_ENV} | ||
if [ -z "${CIRCLE_PULL_REQUEST}" ]; then | ||
echo "Non-PR Build Detected. Running analysis on ${CIRCLE_BRANCH}" | ||
cd src/CARMAAvtVimbaDriver | ||
sonar-scanner -Dproject.settings=.sonarqube/sonar-scanner.properties -Dsonar.login=${SONAR_SCANNER_TOKEN} | ||
exit 0; | ||
fi | ||
echo "PR branch ${CIRCLE_BRANCH}" | ||
echo "Repo name ${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}" | ||
echo "URL ${CIRCLE_PULL_REQUEST}" | ||
export PR_NUM=`echo ${CIRCLE_PULL_REQUEST} | cut -d'/' -f7` | ||
echo "PR number ${PR_NUM}" | ||
export BASE_BRANCH_URL="https://api.github.com/repos/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}/pulls/${PR_NUM}" | ||
export TARGET_BRANCH=$(curl "$BASE_BRANCH_URL" | jq '.base.ref' | tr -d '"') | ||
echo "Target Branch = ${TARGET_BRANCH}" | ||
cd src/CARMAAvtVimbaDriver | ||
git fetch --force origin ${TARGET_BRANCH}:${TARGET_BRANCH} | ||
sonar-scanner -Dproject.settings=.sonarqube/sonar-scanner.properties -Dsonar.login=${SONAR_SCANNER_TOKEN} -Dsonar.pullrequest.base=${TARGET_BRANCH} -Dsonar.pullrequest.branch=${CIRCLE_BRANCH} -Dsonar.pullrequest.key=${PR_NUM} |
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,27 @@ | ||
# Copyright (C) 2018-2019 LEIDOS. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); you may not | ||
# use this file except in compliance with the License. You may obtain a copy of | ||
# the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
# License for the specific language governing permissions and limitations under | ||
# the License. | ||
|
||
# Configuration file for Sonar Scanner used for CI | ||
|
||
sonar.projectKey=usdot-fhwa-stol_CARMAAvtVimbaDriver | ||
sonar.organization=usdot-fhwa-stol | ||
sonar.cfamily.build-wrapper-output=/opt/carma/bw-output | ||
sonar.host.url=https://sonarcloud.io | ||
sonar.sources=src/ | ||
sonar.cfamily.gcov.reportsPath=/opt/carma/coverage_reports/gcov | ||
sonar.tests=test/ | ||
# Set Git as SCM sensor | ||
sonar.scm.disabled=false | ||
sonar.scm.enabled=true | ||
sonar.scm.provider=git |
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,41 @@ | ||
# Copyright (C) 2018-2019 LEIDOS. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); you may not | ||
# use this file except in compliance with the License. You may obtain a copy of | ||
# the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
# License for the specific language governing permissions and limitations under | ||
# the License. | ||
|
||
FROM usdotfhwastol/carma-base:2.8.3 as setup | ||
|
||
RUN mkdir ~/src | ||
COPY --chown=carma . /home/carma/src/ | ||
RUN ~/src/docker/checkout.sh | ||
RUN ~/src/docker/install.sh | ||
|
||
FROM usdotfhwastol/carma-base:2.8.3 | ||
|
||
ARG BUILD_DATE="NULL" | ||
ARG VERSION="NULL" | ||
ARG VCS_REF="NULL" | ||
|
||
LABEL org.label-schema.schema-version="1.0" | ||
LABEL org.label-schema.name="carma-avt-vimba-driver" | ||
LABEL org.label-schema.description="AVT VIMBA vision driver + driver wrapper for the CARMA Platform" | ||
LABEL org.label-schema.vendor="Leidos" | ||
LABEL org.label-schema.version=${VERSION} | ||
LABEL org.label-schema.url="https://highways.dot.gov/research/research-programs/operations/CARMA" | ||
LABEL org.label-schema.vcs-url="https://github.com/usdot-fhwa-stol/CARMAAvtVimbaDriver/" | ||
LABEL org.label-schema.vcs-ref=${VCS_REF} | ||
LABEL org.label-schema.build-date=${BUILD_DATE} | ||
|
||
COPY --from=setup /home/carma/install /opt/carma/app/bin | ||
RUN sudo chmod -R +x /opt/carma/app/bin | ||
|
||
CMD [ "wait-for-it.sh", "localhost:11311", "--", "roslaunch", "avt_vimba_camera", "mono_camera.launch", "remap_ns:=/saxton_cav/drivers" ] |
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,80 @@ | ||
#!/bin/bash | ||
|
||
# Copyright (C) 2018-2019 LEIDOS. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); you may not | ||
# use this file except in compliance with the License. You may obtain a copy of | ||
# the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
# License for the specific language governing permissions and limitations under | ||
# the License. | ||
|
||
USERNAME=usdotfhwastol | ||
|
||
cd "$(dirname "$0")" | ||
IMAGE=$(./get-package-name.sh | tr '[:upper:]' '[:lower:]') | ||
|
||
echo "" | ||
echo "##### $IMAGE Docker Image Build Script #####" | ||
echo "" | ||
|
||
while [[ $# -gt 0 ]]; do | ||
arg="$1" | ||
case $arg in | ||
-v|--version) | ||
COMPONENT_VERSION_STRING="$2" | ||
shift | ||
shift | ||
;; | ||
--system-release) | ||
SYSTEM_RELEASE=true | ||
shift | ||
;; | ||
-p|--push) | ||
PUSH=true | ||
shift | ||
;; | ||
esac | ||
done | ||
|
||
if [[ -z "$COMPONENT_VERSION_STRING" ]]; then | ||
COMPONENT_VERSION_STRING=$("./get-component-version.sh") | ||
fi | ||
|
||
echo "Building docker image for $IMAGE version: $COMPONENT_VERSION_STRING" | ||
echo "Final image name: $USERNAME/$IMAGE:$COMPONENT_VERSION_STRING" | ||
|
||
cd .. | ||
docker build --no-cache -t $USERNAME/$IMAGE:$COMPONENT_VERSION_STRING \ | ||
--build-arg VERSION="$COMPONENT_VERSION_STRING" \ | ||
--build-arg VCS_REF=`git rev-parse --short HEAD` \ | ||
--build-arg BUILD_DATE=`date -u +”%Y-%m-%dT%H:%M:%SZ”` . | ||
|
||
TAGS=() | ||
TAGS+=("$USERNAME/$IMAGE:$COMPONENT_VERSION_STRING") | ||
|
||
docker tag $USERNAME/$IMAGE:$COMPONENT_VERSION_STRING $USERNAME/$IMAGE:latest | ||
TAGS+=("$USERNAME/$IMAGE:latest") | ||
|
||
echo "Tagged $USERNAME/$IMAGE:$COMPONENT_VERSION_STRING as $USERNAME/$IMAGE:latest" | ||
|
||
if [ "$SYSTEM_RELEASE" = true ]; then | ||
SYSTEM_VERSION_STRING=$("./get-system-version.sh") | ||
docker tag $USERNAME/$IMAGE:$COMPONENT_VERSION_STRING $USERNAME/$IMAGE:$SYSTEM_VERSION_STRING | ||
echo "Tagged $USERNAME/$IMAGE:$COMPONENT_VERSION_STRING as $USERNAME/$IMAGE:$SYSTEM_VERSION_STRING" | ||
TAGS+=("$USERNAME/$IMAGE:$SYSTEM_VERSION_STRING") | ||
fi | ||
|
||
if [ "$PUSH" = true ]; then | ||
for tag in $TAGS; do | ||
docker push "${tag}" | ||
done | ||
fi | ||
|
||
echo "" | ||
echo "##### $IMAGE Docker Image Build Done! #####" |
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,21 @@ | ||
#!/bin/bash | ||
|
||
# Copyright (C) 2018-2019 LEIDOS. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); you may not | ||
# use this file except in compliance with the License. You may obtain a copy of | ||
# the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
# License for the specific language governing permissions and limitations under | ||
# the License. | ||
|
||
# CARMA packages checkout script | ||
|
||
set -ex | ||
|
||
git clone https://github.com/usdot-fhwa-stol/CARMAMsgs.git ~/src/CARMAMsgs |
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,21 @@ | ||
#!/bin/bash | ||
|
||
# Copyright (C) 2018-2019 LEIDOS. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); you may not | ||
# use this file except in compliance with the License. You may obtain a copy of | ||
# the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
# License for the specific language governing permissions and limitations under | ||
# the License. | ||
|
||
cd "$(dirname "$0")" | ||
cd .. | ||
COMPONENT_TAG_PREFIX="${PWD##*/}" | ||
git describe --all --match="$COMPONENT_TAG_PREFIX*" --always --dirty="-SNAPSHOT" | awk -F "/" '{print $NF}' | sed "s/$COMPONENT_TAG_PREFIX\_//" | ||
|
Oops, something went wrong.