2020 XARGS_MAX_PROCS : 4
2121
2222jobs :
23-
2423 prepare-code-scanning-pack-matrix :
2524 name : Prepare CodeQL Code Scanning pack matrix
2625 runs-on : ubuntu-22.04
@@ -62,10 +61,19 @@ jobs:
6261 codeql-home : ${{ github.workspace }}/codeql_home
6362 add-to-path : false
6463
64+ - name : Cache queries compilation
65+ id : cache-queries-compilation
66+ uses : actions/cache/restore@v6
67+ with :
68+ path : ${{ github.workspace }}/codeql_cache
69+ key : ${{ runner.os }}-codeql-compilation-code-scanning-pack-${{ matrix.codeql_cli }}-${{ matrix.codeql_standard_library }}-${{ github.run_id }}
70+ restore-keys : ${{ runner.os }}-codeql-compilation-code-scanning-pack-${{ matrix.codeql_cli }}-${{ matrix.codeql_standard_library }}
71+
6572 - name : Install CodeQL packs
6673 uses : ./.github/actions/install-codeql-packs
6774 with :
6875 cli_path : ${{ github.workspace }}/codeql_home/codeql
76+ common_caches : ${{ github.workspace }}/codeql_cache
6977
7078 - name : Determine ref for external help files
7179 id : determine-ref
@@ -105,11 +113,22 @@ jobs:
105113 PATH=$PATH:$CODEQL_HOME/codeql
106114 # Precompile all queries, and use a compilation cache larger than default
107115 # to ensure we cache all the queries for later steps
108- codeql query compile --precompile --threads 0 --compilation-cache-size=1024 cpp c
116+ codeql query compile \
117+ --common-caches=${{ github.workspace }}/codeql_cache \
118+ --precompile \
119+ --threads 0 \
120+ --compilation-cache-size=1024 \
121+ cpp c
109122
110123 cd ..
111124 zip -r codeql-coding-standards/code-scanning-cpp-query-pack.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/configuration codeql-coding-standards/scripts/reports codeql-coding-standards/scripts/shared codeql-coding-standards/scripts/guideline_recategorization codeql-coding-standards/schemas
112125
126+ - name : Save queries compilation cache
127+ uses : actions/cache/save@v6
128+ with :
129+ path : ${{ github.workspace }}/codeql_cache
130+ key : ${{ steps.cache-queries-compilation.outputs.cache-primary-key }}
131+
113132 - name : Upload GHAS Query Pack
114133 uses : actions/upload-artifact@v7
115134 with :
@@ -119,20 +138,21 @@ jobs:
119138 - name : Create qlpack bundles
120139 env :
121140 CODEQL_HOME : ${{ github.workspace }}/codeql_home
141+ CODEQL_CACHE : ${{ github.workspace }}/codeql_cache
122142 run : |
123143 PATH=$PATH:$CODEQL_HOME/codeql
124144
125- codeql pack bundle --output=common-cpp-coding-standards.tgz cpp/common/src
126- codeql pack bundle --output=common-c-coding-standards.tgz c/common/src
127- codeql pack bundle --output=misra-c-coding-standards.tgz c/misra/src
128- codeql pack bundle --output=cert-c-coding-standards.tgz c/cert/src
129- codeql pack bundle --output=cert-cpp-coding-standards.tgz cpp/cert/src
130- codeql pack bundle --output=autosar-cpp-coding-standards.tgz cpp/autosar/src
131- codeql pack bundle --output=misra-cpp-coding-standards.tgz cpp/misra/src
132- codeql pack bundle --output=report-coding-standards.tgz cpp/report/src
145+ codeql pack bundle --common-caches="$CODEQL_CACHE" -- output=common-cpp-coding-standards.tgz cpp/common/src
146+ codeql pack bundle --common-caches="$CODEQL_CACHE" -- output=common-c-coding-standards.tgz c/common/src
147+ codeql pack bundle --common-caches="$CODEQL_CACHE" -- output=misra-c-coding-standards.tgz c/misra/src
148+ codeql pack bundle --common-caches="$CODEQL_CACHE" -- output=cert-c-coding-standards.tgz c/cert/src
149+ codeql pack bundle --common-caches="$CODEQL_CACHE" -- output=cert-cpp-coding-standards.tgz cpp/cert/src
150+ codeql pack bundle --common-caches="$CODEQL_CACHE" -- output=autosar-cpp-coding-standards.tgz cpp/autosar/src
151+ codeql pack bundle --common-caches="$CODEQL_CACHE" -- output=misra-cpp-coding-standards.tgz cpp/misra/src
152+ codeql pack bundle --common-caches="$CODEQL_CACHE" -- output=report-coding-standards.tgz cpp/report/src
133153
134154 - name : Upload qlpack bundles
135155 uses : actions/upload-artifact@v7
136156 with :
137157 name : coding-standards-codeql-packs
138- path : ' *-coding-standards.tgz'
158+ path : " *-coding-standards.tgz"
0 commit comments