From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id DE9C374003D for ; Wed, 29 Nov 2023 17:01:26 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=omtV85jbalM8SKrrPoNjqNijF3mSrOs/KD3w4MzwuaA=; c=relaxed/simple; d=groups.io; h=DKIM-Filter:From:To:Cc:Subject:Date:Message-ID:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20140610; t=1701277285; v=1; b=e+zgs7dnCH7YHUIdWZX4VJPTlzpAZBekSK+17WhzQe/FWVWUH2gCfHtC/JT5p906toNjBsin gI8eoosHdCussSjTSGwKbVRWKVklH9s9ldnKO5MrpD7OBsJ5JQURgL64PZvE96qXbATzIGITzfN c6Q8rqzWaqF+sV459ob9kau8= X-Received: by 127.0.0.2 with SMTP id 6GWYYY7687511xbN1l1pkK03; Wed, 29 Nov 2023 09:01:25 -0800 X-Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mx.groups.io with SMTP id smtpd.web11.43580.1701277284862690428 for ; Wed, 29 Nov 2023 09:01:24 -0800 X-Received: from localhost.localdomain (unknown [47.201.241.198]) by linux.microsoft.com (Postfix) with ESMTPSA id 98ECA20B74C0; Wed, 29 Nov 2023 09:01:23 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 98ECA20B74C0 From: "Michael Kubacki" To: devel@edk2.groups.io Cc: Joey Vagedes , Laszlo Ersek , Michael D Kinney , Sean Brogan Subject: [edk2-devel] [PATCH v1 1/1] .github/workflows/codeql.yml: Add emacs output Date: Wed, 29 Nov 2023 12:01:05 -0500 Message-ID: <20231129170105.1598-1-mikuback@linux.microsoft.com> MIME-Version: 1.0 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,mikuback@linux.microsoft.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: Hczp7ikxgJymbfVuHK3kA0Mjx7686176AA= Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=e+zgs7dn; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=linux.microsoft.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io From: Michael Kubacki Updates the workflow to also output files that can be loaded in emacs to show CodeQL issues (in addition to the existing SARIF output for standard SARIF viewers). The emacs files are in the SARIF zip file attached to each "CodeQL" run (https://github.com/tianocore/edk2/actions/workflows/codeql.yml). The file name ends with "-emacs.txt". An MdePkg example: "codeql-db-mdepkg-debug-0-emacs.txt". Cc: Joey Vagedes Cc: Laszlo Ersek Cc: Michael D Kinney Cc: Sean Brogan Signed-off-by: Michael Kubacki --- Notes: An example CodeQL run with this change: =20 https://github.com/tianocore/edk2/actions/runs/7035482184 .github/workflows/codeql.yml | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 72ece9dcb446..e826e67eb912 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -92,7 +92,7 @@ jobs: git config --system core.longpaths true =20 - name: Install/Upgrade pip Modules - run: pip install -r pip-requirements.txt --upgrade requests + run: pip install -r pip-requirements.txt --upgrade requests sarif-= tools =20 - name: Determine CI Settings File Supported Operations id: get_ci_file_operations @@ -304,16 +304,26 @@ jobs: PACKAGE_NAME: ${{ matrix.Package }} shell: python run: | + import logging import os + from edk2toollib.utility_functions import RunCmd + from io import StringIO + from pathlib import Path =20 package =3D os.environ['PACKAGE_NAME'].strip().lower() directory_name =3D 'codeql-analysis-' + package + '-debug' file_name =3D 'codeql-db-' + package + '-debug-0.sarif' - sarif_path =3D os.path.join('Build', directory_name, file_name) + sarif_path =3D Path('Build', directory_name, file_name) =20 with open(os.environ['GITHUB_OUTPUT'], 'a') as fh: - if os.path.isfile(sarif_path): + if sarif_path.is_file(): + emacs_file_path =3D sarif_path.with_name(sarif_path.stem= + "-emacs.txt") + out_stream_buffer =3D StringIO() + exit_code =3D RunCmd("sarif", f"emacs {sarif_path} --out= put {emacs_file_path}", + outstream=3Dout_stream_buffer, + logging_level=3Dlogging.NOTSET) print(f'upload_sarif_file=3Dtrue', file=3Dfh) + print(f'emacs_file_path=3D{emacs_file_path}', file=3Dfh) print(f'sarif_file_path=3D{sarif_path}', file=3Dfh) else: print(f'upload_sarif_file=3Dfalse', file=3Dfh) @@ -323,7 +333,9 @@ jobs: if: steps.env_data.outputs.upload_sarif_file =3D=3D 'true' with: name: ${{ matrix.Package }}-CodeQL-SARIF - path: ${{ steps.env_data.outputs.sarif_file_path }} + path: | + ${{ steps.env_data.outputs.emacs_file_path }} + ${{ steps.env_data.outputs.sarif_file_path }} retention-days: 14 if-no-files-found: warn =20 --=20 2.43.0.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#111852): https://edk2.groups.io/g/devel/message/111852 Mute This Topic: https://groups.io/mt/102875700/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-