From 72da4f28bc925d13f36d38e0016029a96b0770d7 Mon Sep 17 00:00:00 2001 From: Jacob Hageman Date: Wed, 3 Feb 2021 11:10:54 -0500 Subject: [PATCH] Fix #771, Add workflow timeout and format check --- .github/workflows/format-check.yml | 53 +++++++++++++++++++++++ .github/workflows/static-analysis.yml | 1 + .travis.yml | 61 --------------------------- README.md | 3 +- 4 files changed, 56 insertions(+), 62 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 000000000..0a998eccb --- /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 3a4f0e9cd..b81b11aa5 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -12,6 +12,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 17b4806e5..000000000 --- a/.travis.yml +++ /dev/null @@ -1,61 +0,0 @@ -os: linux -dist: bionic -language: c -compiler: - - gcc -addons: - apt: - sources: - - ubuntu-toolchain-r-test - packages: - - cmake cppcheck lcov - -_functional_test: &functional_test - script: - # Check versions - - cppcheck --version - - #cppcheck flight software osal/src/bsp, osal/src/os - - cppcheck --force --inline-suppr --std=c99 --language=c --error-exitcode=1 - --enable=warning,performance,portability,style --suppress=variableScope - --inconclusive --quiet src/bsp src/os 2>cppcheck_flight_osal.txt - - | - if [[ -s cppcheck_flight_osal.txt ]]; then - echo "You must fix cppcheck errors before submitting a pull request" - echo "" - cat cppcheck_flight_osal.txt - exit -1 - fi - - # Setup - - mkdir build - - cd build - - # Prep and build - - cmake -DENABLE_UNIT_TESTS=true -DOSAL_SYSTEM_BSPTYPE=generic-linux -DOSAL_CONFIG_DEBUG_PERMISSIVE_MODE=TRUE .. - - make - - # lcov capture pre-execution - - lcov --rc lcov_branch_coverage=1 --capture --initial --directory ./ --output-file coverage_base.info - - # Test - - make test - - # lcov post run analysis - - lcov --rc lcov_branch_coverage=1 --capture --directory ./ --output-file coverage_test.info - - lcov --rc lcov_branch_coverage=1 --add-tracefile coverage_base.info --add-tracefile - coverage_test.info --output-file coverage_total.info - - lcov --rc lcov_branch_coverage=1 --remove coverage_total.info '*unit-test-coverage*' - --output-file coverage_filtered.info - - genhtml coverage_filtered.info --output-directory lcov - -jobs: - include: - - env: BUILDTYPE=release OSAL_OMIT_DEPRECATED=true - <<: *functional_test - - env: BUILDTYPE=release OSAL_OMIT_DEPRECATED=false - <<: *functional_test - - env: BUILDTYPE=debug OSAL_OMIT_DEPRECATED=true - <<: *functional_test - - env: BUILDTYPE=debug OSAL_OMIT_DEPRECATED=false - <<: *functional_test diff --git a/README.md b/README.md index 51e3caaff..04f6c960d 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ -Travis-CI: [![Build Status](https://travis-ci.com/nasa/osal.svg)](https://travis-ci.com/nasa/osal) +![Static Analysis](https://github.com/nasa/osal/workflows/Static%20Analysis/badge.svg) +![Format Check](https://github.com/nasa/osal/workflows/Format%20Check/badge.svg) # Core Flight System : Framework : Operating System Abstraction Layer