Skip to content

Commit

Permalink
Fix nasa#69, Add static analysis and format check
Browse files Browse the repository at this point in the history
  • Loading branch information
skliper committed Feb 1, 2021
1 parent 445fd6c commit c59dcdd
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 39 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/format-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Format Check

# Run on main push and pull requests
on:
push:
branches:
- main
pull_request:

jobs:

static-analysis:
name: Run format check
runs-on: ubuntu-18.04
timeout-minutes: 15

steps:

- name: Install format checker
run: |
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo add-apt-repository 'deb https://apt.llvm.org/bionic/ llvm-toolchain-bionic-10 main'
sudo apt-get update && sudo apt-get install clang-format-10
- name: Checkout bundle
uses: actions/checkout@v2
with:
repository: nasa/cFS

- name: Checkout
uses: actions/checkout@v2
with:
path: repo

- name: Generate format differences
run: |
cd repo
find . -name "*.[ch]" -exec clang-format-10 -i -style=file {} +
git diff > $GITHUB_WORKSPACE/style_differences.txt
- name: Archive Static Analysis Artifacts
uses: actions/upload-artifact@v2
with:
name: style_differences
path: style_differences.txt

- name: Error on differences
run: |
if [[ -s style_differences.txt ]];
then
cat style_differences.txt
exit -1
fi
40 changes: 40 additions & 0 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Static Analysis

# Run on main push and pull requests
on:
push:
branches:
- main
pull_request:

jobs:

static-analysis:
name: Run cppcheck
runs-on: ubuntu-18.04
timeout-minutes: 15

steps:

- name: Install cppcheck
run: sudo apt-get install cppcheck -y

- name: Checkout code
uses: actions/checkout@v2

- name: Run general cppcheck
run: cppcheck --force --inline-suppr --quiet . 2> cppcheck_err.txt

- name: Archive Static Analysis Artifacts
uses: actions/upload-artifact@v2
with:
name: cppcheck-err
path: ./cppcheck_err.txt

- name: Check for errors
run: |
if [[ -s cppcheck_err.txt ]];
then
cat cppcheck_err.txt
exit -1
fi
39 changes: 0 additions & 39 deletions .travis.yml

This file was deleted.

3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
![Static Analysis](https://github.com/nasa/ci_lab/workflows/Static%20Analysis/badge.svg)
![Format Check](https://github.com/nasa/ci_lab/workflows/Format%20Check/badge.svg)

# Core Flight System : Framework : App : Command Ingest Lab

This repository contains NASA's Command Ingest Lab (ci_lab), which is a framework component of the Core Flight System.
Expand Down

0 comments on commit c59dcdd

Please sign in to comment.