public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-redfish-client][PATCH] RedfishClientPkg/.github: add patch check
@ 2023-06-12 15:15 Nickle Wang
  2023-06-12 15:51 ` Chang, Abner
  2023-06-12 16:19 ` Igor Kulchytskyy
  0 siblings, 2 replies; 3+ messages in thread
From: Nickle Wang @ 2023-06-12 15:15 UTC (permalink / raw)
  To: devel; +Cc: Abner Chang, Igor Kulchytskyy

- 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@nvidia.com>
Cc: Abner Chang <abner.chang@amd.com>
Cc: Igor Kulchytskyy <igork@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@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/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@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: 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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-06-12 16:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-12 15:15 [edk2-redfish-client][PATCH] RedfishClientPkg/.github: add patch check Nickle Wang
2023-06-12 15:51 ` Chang, Abner
2023-06-12 16:19 ` Igor Kulchytskyy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox