Skip to content

Commit

Permalink
Merge pull request #40 from usdot-jpo-ode/release_q3
Browse files Browse the repository at this point in the history
Release Q3 release into master
  • Loading branch information
dan-du-car authored Nov 29, 2023
2 parents 792abc0 + 49f483d commit af8a1a7
Show file tree
Hide file tree
Showing 10 changed files with 15,582 additions and 8,895 deletions.
149 changes: 149 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
name: asn1-codec

on: [pull_request, push]
# Trigger this workflow on code pushes and pull requests

jobs:
asn1-codec:
runs-on: ubuntu-latest
container:
image: ubuntu:jammy-20230126
env:
working-directory: /asn1_codec
BUILD_WRAPPER_OUT_DIR: "$GITHUB_WORKSPACE/bw-output"
options: "--user root"
steps:
- name: checkout code
uses: actions/checkout@v2
# Checkout the code from the repository

- name: Install necessary dependencies
run: |
apt update
apt-get -y install sudo wget curl gnupg lsb-release gcovr unzip gcc-multilib libasan*
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
working-directory: ${{ env.working-directory }}

- name: Install g++ and related dependencies
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++"
sudo apt install -y gcc-12 g++-12
sudo apt -y install libpng-dev libgraphicsmagick1-dev libcairo2-dev
working-directory: ${{ env.working-directory }}

- name: Install librdkafka
run: |
sudo apt-get -y update && sudo apt-get -y upgrade
sudo apt-get -y install automake flex bison
sudo apt-get -y install build-essential
sudo apt -y install cmake g++ libprotobuf-dev protobuf-compiler
sudo apt-get install autotools-dev
sudo apt -y install apt-transport-https ca-certificates curl software-properties-common
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
working-directory: ${{ env.working-directory }}

- name: Install pugixml
run: |
git clone https://github.com/vlm/asn1c.git
git clone https://github.com/zeux/pugixml.git
cd ./pugixml && mkdir -p build && cd build && cmake .. && make && make install
working-directory: ${{ env.working-directory }}

- name: Build and install asn1c submodule
run: |
sudo apt-get -y install libtool autoconf
cd ./asn1c && aclocal && test -f configure || autoreconf -iv && ./configure && make && make install
working-directory: ${{ env.working-directory }}

- name: Generate ASN.1 API.
run: |
export LD_LIBRARY_PATH=/usr/local/lib
git clone https://github.com/usdot-jpo-ode/scms-asn1.git
cd ./asn1c_combined && bash doIt.sh
working-directory: ${{ env.working-directory }}

- name: Export environment variables
run: |
echo "export LD_LIBRARY_PATH=/usr/local/lib" >> ~/.profile
echo "export LD_LIBRARY_PATH=/usr/local/lib" >> ~/.bashrc
echo "export CC=gcc" >> ~/.profile
echo "export CC=gcc" >> ~/.bashrc
working-directory: ${{ env.working-directory }}

- name: Install sonar-scanner and build-wrapper
uses: SonarSource/sonarcloud-github-c-cpp@v1
# Install SonarScanner and build-wrapper for code analysis

- name: Build and Generate test coverage
run: |
sudo su - root
sudo chmod o+w /root
sudo chmod 755 -R /__w/asn1_codec/asn1_codec/
export BUILD_WRAPPER_OUT_DIR=$GITHUB_WORKSPACE/bw-output
build-wrapper-linux-x86-64 --out-dir $GITHUB_WORKSPACE/bw-output ./build.sh
mkdir coverage
cd coverage
gcov $GITHUB_WORKSPACE/kafka-test/src/*.cpp --object-directory /__w/asn1-codec/asn1-codec/build/kafka-test/CMakeFiles/Kafka-TestLib.dir/src/
gcov $GITHUB_WORKSPACE/src/*.cpp --object-directory /__w/asn1-codec/asn1-codec/build/CMakeFiles/ppm_tests.dir/src/
working-directory: ${{ env.working-directory }}

- name: Archive code coverage results
uses: actions/upload-artifact@v3
with:
name: asn1-codec
path: /__w/asn1-codec/asn1-codec/coverage/
# Archive code coverage results for later reference

- name: Archive buildwrapper output
uses: actions/upload-artifact@v3
with:
name: asn1-codec
path: /home/runner/work/asn1-codec/asn1-codec/bw-output
# Archive build-wrapper output

- name: Setup SonarScanner
uses: warchant/setup-sonar-scanner@v4
with:
version: 4.8.0.2856
# Set up SonarScanner for code analysis

- name: Generate sonar properties file
run: |
# Generate SonarScanner properties file
cat <<EOF > /tmp/sonar-scanner.properties
sonar.host.url=https://sonarcloud.io
sonar.projectName=asn1-codec
sonar.projectVersion=1.0
sonar.projectKey=usdot-jpo-ode_asn1-codec
sonar.organization=usdot-jpo-ode
sonar.sources=src,kafka-test/src,include
sonar.cfamily.build-wrapper-output=bw-output
sonar.cfamily.gcov.reportsPath=/__w/asn1-codec/asn1-codec/coverage/
sonar.sonar.projectBaseDir=/home/runner/work/asn1-codec/asn1-codec/
sonar.exclusions=**/*.java
sonar.coverage.exclusions=**/*.java
sonar.exclusions=pugixml/tests/data/**
# Set Git as SCM sensor
sonar.scm.disabled=true
sonar.scm.provider=git
sonar.sourceEncoding=UTF-8
EOF
- name: SonarScanner
uses: usdot-fhwa-stol/actions/sonar-scanner@main
with:
sonar-properties-path: /tmp/sonar-scanner.properties
sonar-token: ${{ secrets.SONAR_TOKEN }}
working-dir: $GITHUB_WORKSPACE
28 changes: 28 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/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

ls -la && pwd

# build asn1_codec
mkdir build
cd build
cmake ..
cmake --build .
make
ctest --output-on-failure
4 changes: 3 additions & 1 deletion docker-compose-confluent-cloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ services:
ACM_LOG_LEVEL: ${ACM_LOG_LEVEL}
CONFLUENT_KEY: ${CONFLUENT_KEY}
CONFLUENT_SECRET: ${CONFLUENT_SECRET}
restart: on-failure
aem:
build:
context: .
Expand All @@ -25,4 +26,5 @@ services:
ACM_LOG_TO_FILE: "false"
ACM_LOG_LEVEL: ${ACM_LOG_LEVEL}
CONFLUENT_KEY: ${CONFLUENT_KEY}
CONFLUENT_SECRET: ${CONFLUENT_SECRET}
CONFLUENT_SECRET: ${CONFLUENT_SECRET}
restart: on-failure
3 changes: 2 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,5 @@ services:
ACM_CONFIG_FILE: adm.properties
ACM_LOG_TO_CONSOLE: "${ACM_LOG_TO_CONSOLE}"
ACM_LOG_TO_FILE: "${ACM_LOG_TO_FILE}"
ACM_LOG_LEVEL: "${ACM_LOG_LEVEL}"
ACM_LOG_LEVEL: "${ACM_LOG_LEVEL}"
restart: on-failure
18 changes: 18 additions & 0 deletions docs/Release_notes.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,24 @@
asn1_codec Release Notes
----------------------------

Version 1.5.0, released November 2023
----------------------------------------

### **Summary**
The changes for the asn1_codec 1.5.0 include improved compatibility, a new build script, enhanced code analysis, uniform logging levels, auto-restart for Docker-compose, a default logging level change, and graceful shutdown for ACM in response to errors.
- The catch dependency has been updated to a more recent version to ensure compatibility and reliability.
- Added `build.sh script`
- A new sonar configuration has been included to enhance code analysis capabilities.
- The logging level strings have been converted to uppercase to match those in other submodules.
- Docker-compose.yml files have been modified to automatically restart in case of failure.
- The default logging level has been changed from TRACE to ERROR.
- ACM will now gracefully shut down when it encounters a transport error or an unrecognized Kafka error.

Known Issues:
1. The do_kafka_test.sh script in the project's root directory is currently not running successfully. The issue is being investigated and will be addressed in a future update.
2. According to Valgrind, a minor memory leak has been detected. The development team is aware of this and is actively working on resolving it.


Version 1.4.0, released July 5th 2023
----------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion include/acmLogger.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class AcmLogger {
long LOG_SIZE = 1048576 * 5; ///> The size of a single log; these rotate.
int LOG_NUM = 5; ///> The number of logs to rotate.

spdlog::level::level_enum loglevel = spdlog::level::trace; ///> Log level for the logger.
spdlog::level::level_enum loglevel = spdlog::level::err; ///> Log level for the logger.

std::shared_ptr<spdlog::logger> spdlogger; ///> The spdlog logger.

Expand Down
Loading

0 comments on commit af8a1a7

Please sign in to comment.