Skip to content

Commit 75e258c

Browse files
committed
Add caching to the pack-gen workflow
1 parent 80bf638 commit 75e258c

1 file changed

Lines changed: 21 additions & 1 deletion

File tree

.github/workflows/code-scanning-pack-gen.yml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,19 @@ jobs:
6262
codeql-home: ${{ github.workspace }}/codeql_home
6363
add-to-path: false
6464

65+
- name: Cache queries compilation
66+
id: cache-queries-compilation
67+
uses: actions/cache/restore@v6
68+
with:
69+
path: ${{ github.workspace }}/codeql_cache
70+
key: ${{ runner.os }}-codeql-compilation-code-scanning-pack-${{ matrix.codeql_cli }}-${{ matrix.codeql_standard_library }}-${{ github.run_id }}
71+
restore-keys: ${{ runner.os }}-codeql-compilation-code-scanning-pack-${{ matrix.codeql_cli }}-${{ matrix.codeql_standard_library }}
72+
6573
- name: Install CodeQL packs
6674
uses: ./.github/actions/install-codeql-packs
6775
with:
6876
cli_path: ${{ github.workspace }}/codeql_home/codeql
77+
common_caches: ${{ github.workspace }}/codeql_cache
6978

7079
- name: Determine ref for external help files
7180
id: determine-ref
@@ -105,11 +114,22 @@ jobs:
105114
PATH=$PATH:$CODEQL_HOME/codeql
106115
# Precompile all queries, and use a compilation cache larger than default
107116
# to ensure we cache all the queries for later steps
108-
codeql query compile --precompile --threads 0 --compilation-cache-size=1024 cpp c
117+
codeql query compile \
118+
--common-caches=${{ github.workspace }}/codeql_cache \
119+
--precompile \
120+
--threads 0 \
121+
--compilation-cache-size=1024 \
122+
cpp c
109123
110124
cd ..
111125
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
112126
127+
- name: Save queries compilation cache
128+
uses: actions/cache/save@v6
129+
with:
130+
path: ${{ github.workspace }}/codeql_cache
131+
key: ${{ steps.cache-queries-compilation.outputs.cache-primary-key }}
132+
113133
- name: Upload GHAS Query Pack
114134
uses: actions/upload-artifact@v7
115135
with:

0 commit comments

Comments
 (0)