-
Notifications
You must be signed in to change notification settings - Fork 204
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix #2009, Reuse CodeQL, Static Analysis, and Format Check
- Loading branch information
1 parent
c5c70e3
commit c0287c5
Showing
3 changed files
with
14 additions
and
216 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,67 +1,11 @@ | ||
name: Format Check | ||
|
||
# Run on main push and pull requests | ||
# Run on all push and pull requests | ||
on: | ||
push: | ||
pull_request: | ||
|
||
jobs: | ||
#Checks for duplicate actions. Skips push actions if there is a matching or duplicate pull-request action. | ||
check-for-duplicates: | ||
runs-on: ubuntu-latest | ||
# Map a step output to a job output | ||
outputs: | ||
should_skip: ${{ steps.skip_check.outputs.should_skip }} | ||
steps: | ||
- id: skip_check | ||
uses: fkirc/skip-duplicate-actions@master | ||
with: | ||
concurrent_skipping: 'same_content' | ||
skip_after_successful_duplicate: 'true' | ||
do_not_skip: '["pull_request", "workflow_dispatch", "schedule"]' | ||
|
||
format-check: | ||
#Continue if check-for-duplicates found no duplicates. Always runs for pull-requests. | ||
needs: check-for-duplicates | ||
if: ${{ needs.check-for-duplicates.outputs.should_skip != 'true' }} | ||
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 | ||
uses: nasa/cFS/.github/workflows/format-check.yml@main |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,14 @@ | ||
name: Static Analysis | ||
|
||
# Run this workflow every time a new commit pushed to your repository | ||
# Run on all push and pull requests | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
jobs: | ||
|
||
static-analysis: | ||
name: Run cppcheck | ||
runs-on: ubuntu-18.04 | ||
timeout-minutes: 15 | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
cppcheck: [all, cfe] | ||
|
||
steps: | ||
|
||
- name: Install cppcheck | ||
run: sudo apt-get install cppcheck -y | ||
|
||
# Checks out a copy of the cfs bundle | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
with: | ||
submodules: true | ||
|
||
- name: Run bundle cppcheck | ||
if: ${{matrix.cppcheck =='all'}} | ||
run: cppcheck --force --inline-suppr . 2> ${{matrix.cppcheck}}_cppcheck_err.txt | ||
|
||
# Run strict static analysis for embedded portions of cfe | ||
- name: cfe strict cppcheck | ||
if: ${{matrix.cppcheck =='cfe'}} | ||
run: | | ||
all_fsw_modules="core_api core_private es evs fs msg resourceid sb sbr tbl time" | ||
/bin/bash ./.github/workflows/run_fsw_cppcheck.sh ${all_fsw_modules} 2> ${{matrix.cppcheck}}_cppcheck_err.txt | ||
- name: Archive Static Analysis Artifacts | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: ${{matrix.cppcheck}}-cppcheck-err | ||
path: ./*cppcheck_err.txt | ||
|
||
- name: Check for errors | ||
run: | | ||
if [[ -s ${{matrix.cppcheck}}_cppcheck_err.txt ]]; | ||
then | ||
cat ${{matrix.cppcheck}}_cppcheck_err.txt | ||
exit -1 | ||
fi | ||
uses: nasa/cFS/.github/workflows/static-analysis.yml@main | ||
with: | ||
module: 'cfe' | ||
cppcheck-code: 'all_fsw_modules="core_api core_private es evs fs msg resourceid sb sbr tbl time" && /bin/bash ./.github/workflows/run_fsw_cppcheck.sh ${all_fsw_modules} 2> $cfe_cppcheck_err.txt' |