Skip to content

Commit 1b01c6c

Browse files
committed
Add common caches support
1 parent 7263a98 commit 1b01c6c

3 files changed

Lines changed: 12 additions & 1 deletion

File tree

.github/actions/install-codeql-packs/action.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ inputs:
77
The path to the CodeQL CLI directory.
88
required: false
99

10+
common_caches:
11+
description: |
12+
The path to the CodeQL common caches directory.
13+
required: false
14+
1015
mode:
1116
description: |
1217
The `--mode` option to `codeql pack install`.
@@ -22,4 +27,6 @@ runs:
2227
CODEQL_CLI: ${{ inputs.cli_path }}
2328
run: |
2429
PATH=$PATH:$CODEQL_CLI
25-
python scripts/install-packs.py --mode ${{ inputs.mode }}
30+
python scripts/install-packs.py \
31+
--mode ${{ inputs.mode }} \
32+
--common-caches "${{ inputs.common_caches }}"

.github/workflows/codeql_unit_tests.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ jobs:
8585
uses: ./.github/actions/install-codeql-packs
8686
with:
8787
cli_path: ${{ github.workspace }}/codeql_home/codeql
88+
common_caches: ${{ github.workspace }}/codeql_cache
8889

8990
- name: Pre-Compile Queries
9091
id: pre-compile-queries

scripts/install-packs.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
parser = argparse.ArgumentParser(description="Install CodeQL library pack dependencies.")
77
parser.add_argument('--mode', required=False, choices=['use-lock', 'update', 'verify', 'no-lock'], default="use-lock", help="Installation mode, identical to the `--mode` argument to `codeql pack install`")
88
parser.add_argument('--codeql', required=False, default='codeql', help="Path to the `codeql` executable.")
9+
parser.add_argument('--common-caches', required=False, help="Path to the CodeQL common caches directory.")
910
args = parser.parse_args()
1011

1112
# Find the root of the repo
@@ -19,5 +20,7 @@
1920
pack_path = os.path.join(root, pack)
2021
# Run `codeql pack install` to install dependencies.
2122
command = [args.codeql, 'pack', 'install', '--allow-prerelease', '--mode', args.mode, pack_path]
23+
if args.common_caches:
24+
command.insert(3, f'--common-caches={args.common_caches}')
2225
print(f'Running `{" ".join(command)}`')
2326
subprocess.check_call(command)

0 commit comments

Comments
 (0)