From 377246aa3c8e5e64ba4a910b8d6c30b1643d21ae Mon Sep 17 00:00:00 2001 From: Jacob Hageman Date: Wed, 3 Feb 2021 09:30:09 -0500 Subject: [PATCH] Fix #230, Add workflow timeout and format check --- .github/workflows/format-check.yml | 53 +++++++++++++++++++++++++++ .github/workflows/static-analysis.yml | 1 + .travis.yml | 29 --------------- README.md | 3 +- 4 files changed, 56 insertions(+), 30 deletions(-) create mode 100644 .github/workflows/format-check.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/format-check.yml b/.github/workflows/format-check.yml new file mode 100644 index 00000000..0a998ecc --- /dev/null +++ b/.github/workflows/format-check.yml @@ -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 http://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 diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index 23d9383b..6cd027f9 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -13,6 +13,7 @@ jobs: static-analysis: name: Run cppcheck runs-on: ubuntu-18.04 + timeout-minutes: 15 strategy: fail-fast: false diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index dc7ddea5..00000000 --- a/.travis.yml +++ /dev/null @@ -1,29 +0,0 @@ -os: linux -dist: bionic -language: c -compiler: - - gcc -addons: - apt: - sources: - - ubuntu-toolchain-r-test - packages: - - cmake - -before_install: - - sudo apt-get install cppcheck - -script: - # Check versions - - cppcheck --version - - #cppcheck flight software psp/fsw - - cppcheck --force --inline-suppr --std=c99 --language=c --error-exitcode=1 --enable=warning,performance,portability,style --suppress=variableScope --inconclusive fsw 2>cppcheck_flight_psp.txt - - | - if [[ -s cppcheck_flight_psp.txt ]]; then - echo "You must fix cppcheck errors before submitting a pull request" - echo "" - cat cppcheck_flight_psp.txt - exit -1 - fi - diff --git a/README.md b/README.md index f5e28c1f..6cc43c30 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ -Travis-CI: [![Build Status](https://travis-ci.com/nasa/PSP.svg)](https://travis-ci.com/nasa/PSP) +![Static Analysis](https://github.com/nasa/psp/workflows/Static%20Analysis/badge.svg) +![Format Check](https://github.com/nasa/psp/workflows/Format%20Check/badge.svg) # Core Flight System : Framework : Platform Support Package