[edk2-devel] [edk2-redfish-client][PATCH] RedfishClientPkg/.github: add patch check

Igor Kulchytskyy via groups.io igork=ami.com at groups.io
Mon Jun 12 16:19:51 UTC 2023


Reviewed-by: Igor Kulchytskyy <igork at ami.com>

-----Original Message-----
From: Nickle Wang <nicklew at nvidia.com>
Sent: Monday, June 12, 2023 11:15 AM
To: devel at edk2.groups.io
Cc: Abner Chang <abner.chang at amd.com>; Igor Kulchytskyy <igork at ami.com>
Subject: [EXTERNAL] [edk2-redfish-client][PATCH] RedfishClientPkg/.github: add patch check


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

- Run /BaseTools/Scripts/PatchCheck.py to check changes
on pull request.
- Create main.yml to handle push check on main branch.
And show the status of RedfishClientPkg on README.md

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/workflows/build.yml       |  3 --
 .github/workflows/main.yml        | 58 +++++++++++++++++++++++++++++++
 .github/workflows/patch-check.sh  | 47 +++++++++++++++++++++++++
 .github/workflows/patch-check.yml | 39 +++++++++++++++++++++
 README.md                         |  3 ++
 5 files changed, 147 insertions(+), 3 deletions(-)
 create mode 100644 .github/workflows/main.yml
 create mode 100755 .github/workflows/patch-check.sh
 create mode 100644 .github/workflows/patch-check.yml

diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index f44184b3..e5a61992 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -7,9 +7,6 @@
 ##
 name: "RedfishClientPkg Build"
 on:
-  push:
-    branches:
-      - main
   pull_request:
     branches:
       - main
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
new file mode 100644
index 00000000..4bfd5e8f
--- /dev/null
+++ b/.github/workflows/main.yml
@@ -0,0 +1,58 @@
+# @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
+    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/workflows/patch-check.sh b/.github/workflows/patch-check.sh
new file mode 100755
index 00000000..8cc63bd5
--- /dev/null
+++ b/.github/workflows/patch-check.sh
@@ -0,0 +1,47 @@
+#!/bin/bash
+#
+# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+
+if [ $# -ne 2 ]
+then
+    echo "usage: $0 [PATH to PATCH-SET] [PATH to EDK2 REPO.]"
+    exit 1
+fi
+
+PATCH_FOLDER="$PWD/$1"
+REPO_PATH="$PWD/$2"
+FAILURE=0
+
+if [ ! -e "$PATCH_FOLDER" ]
+then
+    echo "$PATCH_FOLDER does not exist"
+    exit 1
+fi
+
+if [ ! -e "$REPO_PATH" ]
+then
+    echo "$REPO_PATH does not exist"
+    exit 1
+fi
+
+for file in `ls $PATCH_FOLDER/*.patch`
+do
+  echo "Check patch: $file"
+  python3 $REPO_PATH/BaseTools/Scripts/PatchCheck.py $file
+  if [ $? -ne 0 ]
+  then
+    echo "Patch check failure on file: $file"
+    FAILURE=1
+  fi
+done
+
+if [ $FAILURE -eq 0 ]
+then
+  exit 0
+fi
+
+exit 1
diff --git a/.github/workflows/patch-check.yml b/.github/workflows/patch-check.yml
new file mode 100644
index 00000000..2fdef679
--- /dev/null
+++ b/.github/workflows/patch-check.yml
@@ -0,0 +1,39 @@
+# @file
+# GitHub Workflow for patch check
+#
+# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+name: "Patch check"
+on:
+  pull_request:
+    branches:
+      - main
+
+jobs:
+  patch-check:
+    runs-on: ubuntu-latest
+    name: EDK2 Patch 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: generate format patch
+        run: |
+          mkdir format-patch
+          cd edk2-redfish-client
+          git format-patch --subject-prefix="edk2-redfish-client][PATCH" -${{ github.event.pull_request.commits }} HEAD -O ../edk2/BaseTools/Conf/diff.order -o ../format-patch/
+          ls ../format-patch/
+      - name: run PatchCheck.py
+        run: |
+          ./edk2-redfish-client/.github/workflows/patch-check.sh ./format-patch/ ./edk2/
+        shell: bash
diff --git a/README.md b/README.md
index 478f319b..0babe593 100644
--- a/README.md
+++ b/README.md
@@ -5,6 +5,9 @@ and provides the functionality to support Redfish service hosted by Board Manage
 Please check [Readme.md](https://github.com/tianocore/edk2/blob/master/RedfishPkg/Readme.md) for the design of
 UEFI Redfish EDK2 implementation.

+# Status
+[![RedfishClientPkg Build](https://github.com/tianocore/edk2-redfish-client/actions/workflows/main.yml/badge.svg)](https://github.com/tianocore/edk2-redfish-client/actions/workflows/main.yml)
+
 # License
 The majority of the content in the EDK Redfish Client open source project uses a
 [BSD-2-Clause Plus Patent License](LICENSE). The EDKII Redfish client open source project contains the following
--
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 (#106025): https://edk2.groups.io/g/devel/message/106025
Mute This Topic: https://groups.io/mt/99485417/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-




More information about the edk2-devel-archive mailing list