11name : CodeQL Unit Testing
22
33on :
4+ merge_group :
45 push :
56 branches :
67 - main
4748 uses : actions/setup-python@v4
4849 with :
4950 python-version : " 3.9"
51+
52+ - name : Install Python dependencies
53+ run : pip install -r scripts/requirements.txt
5054
5155 - name : Cache CodeQL
5256 id : cache-codeql
@@ -66,11 +70,15 @@ jobs:
6670 codeql-home : ${{ github.workspace }}/codeql_home
6771 add-to-path : false
6872
73+ - name : Install CodeQL packs
74+ uses : ./.github/actions/install-codeql-packs
75+ with :
76+ cli_path : ${{ github.workspace }}/codeql_home/codeql
77+
6978 - name : Pre-Compile Queries
7079 id : pre-compile-queries
7180 run : |
72- ${{ github.workspace }}/codeql_home/codeql/codeql query compile --search-path cpp --threads 0 cpp
73- ${{ github.workspace }}/codeql_home/codeql/codeql query compile --search-path c --search-path cpp --threads 0 c
81+ ${{ github.workspace }}/codeql_home/codeql/codeql query compile --threads 0 ${{ matrix.language }}
7482
7583
7684 - name : Run test suites
@@ -122,18 +130,11 @@ jobs:
122130 os.makedirs(os.path.dirname(test_report_path), exist_ok=True)
123131 test_report_file = open(test_report_path, 'w')
124132 files_to_close.append(test_report_file)
125- if "${{ matrix.language }}".casefold() == "c".casefold():
126- # c tests require cpp -- but we don't want c things on the cpp
127- # path in case of design errors.
128- cpp_language_root = Path(workspace, 'cpp')
129- procs.append(subprocess.Popen([codeql_bin, "test", "run", "--failing-exitcode=122", f"--slice={slice}/{num_slices}", "--ram=2048", "--format=json", f'--search-path={cpp_language_root}', f'--search-path={language_root}', *test_roots], stdout=test_report_file, stderr=subprocess.PIPE))
130- else:
131- procs.append(subprocess.Popen([codeql_bin, "test", "run", "--failing-exitcode=122", f"--slice={slice}/{num_slices}", "--ram=2048", "--format=json", f'--search-path={language_root}', f'--search-path={language_root}', *test_roots], stdout=test_report_file, stderr=subprocess.PIPE))
133+ procs.append(subprocess.Popen([codeql_bin, "test", "run", "--failing-exitcode=122", f"--slice={slice}/{num_slices}", "--ram=2048", "--format=json", *test_roots], stdout=test_report_file, stderr=subprocess.PIPE))
132134
133135 for p in procs:
134- p.wait ()
136+ _, err = p.communicate ()
135137 if p.returncode != 0:
136- _, err = p.communicate()
137138 if p.returncode == 122:
138139 # Failed because a test case failed, so just print the regular output.
139140 # This will allow us to proceed to validate-test-results, which will fail if
0 commit comments