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 9F75494193C for ; Wed, 29 Nov 2023 17:16:06 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=lsStLRgfJSKeLeadM3H5SCvrbAiOP9XVqZ3X6fiEu84=; c=relaxed/simple; d=groups.io; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:To:Cc:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Type; s=20140610; t=1701278165; v=1; b=G/UhWdo3T7FrulReqPhvXKycn393dAPD9vsQ6bHyo0rQyiqlXkMkghcW/cI1hFEBqeAO9xFm WQOyc6FYe+qkDrhJq/RtBdYceq+DJ1vE1NxgQxnJ8dE9MrgF5P2xCGBZsq7z1vbLpvsVlAfDPw8 3qpM+i4w/CI/JlxtJPpsVJSg= X-Received: by 127.0.0.2 with SMTP id yqD5YY7687511x6rPUVaLUMK; Wed, 29 Nov 2023 09:16:05 -0800 X-Received: from mail-pj1-f46.google.com (mail-pj1-f46.google.com [209.85.216.46]) by mx.groups.io with SMTP id smtpd.web11.44025.1701278164592604299 for ; Wed, 29 Nov 2023 09:16:04 -0800 X-Received: by mail-pj1-f46.google.com with SMTP id 98e67ed59e1d1-2859c011cb0so4186992a91.1 for ; Wed, 29 Nov 2023 09:16:04 -0800 (PST) X-Gm-Message-State: 9EQHkVIVI5OXdlEeFKEIDGq0x7686176AA= X-Google-Smtp-Source: AGHT+IHms2qw0T/pkUjMn8dmOO738l8lAtGsxOVv24ggK+0OmWNl/YP72KMqxcNNOJcL9IYoUB5eUKdzWG0+cONpRBI= X-Received: by 2002:a17:90a:1944:b0:27d:c95:b0ad with SMTP id 4-20020a17090a194400b0027d0c95b0admr18209331pjh.21.1701278163831; Wed, 29 Nov 2023 09:16:03 -0800 (PST) MIME-Version: 1.0 References: <20231129170105.1598-1-mikuback@linux.microsoft.com> In-Reply-To: <20231129170105.1598-1-mikuback@linux.microsoft.com> From: "Joey Vagedes via groups.io" Date: Wed, 29 Nov 2023 09:15:52 -0800 Message-ID: Subject: Re: [edk2-devel] [PATCH v1 1/1] .github/workflows/codeql.yml: Add emacs output To: mikuback@linux.microsoft.com Cc: Laszlo Ersek , Michael D Kinney , Sean Brogan , devel@edk2.groups.io 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,joeyvagedes@microsoft.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: Content-Type: multipart/alternative; boundary="0000000000009e912b060b4db018" X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b="G/UhWdo3"; dmarc=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 --0000000000009e912b060b4db018 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Reviewed-by: Joey Vagedes On Wed, Nov 29, 2023 at 9:01=E2=80=AFAM wrot= e: > 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: > > 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 > > - 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 > > - 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 > > 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) > > 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 > > -- > 2.43.0.windows.1 > > -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#111853): https://edk2.groups.io/g/devel/message/111853 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] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- --0000000000009e912b060b4db018 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Reviewed-by: Joey Vagedes <joey.vagedes@gmail.com&= gt;

On Wed, Nov 29, 2023 at 9:01=E2=80= =AFAM <mikuback@linux.microsoft.com> wrote:
From= : Michael Kubacki <michael.kubacki@microsoft.com>

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&quo= t;
run (https://github.com/tianocore/edk2= /actions/workflows/codeql.yml).

The file name ends with "-emacs.txt". An MdePkg example:
=C2=A0 "codeql-db-mdepkg-debug-0-emacs.txt".

Cc: Joey Vagedes <joey.vagedes@gmail.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Sean Brogan <sean.brogan@microsoft.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
---

Notes:
=C2=A0 =C2=A0 An example CodeQL run with this change:

=C2=A0 =C2=A0 https://github.com/tianocore/= edk2/actions/runs/7035482184

=C2=A0.github/workflows/codeql.yml | 20 ++++++++++++++++----
=C2=A01 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:
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0git config --system core.longpaths true
=C2=A0 =C2=A0 =C2=A0- name: Install/Upgrade pip Modules
-=C2=A0 =C2=A0 =C2=A0 run: pip install -r pip-requirements.txt --upgrade re= quests
+=C2=A0 =C2=A0 =C2=A0 run: pip install -r pip-requirements.txt --upgrade re= quests sarif-tools

=C2=A0 =C2=A0 =C2=A0- name: Determine CI Settings File Supported Operations=
=C2=A0 =C2=A0 =C2=A0 =C2=A0id: get_ci_file_operations
@@ -304,16 +304,26 @@ jobs:
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0PACKAGE_NAME: ${{ matrix.Package }}
=C2=A0 =C2=A0 =C2=A0 =C2=A0shell: python
=C2=A0 =C2=A0 =C2=A0 =C2=A0run: |
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 import logging
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0import os
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 from edk2toollib.utility_functions import RunC= md
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 from io import StringIO
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 from pathlib import Path

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0package =3D os.environ['PACKAGE_NAME&= #39;].strip().lower()
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0directory_name =3D 'codeql-analysis-&= #39; + package + '-debug'
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0file_name =3D 'codeql-db-' + pack= age + '-debug-0.sarif'
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 sarif_path =3D os.path.join('Build', d= irectory_name, file_name)
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 sarif_path =3D Path('Build', directory= _name, file_name)

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0with open(os.environ['GITHUB_OUTPUT&#= 39;], 'a') as fh:
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if os.path.isfile(sarif_path): +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if sarif_path.is_file():
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 emacs_file_path = =3D sarif_path.with_name(sarif_path.stem + "-emacs.txt")
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 out_stream_buffer = =3D StringIO()
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 exit_code =3D RunC= md("sarif", f"emacs {sarif_path} --output {emacs_file_path}&= quot;,
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0outstream=3Dout_stream_= buffer,
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0logging_level=3Dlogging= .NOTSET)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0print(f'u= pload_sarif_file=3Dtrue', file=3Dfh)
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 print(f'emacs_= file_path=3D{emacs_file_path}', file=3Dfh)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0print(f's= arif_file_path=3D{sarif_path}', file=3Dfh)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0else:
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0print(f'u= pload_sarif_file=3Dfalse', file=3Dfh)
@@ -323,7 +333,9 @@ jobs:
=C2=A0 =C2=A0 =C2=A0 =C2=A0if: steps.env_data.outputs.upload_sarif_file =3D= =3D 'true'
=C2=A0 =C2=A0 =C2=A0 =C2=A0with:
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0name: ${{ matrix.Package }}-CodeQL-SARIF<= br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 path: ${{ steps.env_data.outputs.sarif_file_pa= th }}
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 path: |
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ${{ steps.env_data.outputs.emacs_file_p= ath }}
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ${{ steps.env_data.outputs.sarif_file_p= ath }}
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0retention-days: 14
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if-no-files-found: warn

--
2.43.0.windows.1

_._,_._,_

Groups.io Links:

=20 You receive all messages sent to this group. =20 =20

View/Reply Online (#111853) | =20 | Mute= This Topic | New Topic
Your Subscriptio= n | Contact Group Owner | Unsubscribe [rebecca@openfw.io]

_._,_._,_
--0000000000009e912b060b4db018--