forked from usdot-jpo-ode/jpo-cvdp
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'usdot/develop' into develop
- Loading branch information
Showing
7 changed files
with
15,538 additions
and
8,950 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,104 @@ | ||
name: jpo-cvdp | ||
on: | ||
push: | ||
|
||
jobs: | ||
jpo-cvdp: | ||
runs-on: ubuntu-latest | ||
container: | ||
image: ubuntu:jammy-20230126 | ||
env: | ||
REDACTION_PROPERTIES_PATH: "/__w/jpo-cvdp/jpo-cvdp/config/fieldsToRedact.txt" # This env vairable is used to run ppm test | ||
BUILD_WRAPPER_OUT_DIR: "$GITHUB_WORKSPACE/bw-output" # This env variable is needed to run SonarSource/sonarcloud-github-c-cpp@v1 | ||
options: "--user root" | ||
steps: | ||
- name: checkout code | ||
uses: actions/checkout@v2 # This action to checkout the code | ||
- name: Install Deps | ||
run: | | ||
apt update | ||
apt-get -y install sudo wget curl gnupg lsb-release gcovr unzip | ||
sudo apt-get -y install software-properties-common | ||
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - | ||
sudo add-apt-repository -y "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | ||
sudo curl -L "https://github.com/docker/compose/releases/download/1.24.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose | ||
chmod +x /usr/local/bin/docker-compose | ||
sudo apt-get -y update | ||
sudo apt-get -y install docker-ce | ||
- name: set up Cmake | ||
uses: jwlawson/[email protected] # this action is used to setup and install Cmake with required versions | ||
with: | ||
cmake-version: '3.16' | ||
- name: install g++ | ||
run: | | ||
sudo apt-get -y install build-essential | ||
sudo apt -y install cmake g++ libprotobuf-dev protobuf-compiler | ||
sudo apt -y install apt-transport-https ca-certificates curl software-properties-common | ||
export CXX="g++" | ||
- name: install librdkafka # This is to install librdkafka package | ||
run: | | ||
git clone --depth 1 https://github.com/confluentinc/librdkafka.git librdkafka | ||
cd librdkafka | ||
cmake -H. -B_cmake_build | ||
cmake --build _cmake_build | ||
cmake --build _cmake_build --target install | ||
- name: Install sonar-scanner and build-wrapper | ||
uses: SonarSource/sonarcloud-github-c-cpp@v1 # This Action Installs sonar cloud and build wrapper to run sonar scan analysis | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
- name: Build | ||
uses: docker/build-push-action@v3 | ||
- name: Build and Generate test coverage | ||
run: | | ||
cd $GITHUB_WORKSPACE | ||
chmod 755 -R /__w/jpo-cvdp/jpo-cvdp | ||
cat /usr/include/asm-generic/signal.h | ||
cat /usr/include/x86_64-linux-gnu/asm/signal.h | ||
export LD_LIBRARY_PATH=/usr/local/lib | ||
build-wrapper-linux-x86-64 --out-dir $GITHUB_WORKSPACE/bw-output ./build.sh | ||
mkdir coverage | ||
cd coverage | ||
gcov $GITHUB_WORKSPACE/cv-lib/src/*.cpp --object-directory /__w/jpo-cvdp/jpo-cvdp/build/cv-lib/CMakeFiles/CVLib.dir/src/ | ||
gcov $GITHUB_WORKSPACE/src/*.cpp --object-directory /__w/jpo-cvdp/jpo-cvdp/build/CMakeFiles/ppm_tests.dir/src/ | ||
- name: Archive code coverage results | ||
uses: actions/upload-artifact@v3 # This action is used to capture the test artifacts and exits if no files are found | ||
with: | ||
name: jpo-cvdp | ||
path: /__w/jpo-cvdp/jpo-cvdp/coverage/ | ||
if-no-files-found: error | ||
- name: Archive buildwrapper output | ||
uses: actions/upload-artifact@v3 # This action is used to capture the builwrapper output files used by sonarscan. | ||
with: | ||
name: jpo-cvdp | ||
path: /home/runner/work/jpo-cvdp/jpo-cvdp/bw-output | ||
- name: Setup SonarScanner | ||
uses: warchant/setup-sonar-scanner@v4 # This action is used to setup sonar scanner with required versions. | ||
with: | ||
version: 4.8.0.2856 | ||
- name: Generate sonar properties file | ||
run: | | ||
cat <<EOF > /tmp/sonar-scanner.properties | ||
sonar.host.url=https://sonarcloud.io | ||
sonar.projectName=jpo-cvdp | ||
sonar.projectVersion=1.0 | ||
sonar.projectKey=usdot-jpo-ode_jpo-cvdp | ||
sonar.organization=usdot-jpo-ode | ||
sonar.sources=. | ||
sonar.exclusions=src/ppm.cpp | ||
sonar.cfamily.build-wrapper-output=bw-output | ||
sonar.cfamily.gcov.reportsPath=/__w/jpo-cvdp/jpo-cvdp/coverage/ | ||
sonar.sonar.projectBaseDir=/home/runner/work/jpo-cvdp/jpo-cvdp/ | ||
sonar.exclusions=**/*.java | ||
sonar.coverage.exclusions=**/*.java | ||
# Set Git as SCM sensor | ||
sonar.scm.disabled=true | ||
#sonar.scm.enabled=false | ||
sonar.scm.provider=git | ||
sonar.sourceEncoding=UTF-8 | ||
EOF | ||
- name: Run SonarScanner | ||
uses: usdot-fhwa-stol/actions/sonar-scanner@main # This action runs the analysis using generated sonar gcov files and publish reports to respective sonarcloud project. | ||
with: | ||
sonar-properties-path: /tmp/sonar-scanner.properties | ||
sonar-token: ${{ secrets.SONAR_TOKEN }} | ||
working-dir: $GITHUB_WORKSPACE |
This file was deleted.
Oops, something went wrong.
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,33 @@ | ||
#!/bin/bash | ||
# Copyright (C) 2018-2020 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. | ||
|
||
# script executes all kafka_clients and scheduling service build and coverage steps so that they can be singularly | ||
# wrapped by the sonarcloud build-wrapper | ||
set -e | ||
|
||
|
||
# check if REDACTION_PROPERTIES_PATH is set | ||
if [ -z "$REDACTION_PROPERTIES_PATH" ] ; then | ||
echo "REDACTION_PROPERTIES_PATH is not set" | ||
exit 1 | ||
fi | ||
|
||
mkdir build | ||
cd build | ||
cmake .. | ||
cmake --build . | ||
|
||
./ppm_tests | ||
ctest --output-on-failure |
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
Oops, something went wrong.