Skip to content

Commit 0d7f6b8

Browse files
committed
Merge pull request #2011 from fix-2009-reuse-workflows
Fix #2009, Reuse CodeQL, Static Analysis, and Format Check
2 parents f8661cf + 9c86dd4 commit 0d7f6b8

File tree

3 files changed

+14
-201
lines changed

3 files changed

+14
-201
lines changed

.github/workflows/codeql-build.yml

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

.github/workflows/format-check.yml

+3-43
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,11 @@
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:
66
pull_request:
77

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

.github/workflows/static-analysis.yml

+4-47
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,13 @@
11
name: Static Analysis
22

3-
# Run this workflow every time a new commit pushed to your repository
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-
strategy:
18-
fail-fast: false
19-
matrix:
20-
cppcheck: [all, cfe]
21-
22-
steps:
23-
24-
- name: Install cppcheck
25-
run: sudo apt-get install cppcheck -y
26-
27-
# Checks out a copy of the cfs bundle
28-
- name: Checkout code
29-
uses: actions/checkout@v2
30-
with:
31-
submodules: true
32-
33-
- name: Run bundle cppcheck
34-
if: ${{matrix.cppcheck =='all'}}
35-
run: cppcheck --force --inline-suppr . 2> ${{matrix.cppcheck}}_cppcheck_err.txt
36-
37-
# Run strict static analysis for embedded portions of cfe
38-
- name: cfe strict cppcheck
39-
if: ${{matrix.cppcheck =='cfe'}}
40-
run: |
41-
all_fsw_modules="core_api core_private es evs fs msg resourceid sb sbr tbl time"
42-
/bin/bash ./.github/workflows/run_fsw_cppcheck.sh ${all_fsw_modules} 2> ${{matrix.cppcheck}}_cppcheck_err.txt
43-
44-
- name: Archive Static Analysis Artifacts
45-
uses: actions/upload-artifact@v2
46-
with:
47-
name: ${{matrix.cppcheck}}-cppcheck-err
48-
path: ./*cppcheck_err.txt
49-
50-
- name: Check for errors
51-
run: |
52-
if [[ -s ${{matrix.cppcheck}}_cppcheck_err.txt ]];
53-
then
54-
cat ${{matrix.cppcheck}}_cppcheck_err.txt
55-
exit -1
56-
fi
11+
uses: nasa/cFS/.github/workflows/static-analysis.yml@main
12+
with:
13+
strict-dir-list: './modules/core_api/fsw ./modules/core_private/fsw ./modules/es/fsw ./modules/evs/fsw ./modules/fs/fsw ./modules/msg/fsw ./modules/resourceid/fsw ./modules/sb/fsw ./modules/sbr/fsw ./modules/tbl/fsw ./modules/time/fsw -UCFE_PLATFORM_TIME_CFG_CLIENT -DCFE_PLATFORM_TIME_CFG_SERVER'

0 commit comments

Comments
 (0)