diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index c55bd7b..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,95 +0,0 @@ -version: 2 -# Copyright (C) 2018-2021 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: usdotfhwastoldev/carma-base:develop - user: carma - environment: - TERM: xterm # use xterm to get full display output from build - INIT_ENV: /home/carma/.base-image/init-env.sh - working_directory: "/opt/carma/" - # Execution steps - steps: - - run: - name: Create src folder - command: | - source ${INIT_ENV} - mkdir src - cd src - mkdir CARMAWebUi - mkdir CARMAMsgs - - checkout: - path: src/CARMAWebUi - - run: - name: Pull CARMAMsgs - command: | - source ${INIT_ENV} - git clone -b develop --depth 1 git@github.com:usdot-fhwa-stol/carma-msgs.git src/CARMAMsgs - - run: - name: Build Driver - command: | - source ${INIT_ENV} - make_with_coverage.bash -m -e /opt/carma/ -o ./coverage_reports/gcov - - run: - name: Run C++ Tests - command: | - source ${INIT_ENV} - 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/CARMAWebUi - 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/CARMAWebUi - 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} - diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..5a757c7 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,8 @@ +name: Docker build + +on: + pull_request: + types: [opened, synchronize, reopened] +jobs: + docker: + uses: usdot-fhwa-stol/actions/.github/workflows/docker.yml@main \ No newline at end of file diff --git a/.github/workflows/dockerhub.yml b/.github/workflows/dockerhub.yml new file mode 100644 index 0000000..703f4d2 --- /dev/null +++ b/.github/workflows/dockerhub.yml @@ -0,0 +1,16 @@ +name: Docker Hub build + +on: + push: + branches: + - develop + - master + - "release/*" + tags: + - "carma-system-*" +jobs: + dockerhub: + uses: usdot-fhwa-stol/actions/.github/workflows/dockerhub.yml@main + secrets: + DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} + DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} \ No newline at end of file diff --git a/.sonarqube/sonar-scanner.properties b/.sonarqube/sonar-scanner.properties index dbb9ba5..1aa2284 100644 --- a/.sonarqube/sonar-scanner.properties +++ b/.sonarqube/sonar-scanner.properties @@ -14,14 +14,14 @@ # Configuration file for Sonar Scanner used for CI -sonar.projectKey=usdot-fhwa-stol_CARMAWebUi +sonar.projectKey=usdot-fhwa-stol_carma-web-ui sonar.organization=usdot-fhwa-stol sonar.cfamily.cache.enabled=false sonar.cfamily.compile-commands=/opt/carma/build/compile_commands.json sonar.host.url=https://sonarcloud.io -sonar.sources=website/scripts/, website/utils +sonar.sources=website/ +sonar.exclusions=website/thirdparty/ + # Set Git as SCM sensor -sonar.scm.disabled=false sonar.scm.enabled=true sonar.scm.provider=git -sonar.exclusions=website/scripts/* diff --git a/README.md b/README.md index 0c90076..ec921a1 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -| CicleCI Build Status | Sonar Code Quality | DockerHub Release | DockerHub Release Candidate | DockerHub Develop | -|------|-----|-----|-----|-----| -[![CircleCI](https://img.shields.io/circleci/build/gh/usdot-fhwa-stol/carma-web-ui/develop?label=CircleCI)](https://app.circleci.com/pipelines/github/usdot-fhwa-stol/carma-web-ui?branch=develop) | [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=usdot-fhwa-stol_CARMAWebUi&metric=alert_status)](https://sonarcloud.io/dashboard?id=usdot-fhwa-stol_CARMAWebUi) | [![Docker Cloud Build Status](https://img.shields.io/docker/cloud/build/usdotfhwastol/carma-web-ui?label=Carma-Web-UI)](https://hub.docker.com/repository/docker/usdotfhwastol/carma-web-ui) | [![Docker Cloud Build Status](https://img.shields.io/docker/cloud/build/usdotfhwastolcandidate/carma-web-ui?label=Carma-Web-UI)](https://hub.docker.com/repository/docker/usdotfhwastolcandidate/carma-web-ui) | [![Docker Cloud Build Status](https://img.shields.io/docker/cloud/build/usdotfhwastoldev/carma-web-ui?label=Carma-Web-UI)](https://hub.docker.com/repository/docker/usdotfhwastoldev/carma-web-ui) +| Sonar Code Quality | DockerHub Develop | +|-----|-----| + [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=usdot-fhwa-stol_carma-web-ui&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=usdot-fhwa-stol_carma-web-ui) |[![Docker Hub build](https://github.com/usdot-fhwa-stol/carma-web-ui/actions/workflows/dockerhub.yml/badge.svg?branch=develop)](https://github.com/usdot-fhwa-stol/carma-web-ui/actions/workflows/dockerhub.yml) # CARMAWebUi CARMAWebUi is the web-based user interface component of the CARMAPlatform.