Skip to content

Commit

Permalink
Refine p4cp github lint workflows (#398)
Browse files Browse the repository at this point in the history
- Rename lintdocs.yml to linters.yml.

- Move py_bandit_check and clang_format_check to linters.yml.

- Expand py_bandit_check to apply to all .py files.

Signed-off-by: Derek G Foster <derek.foster@intel.com>
Signed-off-by: Satish Pitchikala <satish.pitchikala@intel.com>
  • Loading branch information
ffoulkes authored and satish153 committed Feb 2, 2024
1 parent ff41406 commit cf10b95
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 51 deletions.
52 changes: 51 additions & 1 deletion .github/workflows/lintdocs.yml → .github/workflows/linters.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "Lint P4CP Documentation"
name: "P4CP lint checks"

on:
push:
Expand All @@ -10,6 +10,11 @@ on:
- main
- ipdk_v*

concurrency:
# If workflow is currently running, stop it and start a new one.
group: lint-${{ github.ref }}
cancel-in-progress: true

permissions: read-all

jobs:
Expand Down Expand Up @@ -106,3 +111,48 @@ jobs:
if: steps.changed.outputs.any_changed == 'true'
run: |
rstcheck ${{ steps.changed.outputs.all_changed_files }}
#---------------------------------------------------------------------
# 4-py_bandit_check
#---------------------------------------------------------------------
py_bandit_check:
timeout-minutes: 5
runs-on: ubuntu-latest
steps:
- name: Clone networking-recipe
uses: actions/checkout@v4

- name: Check Python files
uses: tj-actions/bandit@v5.5
with:
targets: | # or a single string "."
**/**.py
clients/p4rt-ctl/p4rt-ctl.in
options: "-v"

#---------------------------------------------------------------------
# 5-clang_format_check
#---------------------------------------------------------------------
clang_format_check:
runs-on: ubuntu-latest
timeout-minutes: 5

steps:
- name: Check out repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Get list of changed files
id: changed
uses: tj-actions/changed-files@v41
with:
files: |
**.c
**.cc
**.h
- name: Check for formatting errors
if: steps.changed.outputs.any_changed == 'true'
run: |
clang-format -n -Werror ${{ steps.changed.outputs.all_changed_files }}
52 changes: 3 additions & 49 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "P4 Control Plane CI Pipeline"
name: "P4CP build checks"

on:
push:
Expand All @@ -11,7 +11,7 @@ on:
- ipdk_v*

concurrency:
# If workflow for PR or push is already running, stop it and start a new one.
# If workflow is currently running, stop it and start a new one.
group: build-${{ github.ref }}
cancel-in-progress: true

Expand Down Expand Up @@ -126,26 +126,7 @@ jobs:
cmake --build build --target krnlmon-test
#---------------------------------------------------------------------
# 3-py_bandit_check
#---------------------------------------------------------------------
py_bandit_check:
timeout-minutes: 5
runs-on: ubuntu-latest
steps:
- name: Clone networking-recipe
uses: actions/checkout@v4
with:
path: recipe

- name: Check p4rt-ctl
uses: tj-actions/bandit@v5.5
with:
targets: | # or a single string "."
./recipe/clients/p4rt-ctl/p4rt-ctl.in
options: "-v"

#---------------------------------------------------------------------
# 4-build_p4runtime_protos
# 3-build_p4runtime_protos
#---------------------------------------------------------------------
build_p4runtime_protos:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -212,30 +193,3 @@ jobs:
cmake -B build
cmake --build build
cmake --install build --prefix install
#---------------------------------------------------------------------
# 5-clang_format_check
#---------------------------------------------------------------------
clang_format_check:
runs-on: ubuntu-latest
timeout-minutes: 5

steps:
- name: Check out repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Get list of changed files
id: changed
uses: tj-actions/changed-files@v42
with:
files: |
**.c
**.cc
**.h
- name: Check for formatting errors
if: steps.changed.outputs.any_changed == 'true'
run: |
clang-format -n -Werror ${{ steps.changed.outputs.all_changed_files }}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!-- markdownlint-disable MD041 -->
[![P4 Control Plane CI Pipeline](https://github.com/ipdk-io/networking-recipe/actions/workflows/pipeline.yml/badge.svg)](https://github.com/ipdk-io/networking-recipe/actions/workflows/pipeline.yml)
[![P4CP build checks](https://github.com/ipdk-io/networking-recipe/actions/workflows/pipeline.yml/badge.svg)](https://github.com/ipdk-io/networking-recipe/actions/workflows/pipeline.yml)
<!-- markdownlint-enable MD041 -->
# P4 Control Plane

Expand Down

0 comments on commit cf10b95

Please sign in to comment.