Skip to content

Add Misra-C Compliance Checker 2012/2023 Support #30

Add Misra-C Compliance Checker 2012/2023 Support

Add Misra-C Compliance Checker 2012/2023 Support #30

Workflow file for this run

name: Code Coverage
on:
push:
branches: [ 'master', 'main', 'release/**' ]
pull_request:
branches: [ '*' ]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
coverage:
name: Line Coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y autoconf automake libtool lcov
- name: Cache wolfSSL
id: cache-wolfssl
uses: actions/cache@v4
with:
path: ~/wolfssl-install
key: wolfssl-ubuntu-latest-v3
- name: Build wolfSSL
if: steps.cache-wolfssl.outputs.cache-hit != 'true'
run: |
cd ~
git clone --depth 1 https://github.com/wolfSSL/wolfssl.git
cd wolfssl
./autogen.sh
./configure --enable-ecc --enable-ed25519 --enable-ed448 \
--enable-curve25519 --enable-aesgcm --enable-aesccm \
--enable-sha384 --enable-sha512 --enable-keygen \
--enable-rsapss --enable-chacha --enable-poly1305 \
--enable-dilithium \
--prefix=$HOME/wolfssl-install
make -j$(nproc)
make install
- name: Run coverage
run: |
export WOLFSSL_DIR=$HOME/wolfssl-install
export LD_LIBRARY_PATH=$WOLFSSL_DIR/lib
make coverage CC=gcc \
CFLAGS="-std=c99 -Os -Wall -Wextra -Wpedantic -Wshadow -Wconversion -I./include -I$WOLFSSL_DIR/include" \
LDFLAGS="-L$WOLFSSL_DIR/lib -lwolfssl"
- name: Check coverage threshold
run: |
COVERAGE=$(lcov --summary coverage.info 2>&1 | grep 'lines' | grep -oP '[\d.]+(?=%)')
echo "Line coverage: ${COVERAGE}%"
if [ "$(awk "BEGIN {print ($COVERAGE < 85)}")" -eq 1 ]; then
echo "FAIL: Line coverage ${COVERAGE}% is below 85% threshold"
exit 1
fi
echo "PASS: Line coverage ${COVERAGE}% meets 85% threshold"