Merge pull request #90 from Biglup/feat/add-json-writer #733
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
name: Static Code Analysis | |
on: | |
pull_request: | |
types: [opened, synchronize, reopened] | |
push: | |
branches: | |
- main | |
tags-ignore: | |
- '*' | |
jobs: | |
static_code_analysis: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install Dependencies | |
run: | | |
sudo apt update | |
sudo apt install cppcheck | |
sudo apt install dos2unix | |
sudo apt install python3 | |
sudo apt install python3-pip | |
sudo apt install build-essential | |
sudo apt install cmake | |
sudo apt install m4 | |
sudo apt install doxygen | |
sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" | |
sudo apt install clang-format-15 | |
pip install sphinx sphinx-immaterial breathe | |
- name: Style Check | |
run: | | |
chmod +x ./scripts/run-clang-format.sh | |
dos2unix ./scripts/run-clang-format.sh | |
CLANG_FORMAT="/usr/bin/clang-format-15" ./scripts/run-clang-format.sh | |
echo "Style check complete" | |
- name: Check General Rules | |
run: cppcheck --enable=all -I "./lib/include" -ilib/external --error-exitcode=1 --suppress=missingIncludeSystem ./lib | |
- name: Check MISRA 2012 Rules | |
env: | |
MISRA2012: ${{ secrets.MISRA2012_RULESET }} | |
run: | | |
echo $MISRA2012 | base64 -di >> $GITHUB_WORKSPACE/scripts/misra/misra2012 | |
cd $GITHUB_WORKSPACE/scripts/misra/ | |
mkdir .results | |
chmod +x check_misra.sh | |
dos2unix check_misra.sh | |
./check_misra.sh -c /usr/bin -o ./.results -q | |
echo "Scan complete" | |
NumViolations=`cat .results/error_count` | |
echo $NumViolations | |
- name: Set up Google Cloud credential # We need this to upload the MISRA Compliance Report to Google Cloud Storage | |
if: always() | |
env: | |
GCP_SA_KEY: ${{ secrets.GCP_SA_KEY }} | |
run: | | |
echo "$GCP_SA_KEY" | base64 -di >> "$HOME"/gcp-key.json | |
echo "GOOGLE_APPLICATION_CREDENTIALS=$HOME/gcp-key.json" >> $GITHUB_ENV | |
- name: Generate MISRA Compliance Report | |
if: always() | |
id: misra-compliance-report | |
uses: Biglup/misra-compliance-github-action@v0.2 | |
with: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
project: 'libcardano-c' | |
parser: 'Cppcheck' | |
results: './scripts/misra/.results/results' | |
rules: './scripts/misra/misra2012' | |
suppressions: './scripts/misra/suppressions' | |
files: './scripts/misra/.results/files.txt' | |
- name: Check Doxygen Documentation | |
run: | | |
cd $GITHUB_WORKSPACE | |
chmod +x ./scripts/verify-documentation.sh | |
dos2unix ./scripts/verify-documentation.sh | |
./scripts/verify-documentation.sh |