Skip to content

Commit 4bbd96d

Browse files
Twelfth try fixing CI/CD; install fewer packs per job
1 parent bab6a6e commit 4bbd96d

2 files changed

Lines changed: 18 additions & 8 deletions

File tree

.github/scripts/install-packs.py

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,29 @@ def get_workspace_packs(root):
1515

1616
return packs
1717

18+
def install_pack(pack_path, codeql_executable, mode):
19+
# Run `codeql pack install` to install dependencies.
20+
command = [codeql_executable, 'pack', 'install', '--allow-prerelease', '--mode', mode, pack_path]
21+
print(f'Running `{" ".join(command)}`')
22+
subprocess.check_call(command)
23+
1824
parser = argparse.ArgumentParser(description="Install CodeQL library pack dependencies.")
1925
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`")
2026
parser.add_argument('--codeql', required=False, default='codeql', help="Path to the `codeql` executable.")
27+
parser.add_argument('--language', required=False, help="Which language (or 'common') to install pack dependencies for.")
2128
args = parser.parse_args()
2229

2330
# Find the root of the repo
2431
root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
2532

2633
packs = get_workspace_packs(root)
2734

28-
# Find the CodeQL packs in the repo. This can also return packs outside of the repo, if those packs
29-
# are installed in a sibling directory to the CLI.
30-
for pack in packs:
31-
pack_path = os.path.join(root, pack)
32-
# Run `codeql pack install` to install dependencies.
33-
command = [args.codeql, 'pack', 'install', '--allow-prerelease', '--mode', args.mode, pack_path]
34-
print(f'Running `{" ".join(command)}`')
35-
subprocess.check_call(command)
35+
# Always install the qtil source pack, which is used by all languages.
36+
install_pack(os.path.join(root, 'src'), args.codeql, args.mode)
37+
if args.language == 'common':
38+
# common means we want to run test/.
39+
install_pack(os.path.join(root, 'test'), args.codeql, args.mode)
40+
else:
41+
# Otherwise, we need to install the language-specific src and test packs.
42+
install_pack(os.path.join(root, args.language, 'src'), args.codeql, args.mode)
43+
install_pack(os.path.join(root, args.language, 'test'), args.codeql, args.mode)

.github/workflows/codeql-unit-tests.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77

88
jobs:
99
compile-and-test:
10+
name: Compile and Test CodeQL Packs
1011
runs-on: ubuntu-latest
1112

1213
strategy:
@@ -25,6 +26,7 @@ jobs:
2526
uses: ./.github/actions/install-codeql-packs
2627
with:
2728
cli_path: ${{ github.workspace }}/codeql_home/codeql
29+
language: ${{ matrix.language }}
2830

2931
- name: Pre-Compile Queries
3032
id: pre-compile-queries

0 commit comments

Comments
 (0)