[edk2-devel] [edk2-redfish-client][PATCH] RedfishClientPkg/.github: add build check and uncrustify check

Igor Kulchytskyy via groups.io igork=ami.com at groups.io
Thu Jun 8 01:06:48 UTC 2023


Thank you, Nickle

Get Outlook for Android<https://aka.ms/AAb9ysg>
________________________________
From: Chang, Abner <Abner.Chang at amd.com>
Sent: Wednesday, June 7, 2023 8:28:11 PM
To: Nickle Wang <nicklew at nvidia.com>; devel at edk2.groups.io <devel at edk2.groups.io>
Cc: Igor Kulchytskyy <igork at ami.com>
Subject: [EXTERNAL] RE: [edk2-redfish-client][PATCH] RedfishClientPkg/.github: add build check and uncrustify check


**CAUTION: The e-mail below is from an external source. Please exercise caution before opening attachments, clicking links, or following guidance.**

[AMD Official Use Only - General]

Nice work Nickle!!

Reviewed-by: Abner Chang <abner.chang at amd.com>

> -----Original Message-----
> From: Nickle Wang <nicklew at nvidia.com>
> Sent: Thursday, June 8, 2023 12:12 AM
> To: devel at edk2.groups.io
> Cc: Chang, Abner <Abner.Chang at amd.com>; Igor Kulchytskyy
> <igork at ami.com>
> Subject: [edk2-redfish-client][PATCH] RedfishClientPkg/.github: add build
> check and uncrustify check
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> Enable Github Actions to check below items:
> - RedfishClientPkg build check on push and pull request
> - Uncrustify check on pull request
>
> Signed-off-by: Nickle Wang <nicklew at nvidia.com>
> Cc: Abner Chang <abner.chang at amd.com>
> Cc: Igor Kulchytskyy <igork at ami.com>
> ---
>  .github/.github/workflows/build.sh            | 70 +++++++++++++++++++
>  .github/.github/workflows/build.yml           | 61 ++++++++++++++++
>  .github/.github/workflows/uncrustify-check.sh | 51 ++++++++++++++
>  .github/.github/workflows/uncrustify.yml      | 44 ++++++++++++
>  4 files changed, 226 insertions(+)
>  create mode 100755 .github/.github/workflows/build.sh
>  create mode 100644 .github/.github/workflows/build.yml
>  create mode 100755 .github/.github/workflows/uncrustify-check.sh
>  create mode 100644 .github/.github/workflows/uncrustify.yml
>
> diff --git a/.github/.github/workflows/build.sh
> b/.github/.github/workflows/build.sh
> new file mode 100755
> index 00000000..f919d551
> --- /dev/null
> +++ b/.github/.github/workflows/build.sh
> @@ -0,0 +1,70 @@
> +#!/bin/bash
> +#
> +# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights
> reserved.
> +#
> +# SPDX-License-Identifier: BSD-2-Clause-Patent
> +#
> +
> +
> +ARCH="X64"
> +TARGET="DEBUG"
> +TOOLCHAIN="GCC5"
> +
> +if [ $# -eq 0 ]
> +then
> +    echo "usage: $0 [path to edk2] [path to edk2-redfish-client] [ARCH]
> [TARGET] [TOOLCHAIN]"
> +    exit 1
> +fi
> +
> +EDK2_ROOT="$PWD/$1"
> +EDK2_REDFISH_CLIENT="$PWD/$2"
> +ARCH="$3"
> +TARGET="$4"
> +TOOLCHAIN="$5"
> +
> +if [ ! -e "$EDK2_ROOT" ]
> +then
> +    echo "$EDK2_ROOT does not exist"
> +    exit 1
> +fi
> +
> +if [ ! -e "$EDK2_REDFISH_CLIENT" ]
> +then
> +    echo "$EDK2_REDFISH_CLIENT does not exist"
> +    exit 1
> +fi
> +
> +export PACKAGES_PATH="$EDK2_ROOT:$EDK2_REDFISH_CLIENT"
> +echo "PACKAGES_PATH: $PACKAGES_PATH"
> +echo "ARCH: $ARCH"
> +echo "TARGET: $TARGET"
> +echo "TOOLCHAIN: $TOOLCHAIN"
> +
> +cd "$EDK2_ROOT"
> +. edksetup.sh BaseTools
> +
> +if [ ! -e "BaseTools/Source/C/bin" ]
> +then
> +  echo "binary does not exist, rebuild it"
> +
> +  cd BaseTools
> +  make
> +  cd ..
> +
> +  echo "If there is build error related to nasm, try to use latest nasm from:
> https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.nasm.us%2Fpub%2Fnasm%2Freleasebuilds%2F&data=05%7C01%7Cigork%40ami.com%7Cfe7c0814e24544d5839a08db67b73fa7%7C27e97857e15f486cb58e86c2b3040f93%7C1%7C0%7C638217808989823384%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=51RRpRuxeci9god2Hs5e%2Fa4S7GdeejhRpofp%2FSpjPS4%3D&reserved=0"<https://www.nasm.us/pub/nasm/releasebuilds/>
> +  echo ""
> +  echo "1) wget
> https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.nasm.us%2Fpub%2Fnasm%2Freleasebuilds%2F2.15rc12%2Fnasm-&data=05%7C01%7Cigork%40ami.com%7Cfe7c0814e24544d5839a08db67b73fa7%7C27e97857e15f486cb58e86c2b3040f93%7C1%7C0%7C638217808989823384%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=0X%2B8JSzM7hjzAvLuE6AG1nf6dLKL4SHknyd%2Bv306N%2BA%3D&reserved=0<https://www.nasm.us/pub/nasm/releasebuilds/2.15rc12/nasm->
> 2.15rc12.tar.gz"
> +  echo "2) tar zxvf nasm-2.15rc12.tar.gz"
> +  echo "3) cd nasm-2.15rc12"
> +  echo "4) ./configure --prefix=/usr"
> +  echo "5) sudo make install"
> +  echo "6) nasm -v"
> +fi
> +
> +build -p RedfishClientPkg/RedfishClientPkg.dsc -a $ARCH -t $TOOLCHAIN -b
> $TARGET
> +if [ $? -ne 0 ]
> +then
> +  exit 1
> +fi
> +
> +exit 0
> diff --git a/.github/.github/workflows/build.yml
> b/.github/.github/workflows/build.yml
> new file mode 100644
> index 00000000..f44184b3
> --- /dev/null
> +++ b/.github/.github/workflows/build.yml
> @@ -0,0 +1,61 @@
> +# @file
> +# GitHub Workflow for build checks
> +#
> +# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights
> reserved.
> +#
> +# SPDX-License-Identifier: BSD-2-Clause-Patent
> +##
> +name: "RedfishClientPkg Build"
> +on:
> +  push:
> +    branches:
> +      - main
> +  pull_request:
> +    branches:
> +      - main
> +    paths-ignore:
> +      - '**/*.bat'
> +      - '**/*.md'
> +      - '**/*.py'
> +      - '**/*.rst'
> +      - '**/*.sh'
> +      - '**/*.txt'
> +
> +jobs:
> +  edk2-redfish-client-build:
> +    strategy:
> +          fail-fast: false
> +          matrix:
> +            include:
> +              - Target: "DEBUG"
> +                ArchList: "X64"
> +                ToolChain: "GCC5"
> +              - Target: "RELEASE"
> +                ArchList: "X64"
> +                ToolChain: "GCC5"
> +              - Target: "NOOPT"
> +                ArchList: "X64"
> +                ToolChain: "GCC5"
> +    runs-on: ubuntu-latest
> +    container:
> +      image: ghcr.io/tianocore/containers/ubuntu-22-dev:latest
> +      options: --user root -v ${{ github.workspace }}:/home/edk2
> +      env:
> +        EDK2_DOCKER_USER_HOME: "/home/edk2"
> +    name: edk2 build test
> +    steps:
> +      - name: checkout edk2
> +        uses: actions/checkout at v3
> +        with:
> +          repository: tianocore/edk2
> +          path: ./edk2
> +          submodules: recursive
> +      - name: checkout edk2-redfish-client
> +        uses: actions/checkout at v3
> +        with:
> +          path: ./edk2-redfish-client
> +      - name: edk2 build
> +        run: |
> +          ./edk2-redfish-client/.github/workflows/build.sh ./edk2 ./edk2-
> redfish-client ${{ matrix.ArchList }} ${{ matrix.Target }} ${{ matrix.ToolChain }}
> +        shell: bash
> +
> diff --git a/.github/.github/workflows/uncrustify-check.sh
> b/.github/.github/workflows/uncrustify-check.sh
> new file mode 100755
> index 00000000..b739a60b
> --- /dev/null
> +++ b/.github/.github/workflows/uncrustify-check.sh
> @@ -0,0 +1,51 @@
> +#!/bin/bash
> +#
> +# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights
> reserved.
> +#
> +# SPDX-License-Identifier: BSD-2-Clause-Patent
> +#
> +
> +
> +if [ $# -ne 3 ]
> +then
> +    echo "usage: $0 [PATH to CONFIG FILE] [PATH to REPO.] [NO. of
> COMMITS]"
> +    exit 1
> +fi
> +
> +CONFIG_FILE="$PWD/$1"
> +REPO_PATH="$PWD/$2"
> +NO_COMMITS="$3"
> +
> +if [ ! -e "$CONFIG_FILE" ]
> +then
> +    echo "$CONFIG_FILE does not exist"
> +    exit 1
> +fi
> +
> +if [ ! -e "$REPO_PATH" ]
> +then
> +    echo "$REPO_PATH does not exist"
> +    exit 1
> +fi
> +
> +cd "$REPO_PATH"
> +
> +FAILURE=0
> +CHANGED_FILES=$(git diff --name-only HEAD~$NO_COMMITS)
> +for file in $CHANGED_FILES
> +do
> +  echo "Uncrustify check file: $file"
> +  uncrustify -c $CONFIG_FILE -f $file --check
> +  if [ $? -ne 0 ]
> +  then
> +    echo "Uncrustify check failure on file: $file"
> +    FAILURE=1
> +  fi
> +done
> +
> +if [ $FAILURE -eq 0 ]
> +then
> +  exit 0
> +fi
> +
> +exit 1
> diff --git a/.github/.github/workflows/uncrustify.yml
> b/.github/.github/workflows/uncrustify.yml
> new file mode 100644
> index 00000000..aa603c8d
> --- /dev/null
> +++ b/.github/.github/workflows/uncrustify.yml
> @@ -0,0 +1,44 @@
> +# @file
> +# GitHub Workflow for uncrustify check
> +#
> +# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights
> reserved.
> +#
> +# SPDX-License-Identifier: BSD-2-Clause-Patent
> +##
> +name: "Uncrustify check"
> +on:
> +  pull_request:
> +    branches:
> +      - main
> +    paths:
> +      - '**/*.h'
> +      - '**/*.c'
> +
> +jobs:
> +  uncrustify-check:
> +    runs-on: ubuntu-latest
> +    name: Uncrustify check
> +    steps:
> +      - name: checkout edk2
> +        uses: actions/checkout at v3
> +        with:
> +          repository: tianocore/edk2
> +          path: ./edk2
> +      - name: checkout edk2-redfish-client
> +        uses: actions/checkout at v3
> +        with:
> +          path: ./edk2-redfish-client
> +          ref: ${{ github.event.pull_request.head.sha }}
> +          fetch-depth: 0
> +      - name: uncrustify setup
> +        run: |
> +          git clone
> https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fprojectmu%40dev.azure.com%2Fprojectmu%2FUncrustify%2F_git%2FUncrustify&data=05%7C01%7Cigork%40ami.com%7Cfe7c0814e24544d5839a08db67b73fa7%7C27e97857e15f486cb58e86c2b3040f93%7C1%7C0%7C638217808989823384%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=G3FDWSoOa51omLECnejM1KQltXtVzH3r0YcET%2B0FqJs%3D&reserved=0<https://projectmu@dev.azure.com/projectmu/Uncrustify/_git/Uncrustify>
> uncrustify-edk2
> +          cd uncrustify-edk2
> +          mkdir build
> +          cd build
> +          cmake ..
> +          cmake --build .
> +          cp uncrustify /usr/local/bin && chmod +x /usr/local/bin/uncrustify
> +      - name: uncrustify check changed files
> +        run: ./edk2-redfish-client/.github/workflows/uncrustify-
> check.sh ./edk2/.pytool/Plugin/UncrustifyCheck/uncrustify.cfg ./edk2-
> redfish-client ${{ github.event.pull_request.commits }}
> +        shell: bash
> --
> 2.17.1

-The information contained in this message may be confidential and proprietary to American Megatrends (AMI). This communication is intended to be read only by the individual or entity to whom it is addressed or by their designee. If the reader of this message is not the intended recipient, you are on notice that any distribution of this message, in any form, is strictly prohibited. Please promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and then delete or destroy all copies of the transmission.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#105884): https://edk2.groups.io/g/devel/message/105884
Mute This Topic: https://groups.io/mt/99388066/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/edk2-devel-archive/attachments/20230608/805f35f3/attachment-0001.htm>


More information about the edk2-devel-archive mailing list