public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Chang, Abner" <abner.chang@amd.com>
To: Nickle Wang <nicklew@nvidia.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: Igor Kulchytskyy <igork@ami.com>
Subject: Re: [edk2-redfish-client][PATCH] RedfishClientPkg/.github: add build check and uncrustify check
Date: Thu, 8 Jun 2023 00:28:11 +0000	[thread overview]
Message-ID: <MN2PR12MB3966259CFF6014D7023C6589EA50A@MN2PR12MB3966.namprd12.prod.outlook.com> (raw)
In-Reply-To: <20230607161223.15282-1-nicklew@nvidia.com>

[AMD Official Use Only - General]

Nice work Nickle!!

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

> -----Original Message-----
> From: Nickle Wang <nicklew@nvidia.com>
> Sent: Thursday, June 8, 2023 12:12 AM
> To: devel@edk2.groups.io
> Cc: Chang, Abner <Abner.Chang@amd.com>; Igor Kulchytskyy
> <igork@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@nvidia.com>
> Cc: Abner Chang <abner.chang@amd.com>
> Cc: Igor Kulchytskyy <igork@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://www.nasm.us/pub/nasm/releasebuilds/"
> +  echo ""
> +  echo "1) wget
> 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@v3
> +        with:
> +          repository: tianocore/edk2
> +          path: ./edk2
> +          submodules: recursive
> +      - name: checkout edk2-redfish-client
> +        uses: actions/checkout@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@v3
> +        with:
> +          repository: tianocore/edk2
> +          path: ./edk2
> +      - name: checkout edk2-redfish-client
> +        uses: actions/checkout@v3
> +        with:
> +          path: ./edk2-redfish-client
> +          ref: ${{ github.event.pull_request.head.sha }}
> +          fetch-depth: 0
> +      - name: uncrustify setup
> +        run: |
> +          git clone
> 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


  reply	other threads:[~2023-06-08  0:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-07 16:12 [edk2-redfish-client][PATCH] RedfishClientPkg/.github: add build check and uncrustify check Nickle Wang
2023-06-08  0:28 ` Chang, Abner [this message]
2023-06-08  1:06   ` Igor Kulchytskyy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=MN2PR12MB3966259CFF6014D7023C6589EA50A@MN2PR12MB3966.namprd12.prod.outlook.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox