1
1
name : " CodeQL Analysis"
2
2
3
- # Only trigger, when the build workflow succeeded
4
3
on :
5
- workflow_run :
6
- workflows : ["Build, Test, and Run \\[OMIT_DEPRECATED = true\\]"]
7
- types :
8
- - completed
9
- branches :
10
- - ' **'
4
+ workflow_call :
5
+ inputs :
6
+ setup :
7
+ description : ' Build Prep'
8
+ type : string
9
+ default : ' cp ./cfe/cmake/Makefile.sample Makefile && cp -r ./cfe/cmake/sample_defs sample_defs'
10
+ make-prep :
11
+ description : ' Make Prep'
12
+ type : string
13
+ default : ' '
14
+ make :
15
+ description : ' Make Copy'
16
+ type : string
17
+ default : ' make'
18
+ tests :
19
+ description : ' Tests'
20
+ type : string
21
+ default : ' '
22
+
11
23
env :
12
24
SIMULATION : native
13
25
ENABLE_UNIT_TESTS : true
14
26
OMIT_DEPRECATED : true
15
27
BUILDTYPE : release
16
28
17
-
18
29
jobs :
19
30
# Checks for duplicate actions. Skips push actions if there is a matching or duplicate pull-request action.
20
31
check-for-duplicates :
21
32
runs-on : ubuntu-latest
22
33
# Map a step output to a job output
23
34
outputs :
24
35
should_skip : ${{ steps.skip_check.outputs.should_skip }}
25
- if : ${{ github.event.workflow_run.conclusion == 'success' }}
26
36
steps :
27
37
- id : skip_check
28
38
uses : fkirc/skip-duplicate-actions@master
29
39
with :
30
40
concurrent_skipping : ' same_content'
31
41
skip_after_successful_duplicate : ' true'
32
42
do_not_skip : ' ["pull_request", "workflow_dispatch", "schedule"]'
33
-
34
-
43
+
35
44
CodeQL-Security-Build :
36
45
# Continue if check-for-duplicates found no duplicates. Always runs for pull-requests.
37
46
needs : check-for-duplicates
@@ -42,42 +51,37 @@ jobs:
42
51
steps :
43
52
# Checks out a copy of your repository
44
53
- name : Checkout code
45
- if : ${{ !steps.skip-workflow.outputs.skip }}
46
54
uses : actions/checkout@v2
47
55
with :
48
56
repository : nasa/cFS
49
57
submodules : true
50
58
51
59
- name : Check versions
52
- if : ${{ !steps.skip-workflow.outputs.skip }}
53
60
run : |
54
61
git log -1 --pretty=oneline
55
62
git submodule
56
-
63
+
57
64
- name : Initialize CodeQL
58
- if : ${{ !steps.skip-workflow.outputs.skip }}
59
65
uses : github/codeql-action/init@v1
60
66
with :
61
67
languages : c
62
- config-file : ./.github/codeql/codeql-security.yml
63
-
64
- # Setup the build system
68
+ config-file : nasa/cFS/.github/codeql/codeql-security.yml@main
69
+
65
70
- name : Copy sample_defs
66
- if : ${{ !steps.skip-workflow.outputs.skip }}
67
- run : |
68
- cp ./cfe/cmake/Makefile.sample Makefile
69
- cp -r ./cfe/cmake/sample_defs sample_defs
71
+ run : ${{ inputs.setup }}
70
72
71
- # Setup the build system
73
+ - name : Make prep
74
+ run : ${{ inputs.make-prep }}
75
+
72
76
- name : Make Install
73
- if : ${{ !steps.skip-workflow.outputs.skip }}
74
- run : make
77
+ run : ${{ inputs.make }}
78
+
79
+ - name : Run tests
80
+ run : ${{ inputs.tests }}
75
81
76
- # Run CodeQL
77
82
- name : Perform CodeQL Analysis
78
- if : ${{ !steps.skip-workflow.outputs.skip }}
79
83
uses : github/codeql-action/analyze@v1
80
-
84
+
81
85
CodeQL-Coding-Standard-Build :
82
86
# Continue if check-for-duplicates found no duplicates. Always runs for pull-requests.
83
87
needs : check-for-duplicates
@@ -88,45 +92,39 @@ jobs:
88
92
steps :
89
93
# Checks out a copy of your repository
90
94
- name : Checkout code
91
- if : ${{ !steps.skip-workflow.outputs.skip }}
92
95
uses : actions/checkout@v2
93
96
with :
94
97
repository : nasa/cFS
95
98
submodules : true
96
99
97
100
- name : Check versions
98
- if : ${{ !steps.skip-workflow.outputs.skip }}
99
101
run : |
100
102
git log -1 --pretty=oneline
101
103
git submodule
104
+ - name : Checkout codeql code
105
+ uses : actions/checkout@v2
106
+ with :
107
+ repository : github/codeql
108
+ submodules : true
109
+ path : codeql
102
110
103
111
- name : Initialize CodeQL
104
- if : ${{ !steps.skip-workflow.outputs.skip }}
105
112
uses : github/codeql-action/init@v1
106
113
with :
107
114
languages : c
108
- config-file : ./ .github/codeql/codeql-coding-standard.yml
115
+ config-file : nasa/cFS/ .github/codeql/codeql-coding-standard.yml@main
109
116
110
- # Setup the build system
111
117
- name : Copy sample_defs
112
- if : ${{ !steps.skip-workflow.outputs.skip }}
113
- run : |
114
- cp ./cfe/cmake/Makefile.sample Makefile
115
- cp -r ./cfe/cmake/sample_defs sample_defs
116
-
117
- # Setup the build system
118
+ run : ${{ inputs.setup }}
119
+
120
+ - name : Make prep
121
+ run : ${{ inputs.make-prep }}
122
+
118
123
- name : Make Install
119
- if : ${{ !steps.skip-workflow.outputs.skip }}
120
- run : make
124
+ run : ${{ inputs.make }}
125
+
126
+ - name : Run tests
127
+ run : ${{ inputs.tests }}
121
128
122
- # Run CodeQL
123
129
- name : Perform CodeQL Analysis
124
- if : ${{ !steps.skip-workflow.outputs.skip }}
125
- uses : github/codeql-action/analyze@v1
126
-
127
- on-failure :
128
- runs-on : ubuntu-latest
129
- if : ${{ github.event.workflow_run.conclusion == 'failure' }}
130
- steps :
131
- - name : Fail workflow
132
- run : exit 1
130
+ uses : github/codeql-action/analyze@v1
0 commit comments