Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated CISettings.py to use the edk2toolext codeql helpers #414

Merged
merged 3 commits into from
Jan 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 27 additions & 3 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,9 @@ jobs:
from pathlib import Path
# Find the plugin directory that contains the CodeQL plugin
plugin_dir = list(Path(os.environ['GITHUB_WORKSPACE']).rglob('.pytool/Plugin/CodeQL'))
plugin_dir = list(Path(os.environ['GITHUB_WORKSPACE']).rglob('BaseTools/Plugin/CodeQL'))
if not plugin_dir:
plugin_dir = list(Path(os.environ['GITHUB_WORKSPACE']).rglob('.pytool/Plugin/CodeQL'))
# This should only be found once
if len(plugin_dir) == 1:
Expand Down Expand Up @@ -319,10 +321,32 @@ jobs:
if: steps.codeqlcli_cache.outputs.cache-hit != 'true'
run: stuart_update -c .pytool/CISettings.py -t DEBUG -a ${{ matrix.archs }} TOOL_CHAIN_TAG=${{ matrix.tool_chain_tag }} --codeql

- name: Find pytool Plugin Directory
id: find_pytool_dir
shell: python
run: |
import os
import sys
from pathlib import Path
# Find the plugin directory that contains the Compiler plugin
plugin_dir = list(Path(os.environ['GITHUB_WORKSPACE']).rglob('.pytool/Plugin/CompilerPlugin'))
# This should only be found once
if len(plugin_dir) == 1:
# If the directory is found get the parent Plugin directory
plugin_dir = str(plugin_dir[0].parent)
with open(os.environ['GITHUB_OUTPUT'], 'a') as fh:
print(f'pytool_plugin_dir={plugin_dir}', file=fh)
else:
print("::error title=Workspace Error!::Failed to find Mu Basecore .pytool/Plugin directory!")
sys.exit(1)
- name: Remove CI Plugins Irrelevant to CodeQL
shell: python
env:
CODEQL_PLUGIN_DIR: ${{ steps.find_dir.outputs.codeql_plugin_dir }}
PYTOOL_PLUGIN_DIR: ${{ steps.find_pytool_dir.outputs.pytool_plugin_dir }}
run: |
import os
import shutil
Expand All @@ -331,7 +355,7 @@ jobs:
# Only these two plugins are needed for CodeQL
plugins_to_keep = ['CodeQL', 'CompilerPlugin']
plugin_dir = Path(os.environ['CODEQL_PLUGIN_DIR']).parent.absolute()
plugin_dir = Path(os.environ['PYTOOL_PLUGIN_DIR']).absolute()
if plugin_dir.is_dir():
for dir in plugin_dir.iterdir():
if str(dir.stem) not in plugins_to_keep:
Expand Down
9 changes: 1 addition & 8 deletions .pytool/CISettings.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,7 @@
from edk2toollib.utility_functions import GetHostInfo
from pathlib import Path

try:
# May not be present until submodules are populated
root = Path(__file__).parent.parent.resolve()
sys.path.append(str(root/'MU_BASECORE'/'.pytool'/'Plugin'/'CodeQL'/'integration'))
import stuart_codeql as codeql_helpers
except ImportError:
pass

from edk2toolext import codeql as codeql_helpers

class Settings(CiSetupSettingsManager, CiBuildSettingsManager, UpdateSettingsManager, SetupSettingsManager, PrEvalSettingsManager):

Expand Down
Loading