Skip to content

Commit af1f6c3

Browse files
committed
Merge pull request #101
Fix #100, Reuse CodeQL, Static Analyis, and Format Check
2 parents 8074e8e + e7d5bb7 commit af1f6c3

File tree

3 files changed

+14
-181
lines changed

3 files changed

+14
-181
lines changed

.github/workflows/codeql-build.yml

Lines changed: 7 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -3,110 +3,12 @@ name: "CodeQL Analysis"
33
on:
44
push:
55
pull_request:
6-
branches:
7-
- main
8-
9-
env:
10-
SIMULATION: native
11-
ENABLE_UNIT_TESTS: true
12-
OMIT_DEPRECATED: true
13-
BUILDTYPE: release
146

157
jobs:
16-
#Checks for duplicate actions. Skips push actions if there is a matching or duplicate pull-request action.
17-
check-for-duplicates:
18-
runs-on: ubuntu-latest
19-
# Map a step output to a job output
20-
outputs:
21-
should_skip: ${{ steps.skip_check.outputs.should_skip }}
22-
steps:
23-
- id: skip_check
24-
uses: fkirc/skip-duplicate-actions@master
25-
with:
26-
concurrent_skipping: 'same_content'
27-
skip_after_successful_duplicate: 'true'
28-
do_not_skip: '["pull_request", "workflow_dispatch", "schedule"]'
29-
30-
CodeQL-Security-Build:
31-
needs: check-for-duplicates
32-
if: ${{ needs.check-for-duplicates.outputs.should_skip != 'true' }}
33-
runs-on: ubuntu-18.04
34-
timeout-minutes: 15
35-
36-
steps:
37-
# Checks out a copy of your repository on the ubuntu-latest machine
38-
- name: Checkout bundle
39-
uses: actions/checkout@v2
40-
with:
41-
repository: nasa/cFS
42-
submodules: true
43-
44-
- name: Checkout submodule
45-
uses: actions/checkout@v2
46-
with:
47-
path: apps/sch_lab
48-
49-
- name: Check versions
50-
run: git submodule
51-
52-
- name: Initialize CodeQL
53-
uses: github/codeql-action/init@v1
54-
with:
55-
languages: c
56-
config-file: nasa/cFS/.github/codeql/codeql-security.yml@main
57-
58-
# Setup the build system
59-
- name: Set up for build
60-
run: |
61-
cp ./cfe/cmake/Makefile.sample Makefile
62-
cp -r ./cfe/cmake/sample_defs sample_defs
63-
make prep
64-
65-
# Build the code
66-
- name: Build
67-
run: make sch_lab
68-
69-
- name: Perform CodeQL Analysis
70-
uses: github/codeql-action/analyze@v1
71-
72-
CodeQL-Coding-Standard-Build:
73-
needs: check-for-duplicates
74-
if: ${{ needs.check-for-duplicates.outputs.should_skip != 'true' }}
75-
runs-on: ubuntu-18.04
76-
timeout-minutes: 15
77-
78-
steps:
79-
# Checks out a copy of your repository on the ubuntu-latest machine
80-
- name: Checkout bundle
81-
uses: actions/checkout@v2
82-
with:
83-
repository: nasa/cFS
84-
submodules: true
85-
86-
- name: Checkout submodule
87-
uses: actions/checkout@v2
88-
with:
89-
path: apps/sch_lab
90-
91-
- name: Check versions
92-
run: git submodule
93-
94-
- name: Initialize CodeQL
95-
uses: github/codeql-action/init@v1
96-
with:
97-
languages: c
98-
config-file: nasa/cFS/.github/codeql/codeql-coding-standard.yml@main
99-
100-
# Setup the build system
101-
- name: Set up for build
102-
run: |
103-
cp ./cfe/cmake/Makefile.sample Makefile
104-
cp -r ./cfe/cmake/sample_defs sample_defs
105-
make prep
106-
107-
# Build the code
108-
- name: Build
109-
run: make sch_lab
110-
111-
- name: Perform CodeQL Analysis
112-
uses: github/codeql-action/analyze@v1
8+
codeql:
9+
name: Codeql
10+
uses: nasa/cFS/.github/workflows/codeql-build.yml@main
11+
with:
12+
make-prep: 'make prep'
13+
make: 'make sch_lab'
14+

.github/workflows/format-check.yml

Lines changed: 4 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,12 @@
11
name: Format Check
22

3-
# Run on main push and pull requests
3+
# Run on all push and pull requests
44
on:
55
push:
6-
branches:
7-
- main
86
pull_request:
97

108
jobs:
11-
12-
static-analysis:
9+
format-check:
1310
name: Run format check
14-
runs-on: ubuntu-18.04
15-
timeout-minutes: 15
16-
17-
steps:
18-
19-
- name: Install format checker
20-
run: |
21-
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
22-
sudo add-apt-repository 'deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-10 main'
23-
sudo apt-get update && sudo apt-get install clang-format-10
24-
25-
- name: Checkout bundle
26-
uses: actions/checkout@v2
27-
with:
28-
repository: nasa/cFS
29-
30-
- name: Checkout
31-
uses: actions/checkout@v2
32-
with:
33-
path: repo
34-
35-
- name: Generate format differences
36-
run: |
37-
cd repo
38-
find . -name "*.[ch]" -exec clang-format-10 -i -style=file {} +
39-
git diff > $GITHUB_WORKSPACE/style_differences.txt
40-
41-
- name: Archive Static Analysis Artifacts
42-
uses: actions/upload-artifact@v2
43-
with:
44-
name: style_differences
45-
path: style_differences.txt
46-
47-
- name: Error on differences
48-
run: |
49-
if [[ -s style_differences.txt ]];
50-
then
51-
cat style_differences.txt
52-
exit -1
53-
fi
11+
uses: nasa/cFS/.github/workflows/format-check.yml@main
12+
Lines changed: 3 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,12 @@
11
name: Static Analysis
22

3-
# Run on main push and pull requests
3+
# Run on all push and pull requests
44
on:
55
push:
6-
branches:
7-
- main
86
pull_request:
97

108
jobs:
11-
129
static-analysis:
1310
name: Run cppcheck
14-
runs-on: ubuntu-18.04
15-
timeout-minutes: 15
16-
17-
steps:
18-
19-
- name: Install cppcheck
20-
run: sudo apt-get install cppcheck -y
21-
22-
- name: Checkout code
23-
uses: actions/checkout@v2
24-
25-
- name: Run general cppcheck
26-
run: cppcheck --force --inline-suppr --quiet . 2> cppcheck_err.txt
27-
28-
- name: Archive Static Analysis Artifacts
29-
uses: actions/upload-artifact@v2
30-
with:
31-
name: cppcheck-err
32-
path: ./cppcheck_err.txt
33-
34-
- name: Check for errors
35-
run: |
36-
if [[ -s cppcheck_err.txt ]];
37-
then
38-
cat cppcheck_err.txt
39-
exit -1
40-
fi
11+
uses: nasa/cFS/.github/workflows/static-analysis.yml@main
12+

0 commit comments

Comments
 (0)