Skip to content

Commit

Permalink
Merge pull request #385 from nasa/revert-384-fix-382-reuse-workflows
Browse files Browse the repository at this point in the history
Revert "Fix #382, Reuse CodeQL, Static Analysis, and Format Check"
  • Loading branch information
ArielSAdamsNASA authored Oct 27, 2021
2 parents 4445289 + 0ef8218 commit 81227d5
Show file tree
Hide file tree
Showing 9 changed files with 84 additions and 198 deletions.
16 changes: 14 additions & 2 deletions .github/codeql/codeql-coding-standard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,17 @@ name: "CodeQL Coding Standard Configuration File"
disable-default-queries: true

queries:
- name: JPL and MISRA
uses: ./.github/codeql/jpl-misra.qls
- name: JPL Rules
uses: github/codeql/cpp/ql/src/JPL_C@main
- name: MISRA Rule 9-5-1
uses: github/codeql/cpp/ql/src/jsf/4.20 Unions and Bit Fields/AV Rule 153.ql@main
- name: MISRA Rule 5-18-1
uses: github/codeql/cpp/ql/src/jsf/4.21 Operators/AV Rule 168.ql@main
- name: MISRA 6-2-2
uses: github/codeql/cpp/ql/src/jsf/4.25 Expressions/AV Rule 202.ql@main
- name: MISRA Rule 5-14-1
uses: github/codeql/cpp/ql/src/jsf/4.21 Operators/AV Rule 165.ql@main
- name: MISRA Rule 5-3-2
uses: github/codeql/cpp/ql/src/jsf/4.21 Operators/AV Rule 165.ql@main
- name: MISRA Rule 7-5-2
uses: github/codeql/cpp/ql/src/jsf/4.22 Pointers and References/AV Rule 173.ql@main
21 changes: 0 additions & 21 deletions .github/codeql/jpl-misra.qls

This file was deleted.

16 changes: 3 additions & 13 deletions .github/workflows/README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
# Our Workflows

## Reusable Workflows

To reduce duplication, CodeQL Analysis, Static Analysis, and Format Checker are placed in cFS to be reused in the subrepositories.

CodeQL Analysis and Static Analysis require inputs, therefore, they are called in an additional workflow in cFS to be utilized. Format checker does not need to be reused in cFS because it does not require inputs.

Provided is a diagram of the architecture of the reusable workflows.

![Reusable Workflows Architecture](cFS-Reusable-Workflows.PNG)

## Deprecated Build, Test, and Run
[![Deprecated Build, Test, and Run](https://github.com/nasa/cfs/actions/workflows/build-cfs-deprecated.yml/badge.svg)](https://github.com/nasa/cfs/actions/workflows/build-cfs-deprecated.yml)

Expand All @@ -35,8 +25,8 @@ For the CodeQL GitHub Actions setup, visit https://github.com/github/codeql-acti

Our CodeQL action uses a configuration file to use specific queries, which can be found at [.github/codeql](https://github.com/nasa/cFS/tree/main/.github/codeql).

## Static Analysis
[![Static Analysis](https://github.com/nasa/cfs/actions/workflows/static-analysis.yml/badge.svg)](https://github.com/nasa/cfs/actions/workflows/static-analysis.yml)
## Static Analaysis
[![Static Analaysis](https://github.com/nasa/cfs/actions/workflows/static-analysis.yml/badge.svg)](https://github.com/nasa/cfs/actions/workflows/static-analysis.yml)

This action runs a static analysis tool for C/C++ code known as cppcheck. Cppcheck is designed to be able to analyze C/C++ code even if it has non-standard syntax, which is common in embedded projects.

Expand Down Expand Up @@ -68,6 +58,6 @@ This action creates a changelog file which documents all the issues in cFS.
The Changelog action runs manually.

## Format Check
[![Format Check](https://github.com/nasa/cfs/actions/workflows/format-check.yml/badge.svg)](https://github.com/nasa/cfs/actions/workflows/format-check.yml)
[![Format Check](https://github.com/nasa/osal/actions/workflows/format-check.yml/badge.svg)](https://github.com/nasa/osal/actions/workflows/format-check.yml)

This action uses [clang-format-10](https://github.com/nasa/cFS/blob/main/.clang-format) to check for format errors.
Binary file removed .github/workflows/cFS-Reusable-Workflows.PNG
Binary file not shown.
11 changes: 0 additions & 11 deletions .github/workflows/codeql-build-reuse.yml

This file was deleted.

78 changes: 38 additions & 40 deletions .github/workflows/codeql-build.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,10 @@
name: CodeQL Analysis
name: "CodeQL Analysis"

on:
workflow_call:
inputs:
sample-defs:
description: 'Build Prep'
type: string
default: 'cp ./cfe/cmake/Makefile.sample Makefile && cp -r ./cfe/cmake/sample_defs sample_defs'
make-prep:
description: 'Make Prep'
type: string
default: ''
make:
description: 'Make Code'
type: string
default: 'make'
tests:
description: 'Tests'
type: string
default: ''
push:
pull_request:
branches:
- main

env:
SIMULATION: native
Expand All @@ -40,7 +26,8 @@ jobs:
concurrent_skipping: 'same_content'
skip_after_successful_duplicate: 'true'
do_not_skip: '["pull_request", "workflow_dispatch", "schedule"]'



CodeQL-Security-Build:
#Continue if check-for-duplicates found no duplicates. Always runs for pull-requests.
needs: check-for-duplicates
Expand All @@ -51,37 +38,42 @@ jobs:
steps:
# Checks out a copy of your repository
- name: Checkout code
if: ${{ !steps.skip-workflow.outputs.skip }}
uses: actions/checkout@v2
with:
repository: nasa/cFS
submodules: true

- name: Check versions
if: ${{ !steps.skip-workflow.outputs.skip }}
run: |
git log -1 --pretty=oneline
git submodule
- name: Initialize CodeQL
if: ${{ !steps.skip-workflow.outputs.skip }}
uses: github/codeql-action/init@v1
with:
languages: c
config-file: nasa/cFS/.github/codeql/codeql-security.yml@main
config-file: ./.github/codeql/codeql-security.yml

# Setup the build system
- name: Copy sample_defs
run: ${{ inputs.sample-defs }}

- name: Make prep
run: ${{ inputs.make-prep }}
if: ${{ !steps.skip-workflow.outputs.skip }}
run: |
cp ./cfe/cmake/Makefile.sample Makefile
cp -r ./cfe/cmake/sample_defs sample_defs
# Setup the build system
- name: Make Install
run: ${{ inputs.make }}

- name: Run tests
run: ${{ inputs.tests }}
if: ${{ !steps.skip-workflow.outputs.skip }}
run: make

# Run CodeQL
- name: Perform CodeQL Analysis
if: ${{ !steps.skip-workflow.outputs.skip }}
uses: github/codeql-action/analyze@v1

CodeQL-Coding-Standard-Build:
#Continue if check-for-duplicates found no duplicates. Always runs for pull-requests.
needs: check-for-duplicates
Expand All @@ -92,40 +84,46 @@ jobs:
steps:
# Checks out a copy of your repository
- name: Checkout code
if: ${{ !steps.skip-workflow.outputs.skip }}
uses: actions/checkout@v2
with:
repository: nasa/cFS
submodules: true

- name: Check versions
if: ${{ !steps.skip-workflow.outputs.skip }}
run: |
git log -1 --pretty=oneline
git submodule
- name: Checkout codeql code
if: ${{ !steps.skip-workflow.outputs.skip }}
uses: actions/checkout@v2
with:
repository: github/codeql
submodules: true
path: codeql

- name: Initialize CodeQL
if: ${{ !steps.skip-workflow.outputs.skip }}
uses: github/codeql-action/init@v1
with:
languages: c
config-file: nasa/cFS/.github/codeql/codeql-coding-standard.yml@main
config-file: ./.github/codeql/codeql-coding-standard.yml

# Setup the build system
- name: Copy sample_defs
run: ${{ inputs.sample-defs }}

- name: Make prep
run: ${{ inputs.make-prep }}
if: ${{ !steps.skip-workflow.outputs.skip }}
run: |
cp ./cfe/cmake/Makefile.sample Makefile
cp -r ./cfe/cmake/sample_defs sample_defs
# Setup the build system
- name: Make Install
run: ${{ inputs.make }}

- name: Run tests
run: ${{ inputs.tests }}
if: ${{ !steps.skip-workflow.outputs.skip }}
run: make

# Run CodeQL
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
if: ${{ !steps.skip-workflow.outputs.skip }}
uses: github/codeql-action/analyze@v1
67 changes: 0 additions & 67 deletions .github/workflows/format-check.yml

This file was deleted.

9 changes: 0 additions & 9 deletions .github/workflows/static-analysis-reuse.yml

This file was deleted.

Loading

0 comments on commit 81227d5

Please sign in to comment.