@@ -33,130 +33,6 @@ jobs:
3333 jq --compact-output '.supported_environment | {include: .}' supported_codeql_configs.json
3434 )"
3535
36- create-code-scanning-pack-anon :
37- name : Create anonymous Code Scanning pack
38- needs : prepare-code-scanning-pack-matrix
39- runs-on : ubuntu-20.04-xl
40- strategy :
41- fail-fast : false
42- matrix : ${{ fromJSON(needs.prepare-code-scanning-pack-matrix.outputs.matrix) }}
43- steps :
44- - uses : actions/checkout@v2
45-
46- - name : Cache CodeQL
47- id : cache-codeql
48- uses : actions/cache@v2.1.3
49- with :
50- path : ${{ github.workspace }}/codeql_home
51- key : codeql-home-${{ matrix.os }}-${{ matrix.codeql_cli }}-${{ matrix.codeql_standard_library }}
52-
53- - name : Install CodeQL
54- if : steps.cache-codeql.outputs.cache-hit != 'true'
55- uses : ./.github/actions/install-codeql
56- with :
57- codeql-cli-version : ${{ matrix.codeql_cli }}
58- codeql-stdlib-version : ${{ matrix.codeql_standard_library }}
59- codeql-home : ${{ github.workspace }}/codeql_home
60- add-to-path : false
61-
62- - name : Install Python
63- uses : actions/setup-python@v4
64- with :
65- python-version : " 3.9"
66-
67- - name : Anonymising and pre-compiling queries
68- env :
69- CODEQL_HOME : ${{ github.workspace }}/codeql_home
70- run : |
71- PATH=$PATH:$CODEQL_HOME/codeql
72- pip install -r scripts/requirements.txt
73- find rule_packages/cpp -name '*.json' -exec basename {} .json \; | xargs --max-procs "$XARGS_MAX_PROCS" --max-args 1 python scripts/generate_rules/generate_package_files.py -a cpp
74- find rule_packages/c -name '*.json' -exec basename {} .json \; | xargs --max-procs "$XARGS_MAX_PROCS" --max-args 1 python scripts/generate_rules/generate_package_files.py --skip-shared-test-generation -a c
75-
76- echo "Remove help files that cannot be freely distributed"
77- find cpp/autosar/src/rules -name "*.md" -delete
78- find c/misra/src/rules -name "*.md" -delete
79-
80- codeql query compile --search-path cpp --threads 0 cpp
81- codeql query compile --search-path c --search-path cpp --threads 0 c
82- cd ..
83- zip -r codeql-coding-standards/code-scanning-cpp-query-pack-anon.zip codeql-coding-standards/c/ codeql-coding-standards/cpp/ codeql-coding-standards/.codeqlmanifest.json codeql-coding-standards/supported_codeql_configs.json codeql-coding-standards/scripts/deviations codeql-coding-standards/scripts/reports
84-
85- - name : Upload GHAS Query Pack
86- uses : actions/upload-artifact@v2
87- with :
88- name : code-scanning-cpp-query-pack-anon.zip
89- path : code-scanning-cpp-query-pack-anon.zip
90-
91- - name : Create LGTM query pack
92- env :
93- CODEQL_HOME : ${{ github.workspace }}/codeql_home
94- run : |
95- PATH=$PATH:$CODEQL_HOME/codeql
96- mkdir -p lgtm-cpp-query-pack
97- function copy_queries_for_pack {
98- for q in $(codeql resolve queries $2/$1/src/codeql-suites/$1-default.qls)
99- do
100- copy_from_root_name="${q%.*}"
101- copy_to_root_name=$(realpath --relative-to "./$2/$1/src/" "$copy_from_root_name")
102- query_dir=$(dirname "lgtm-cpp-query-pack/$copy_to_root_name")
103- mkdir -p "$query_dir"
104- # Copy each selected ql file
105- cp "$copy_from_root_name.ql" "lgtm-cpp-query-pack/$copy_to_root_name.ql"
106- done
107- }
108-
109- echo "Copying autosar-default queries (CPP)"
110- copy_queries_for_pack "autosar" "cpp"
111- echo "Copying cert-default queries (CPP)"
112- copy_queries_for_pack "cert" "cpp"
113-
114- echo "Copying misra-default queries (C)"
115- copy_queries_for_pack "misra" "c"
116- echo "Copying cert-default queries (C)"
117- copy_queries_for_pack "cert" "c"
118-
119-
120- # Now copy all the .qll files
121- lgtm_pack_dir=$(realpath lgtm-cpp-query-pack)
122- for query_pack in autosar cert common
123- do
124- echo "Copying $query_pack qll files"
125- pushd cpp/$query_pack/src
126- for query_library in $(find . -name \*.qll)
127- do
128- qll_dir=$(dirname "$lgtm_pack_dir/$query_library")
129- echo "Making $qll_dir"
130- mkdir -p "$qll_dir"
131- cp "$query_library" "$lgtm_pack_dir/$query_library"
132- done
133- popd
134- done
135-
136-
137- for query_pack in misra cert common
138- do
139- echo "Copying $query_pack qll files"
140- pushd c/$query_pack/src
141- for query_library in $(find . -name \*.qll)
142- do
143- qll_dir=$(dirname "$lgtm_pack_dir/$query_library")
144- echo "Making $qll_dir"
145- mkdir -p "$qll_dir"
146- cp "$query_library" "$lgtm_pack_dir/$query_library"
147- done
148- popd
149- done
150-
151- cd lgtm-cpp-query-pack
152- zip -9 -r ../lgtm-cpp-query-pack-anon.zip *
153-
154- - name : Upload LGTM query pack
155- uses : actions/upload-artifact@v2
156- with :
157- name : lgtm-cpp-query-pack-anon.zip
158- path : lgtm-cpp-query-pack-anon.zip
159-
16036 create-code-scanning-pack :
16137 name : Create Code Scanning pack
16238 needs : prepare-code-scanning-pack-matrix
18460 add-to-path : false
18561
18662 - name : Checkout external help files
63+ continue-on-error : true
64+ id : checkout-external-help-files
18765 uses : actions/checkout@v2
18866 with :
18967 ssh-key : ${{ secrets.CODEQL_CODING_STANDARDS_HELP_KEY }}
19270 path : external-help-files
19371
19472 - name : Include external help files
73+ if : ${{ steps.checkout-external-help-files.outcome == 'success' }}
19574 run : |
19675 pushd external-help-files
19776 find . -name '*.md' -exec rsync -av --relative {} "$GITHUB_WORKSPACE" \;
@@ -214,68 +93,3 @@ jobs:
21493 with :
21594 name : code-scanning-cpp-query-pack.zip
21695 path : code-scanning-cpp-query-pack.zip
217-
218- - name : Create LGTM query pack
219- env :
220- CODEQL_HOME : ${{ github.workspace }}/codeql_home
221- run : |
222- PATH=$PATH:$CODEQL_HOME/codeql
223- mkdir -p lgtm-cpp-query-pack
224- function copy_queries_for_pack {
225- for rule_dir in $(codeql resolve queries $2/$1/src/codeql-suites/$1-default.qls | xargs -L1 dirname | uniq)
226- do
227- copy_to_root="lgtm-cpp-query-pack/$(realpath --relative-to "./$2/$1/src/" "$rule_dir")"
228- mkdir -p "$copy_to_root"
229- # Copy each selected ql file, plus the related files
230- find "$rule_dir" -name '*.ql' -o -name '*.c' -name '*.cpp' -o -name '*.png' -exec cp -n {} "$copy_to_root" \;
231- done
232- }
233- echo "Copying autosar-default queries (CPP)"
234- copy_queries_for_pack "autosar" "cpp"
235- echo "Copying cert-default queries (CPP)"
236- copy_queries_for_pack "cert" "cpp"
237-
238- echo "Copying misra-default queries (C)"
239- copy_queries_for_pack "misra" "c"
240- echo "Copying cert-default queries (C)"
241- copy_queries_for_pack "cert" "c"
242-
243-
244- # Now copy all the .qll files
245- lgtm_pack_dir=$(realpath lgtm-cpp-query-pack)
246- for query_pack in autosar cert common
247- do
248- echo "Copying $query_pack qll files"
249- pushd cpp/$query_pack/src
250- for query_library in $(find . -name \*.qll)
251- do
252- qll_dir=$(dirname "$lgtm_pack_dir/$query_library")
253- echo "Making $qll_dir"
254- mkdir -p "$qll_dir"
255- cp "$query_library" "$lgtm_pack_dir/$query_library"
256- done
257- popd
258- done
259-
260- for query_pack in misra cert common
261- do
262- echo "Copying $query_pack qll files"
263- pushd c/$query_pack/src
264- for query_library in $(find . -name \*.qll)
265- do
266- qll_dir=$(dirname "$lgtm_pack_dir/$query_library")
267- echo "Making $qll_dir"
268- mkdir -p "$qll_dir"
269- cp "$query_library" "$lgtm_pack_dir/$query_library"
270- done
271- popd
272- done
273-
274- cd lgtm-cpp-query-pack
275- zip -9 -r ../lgtm-cpp-query-pack.zip *
276-
277- - name : Upload LGTM query pack
278- uses : actions/upload-artifact@v2
279- with :
280- name : lgtm-cpp-query-pack.zip
281- path : lgtm-cpp-query-pack.zip
0 commit comments