forked from nasa/elf2cfetbl
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix nasa#78, Implement Coding Standard CodeQL
- Loading branch information
1 parent
eb5e326
commit bf7c1c0
Showing
3 changed files
with
139 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: "CodeQL Coding Standard Configuration File" | ||
|
||
disable-default-queries: true | ||
|
||
queries: | ||
- name: JPL Rules | ||
uses: ./codeql/cpp/ql/src/JPL_C | ||
- name: MISRA Rule 9-5-1 | ||
uses: ./codeql/cpp/ql/src/jsf/4.20 Unions and Bit Fields/AV Rule 153.ql | ||
- name: MISRA Rule 5-18-1 | ||
uses: ./codeql/cpp/ql/src/jsf/4.21 Operators/AV Rule 168.ql | ||
- name: MISRA 6-2-2 | ||
uses: ./codeql/cpp/ql/src/jsf/4.25 Expressions/AV Rule 202.ql | ||
- name: MISRA Rule 5-14-1 | ||
uses: ./codeql/cpp/ql/src/jsf/4.21 Operators/AV Rule 165.ql | ||
- name: MISRA Rule 5-3-2 | ||
uses: ./codeql/cpp/ql/src/jsf/4.21 Operators/AV Rule 165.ql | ||
- name: MISRA Rule 7-5-2 | ||
uses: ./codeql/cpp/ql/src/jsf/4.22 Pointers and References/AV Rule 173.ql |
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
name: "CodeQL Security Configuration File" | ||
|
||
queries: | ||
- name: Security and Quality | ||
uses: security-and-quality | ||
- name: Security Extended | ||
uses: security-extended | ||
|
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 |
---|---|---|
@@ -0,0 +1,112 @@ | ||
name: "CodeQL Analysis" | ||
|
||
on: | ||
push: | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
env: | ||
SIMULATION: native | ||
ENABLE_UNIT_TESTS: true | ||
OMIT_DEPRECATED: true | ||
BUILDTYPE: release | ||
|
||
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"]' | ||
|
||
CodeQL-Security-Build: | ||
needs: check-for-duplicates | ||
if: ${{ needs.check-for-duplicates.outputs.should_skip != 'true' }} | ||
runs-on: ubuntu-18.04 | ||
timeout-minutes: 15 | ||
|
||
steps: | ||
# Checks out a copy of your repository on the ubuntu-latest machine | ||
- name: Checkout bundle | ||
uses: actions/checkout@v2 | ||
with: | ||
repository: nasa/cFS | ||
submodules: true | ||
|
||
- name: Checkout submodule | ||
uses: actions/checkout@v2 | ||
with: | ||
path: tools/elf2cfetbl | ||
|
||
- name: Check versions | ||
run: git submodule | ||
|
||
- name: Initialize CodeQL | ||
uses: github/codeql-action/init@v1 | ||
with: | ||
languages: c | ||
config-file: nasa/cFS-GroundSystem/.github/codeql/codeql-security.yml@main | ||
|
||
# Setup the build system | ||
- name: Set up for build | ||
run: | | ||
cp ./cfe/cmake/Makefile.sample Makefile | ||
cp -r ./cfe/cmake/sample_defs sample_defs | ||
make prep | ||
# Build the code | ||
- name: Build | ||
run: make tools/elf2cfetbl/ | ||
|
||
- name: Perform CodeQL Analysis | ||
uses: github/codeql-action/analyze@v1 | ||
|
||
CodeQL-Coding-Standard-Build: | ||
needs: check-for-duplicates | ||
if: ${{ needs.check-for-duplicates.outputs.should_skip != 'true' }} | ||
runs-on: ubuntu-18.04 | ||
timeout-minutes: 15 | ||
|
||
steps: | ||
# Checks out a copy of your repository on the ubuntu-latest machine | ||
- name: Checkout bundle | ||
uses: actions/checkout@v2 | ||
with: | ||
repository: nasa/cFS | ||
submodules: true | ||
|
||
- name: Checkout submodule | ||
uses: actions/checkout@v2 | ||
with: | ||
path: tools/elf2cfetbl | ||
|
||
- name: Check versions | ||
run: git submodule | ||
|
||
- name: Initialize CodeQL | ||
uses: github/codeql-action/init@v1 | ||
with: | ||
languages: c | ||
config-file: nasa/cFS-GroundSystem/.github/codeql/codeql-coding-standard.yml@main | ||
|
||
# Setup the build system | ||
- name: Set up for build | ||
run: | | ||
cp ./cfe/cmake/Makefile.sample Makefile | ||
cp -r ./cfe/cmake/sample_defs sample_defs | ||
make prep | ||
# Build the code | ||
- name: Build | ||
run: make tools/elf2cfetbl/ | ||
|
||
- name: Perform CodeQL Analysis | ||
uses: github/codeql-action/analyze@v1 |