Skip to content

vpp-checkstyle

vpp-checkstyle #101

name: vpp-checkstyle
# yamllint disable-line rule:truthy
on:
workflow_dispatch:
inputs:
GERRIT_BRANCH:
description: "Branch that change is against"
required: true
type: string
GERRIT_CHANGE_ID:
description: "The ID for the change"
required: true
type: string
GERRIT_CHANGE_NUMBER:
description: "The Gerrit number"
required: true
type: string
GERRIT_CHANGE_URL:
description: "URL to the change"
required: true
type: string
GERRIT_EVENT_TYPE:
description: "Type of Gerrit event"
required: true
type: string
GERRIT_PATCHSET_NUMBER:
description: "The patch number for the change"
required: true
type: string
GERRIT_PATCHSET_REVISION:
description: "The revision sha"
required: true
type: string
GERRIT_PROJECT:
description: "Project in Gerrit"
required: true
type: string
GERRIT_REFSPEC:
description: "Gerrit refspec of change"
required: true
type: string
env:
GERRIT_BRANCH: ${{ inputs.GERRIT_BRANCH }}
GERRIT_CHANGE_ID: ${{ inputs.GERRIT_CHANGE_ID }}
GERRIT_CHANGE_NUMBER: ${{ inputs.GERRIT_CHANGE_NUMBER }}
GERRIT_CHANGE_URL: ${{ inputs.GERRIT_CHANGE_URL }}
GERRIT_EVENT_TYPE: ${{ inputs.GERRIT_EVENT_TYPE }}
GERRIT_PATCHSET_NUMBER: ${{ inputs.GERRIT_PATCHSET_NUMBER }}
GERRIT_PATCHSET_REVISION: ${{ inputs.GERRIT_PATCHSET_REVISION }}
GERRIT_PROJECT: ${{ inputs.GERRIT_PROJECT }}
GERRIT_REFSPEC: ${{ inputs.GERRIT_REFSPEC }}
defaults:
run:
shell: bash
permissions:
contents: read
actions: read
concurrency:
# yamllint disable-line rule:line-length
group: required-verify-${{ github.workflow }}-${{ inputs.GERRIT_BRANCH }}-${{ inputs.GERRIT_CHANGE_ID || github.run_id }}
cancel-in-progress: true
jobs:
checkstyle:
name: vpp-checkstyle-${{ inputs.GERRIT_BRANCH }}-${{ matrix.os }}-${{ matrix.executor_arch }}
if: ${{ inputs.GERRIT_EVENT_TYPE == 'patchset-created' }}
runs-on:
- self-hosted
- nomad
- fdio:arch=${{ matrix.executor_arch }}
- fdio:class=builder
- fdio:namespace=sandbox
- fdio:os=${{ matrix.os }}
env:
TUI_LINE: "*******************************************************************"
strategy:
matrix:
os: [ubuntu2404]
executor_arch: [x86_64]
steps:
- name: "Show Nomad Attributes"
uses: pmikus/.github/.github/actions/show-nomad-attributes@main
- name: "Show Nomad Dockerfile"
uses: pmikus/.github/.github/actions/show-nomad-dockerfile@main
- name: Setup Environment
id: setup-executor-env
uses: pmikus/.github/.github/actions/setup-executor-env@8930b575136625c5c8a47752192f9cd90202bea3
- name: Checkpoint VPP Gerrit Environment Variables
uses: pmikus/.github/.github/actions/gerrit-env-vars-checkpoint@main
- name: Gerrit Checkout
# yamllint disable-line rule:line-length
uses: lfit/checkout-gerrit-change-action@54d751e8bd167bc91f7d665dabe33fae87aaaa63 # v0.9
with:
gerrit-refspec: ${{ inputs.GERRIT_REFSPEC }}
gerrit-project: ${{ inputs.GERRIT_PROJECT }}
gerrit-url: ${{ inputs.GERRIT_CHANGE_URL }}
ref: refs/heads/${{ inputs.GERRIT_BRANCH }}
- name: Retrieve GIT commit message
# yamllint disable-line rule:line-length
uses: lfit/releng-reusable-workflows/.github/actions/git-commit-message-action@main
- name: Run Checkstyle Scripts
run: |
set -euxo pipefail
BUILD_EXT_DIR="build/external"
MATRIX_FILE="$BUILD_EXT_DIR/mlx_rdma_dpdk_matrix.txt"
PKGS_DIR="$BUILD_EXT_DIR/packages"
if git show --stat | grep -q "$MATRIX_FILE" ; then
RDMA_CORE_VERSION="$(grep rdma-core_version $PKGS_DIR/rdma-core.mk | grep -v '(' | mawk '{print $3}')"
DPDK_VERSION="$(grep dpdk_version $PKGS_DIR/dpdk.mk | grep -v '(' | mawk '{print $3}')"
CURRENT_MATRIX="rdma=$RDMA_CORE_VERSION dpdk=$DPDK_VERSION"
if grep -q "$CURRENT_MATRIX" "$MATRIX_FILE"; then
echo -e "$TUI_LINE\n* DPDK/RDMA-CORE matrix file update successfully verified\n$TUI_LINE"
else
echo -e "$TUI_LINE\n* ERROR: 'rdma=$RDMA_CORE_VERSION dpdk=$DPDK_VERSION' not found in $MATRIX_FILE!\n$TUI_LINE"
exit 1
fi
fi
make UNATTENDED=yes checkstyle
# - name: Run Test Checkstyle Scripts
# run: |
# set -euo pipefail
# make test-checkstyle
# - name: Run API Checkstyle Scripts
# run: |
# set -euo pipefail
# VPP_CRC_CHECKER="extras/scripts/crcchecker.py"
# VPP_CRC_CHECKER_CMD="$VPP_CRC_CHECKER --check-patchset"
# # API checker complains if the git repo is not clean.
# # Help diagnosing those issues easier
# git --no-pager diff
# echo "Running $VPP_CRC_CHECKER_CMD"
# if $VPP_CRC_CHECKER_CMD; then
# echo "API check successful"
# else
# RET_CODE=$?
# echo "API check failed: ret code $RET_CODE; please read https://wiki.fd.io/view/VPP/ApiChangeProcess and discuss with ayourtch@gmail.com if unsure how to proceed"
# echo "::error file=.ci/scripts/vpp/crcchecker.py,line=1::API check FAILED for $GITHUB_REF. See run: https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID"
# exit $RET_CODE
# fi
# - name: Run Commit Message Checkstyle
# run: |
# set -euo pipefail
# echo "Running extras/scripts/check_commit_msg.sh"
# extras/scripts/check_commit_msg.sh
# - name: Run Docs Spell
# run: |
# set -euo pipefail
# make docs-spell
- name: Archive Checkstyle Logs
if: always()
uses: actions/upload-artifact@v4
with:
name: checkstyle-logs-${{ inputs.GERRIT_BRANCH }}-${{ matrix.os }}
path: logs/
- name: Report Success
if: success()
run: |
echo "Checkstyle passed for ${{ inputs.GERRIT_BRANCH }} on ${{ matrix.os }}"
echo "::notice::Checkstyle workflow completed successfully! Workflow ID: ${{ github.run_id }}, Name: ${{ github.workflow }}, Repository: ${{ github.repository }}, Branch: ${{ inputs.GERRIT_BRANCH }}"