SonarQube Cognitive Complexity Fixes on ParsePDR (#1204) #1092
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # SPDX-License-Identifier: Apache-2.0 | |
| # Copyright 2023 Canonical Ltd. | |
| # Copyright 2024 Intel Corporation | |
| name: CI Pipeline | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| push: | |
| branches: | |
| - main | |
| permissions: | |
| contents: read | |
| jobs: | |
| whitespace: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1 | |
| with: | |
| extra_args: trailing-whitespace --all-files | |
| - uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1 | |
| with: | |
| extra_args: end-of-file-fixer --all-files | |
| bess-changes: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| source: ${{ steps.filter.outputs.source }} | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d # v4.0.3 | |
| id: filter | |
| with: | |
| filters: | | |
| source: | |
| - 'bess/**' | |
| - '.github/workflows/main.yml' | |
| bess-source-tests: | |
| needs: bess-changes | |
| if: needs.bess-changes.outputs.source == 'true' | |
| runs-on: ubuntu-latest | |
| env: | |
| CXX: "ccache g++" | |
| DEBIAN_FRONTEND: noninteractive | |
| NEEDRESTART_MODE: a | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - name: Restore ccache | |
| uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 | |
| with: | |
| path: ~/.cache/ccache | |
| key: bess-ccache-${{ runner.os }}-${{ github.sha }} | |
| restore-keys: bess-ccache-${{ runner.os }}- | |
| - name: Set up hugepages | |
| run: | | |
| sudo sysctl -w vm.nr_hugepages=1024 | |
| sudo mkdir -p /mnt/huge | |
| sudo mount -t hugetlbfs nodev /mnt/huge | |
| - name: Install BESS dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y ansible | |
| sudo ansible-playbook bess/env/ci.yml -i "localhost," -c local | |
| ccache -s | |
| - name: Build BESS and kernel module | |
| env: | |
| BESS_LINK_DYNAMIC: "1" | |
| run: | | |
| cd bess | |
| export PKG_CONFIG_PATH="/usr/lib/pkgconfig:/usr/lib/x86_64-linux-gnu/pkgconfig" | |
| export PKG_CONFIG_PATH="${PKG_CONFIG_PATH}:/usr/local/lib/pkgconfig" | |
| export PKG_CONFIG_PATH="${PKG_CONFIG_PATH}:/usr/local/lib/x86_64-linux-gnu/pkgconfig" | |
| sudo --preserve-env=CXX,PKG_CONFIG_PATH,BESS_LINK_DYNAMIC \ | |
| ./build.py bess | |
| sudo ./build.py kmod | |
| sudo ldconfig | |
| - name: Test BESS | |
| run: | | |
| cd bess | |
| (cd core && ./all_test) | |
| coverage run -m unittest discover -v | |
| python3 bessctl/run_module_tests.py | |
| ccache -s | |
| bessctl/bessctl daemon stop || true | |
| bess-clang-format: | |
| needs: bess-changes | |
| if: needs.bess-changes.outputs.source == 'true' | |
| permissions: | |
| contents: read | |
| actions: read | |
| id-token: write | |
| attestations: write | |
| strategy: | |
| matrix: | |
| path: | |
| - check: bess/core | |
| exclude: '(kmod)' | |
| - check: bess/protobuf | |
| exclude: '' | |
| - check: bess/sample_plugin/modules | |
| exclude: '' | |
| - check: bess/sample_plugin/protobuf | |
| exclude: '' | |
| uses: omec-project/.github/.github/workflows/check-clang-format.yml@c6f69e74f8ee9034dcc237ccbd719de59526aee5 # v0.0.30 | |
| with: | |
| branch_name: ${{ github.ref }} | |
| clang_format_version: '14' | |
| check_path: ${{ matrix.path.check }} | |
| exclude_regex: ${{ matrix.path.exclude }} | |
| build: | |
| if: github.event_name == 'pull_request' | |
| permissions: | |
| contents: read | |
| actions: read | |
| security-events: write | |
| id-token: write | |
| attestations: write | |
| uses: omec-project/.github/.github/workflows/docker-build.yml@c6f69e74f8ee9034dcc237ccbd719de59526aee5 # v0.0.30 | |
| with: | |
| branch_name: ${{ github.ref }} | |
| run_pre_build: true | |
| docker_targets: "bess pfcp" | |
| build-ptf: | |
| if: github.event_name == 'pull_request' | |
| permissions: | |
| contents: read | |
| actions: read | |
| security-events: write | |
| id-token: write | |
| attestations: write | |
| uses: omec-project/.github/.github/workflows/docker-build.yml@c6f69e74f8ee9034dcc237ccbd719de59526aee5 # v0.0.30 | |
| with: | |
| branch_name: ${{ github.ref }} | |
| build_directory: "./ptf" | |
| build_command: "make build" | |
| static-analysis: | |
| permissions: | |
| contents: read | |
| security-events: write | |
| actions: read | |
| id-token: write | |
| attestations: write | |
| uses: omec-project/.github/.github/workflows/static-analysis.yml@c6f69e74f8ee9034dcc237ccbd719de59526aee5 # v0.0.30 | |
| with: | |
| branch_name: ${{ github.ref }} | |
| lint: | |
| permissions: | |
| contents: read | |
| checks: write | |
| id-token: write | |
| attestations: write | |
| uses: omec-project/.github/.github/workflows/lint.yml@c6f69e74f8ee9034dcc237ccbd719de59526aee5 # v0.0.30 | |
| with: | |
| golangci_lint_version: 'v2.11.3' | |
| branch_name: ${{ github.ref }} | |
| hadolint: | |
| permissions: | |
| contents: read | |
| security-events: write | |
| id-token: write | |
| attestations: write | |
| uses: omec-project/.github/.github/workflows/hadolint.yml@c6f69e74f8ee9034dcc237ccbd719de59526aee5 # v0.0.30 | |
| with: | |
| branch_name: ${{ github.ref }} | |
| check-spelling: | |
| permissions: | |
| contents: read | |
| checks: write | |
| id-token: write | |
| attestations: write | |
| uses: omec-project/.github/.github/workflows/check-spelling.yml@c6f69e74f8ee9034dcc237ccbd719de59526aee5 # v0.0.30 | |
| with: | |
| branch_name: ${{ github.ref }} | |
| route-control-tests: | |
| permissions: | |
| contents: read | |
| checks: write | |
| id-token: write | |
| attestations: write | |
| uses: omec-project/.github/.github/workflows/upf-route-control-tests.yml@c6f69e74f8ee9034dcc237ccbd719de59526aee5 # v0.0.30 | |
| with: | |
| branch_name: ${{ github.ref }} | |
| unit-tests-pfcp: | |
| permissions: | |
| contents: read | |
| checks: write | |
| id-token: write | |
| attestations: write | |
| uses: omec-project/.github/.github/workflows/unit-test.yml@c6f69e74f8ee9034dcc237ccbd719de59526aee5 # v0.0.30 | |
| with: | |
| branch_name: ${{ github.ref }} | |
| test_flags: "-race -failfast -v" | |
| test_directory: "./pfcpiface ./cmd/..." | |
| integration-tests-bess: | |
| permissions: | |
| contents: read | |
| checks: write | |
| id-token: write | |
| attestations: write | |
| uses: omec-project/.github/.github/workflows/unit-test.yml@c6f69e74f8ee9034dcc237ccbd719de59526aee5 # v0.0.30 | |
| with: | |
| branch_name: ${{ github.ref }} | |
| test_flags: "-race -failfast -v -count=1" | |
| test_directory: "./test/integration/..." | |
| env_vars: "MODE=native DATAPATH=bess" | |
| license-check: | |
| permissions: | |
| contents: read | |
| id-token: write | |
| attestations: write | |
| uses: omec-project/.github/.github/workflows/license-check.yml@c6f69e74f8ee9034dcc237ccbd719de59526aee5 # v0.0.30 | |
| with: | |
| branch_name: ${{ github.ref }} | |
| fossa-scan: | |
| permissions: | |
| contents: read | |
| security-events: write | |
| id-token: write | |
| attestations: write | |
| uses: omec-project/.github/.github/workflows/fossa-scan.yml@c6f69e74f8ee9034dcc237ccbd719de59526aee5 # v0.0.30 | |
| with: | |
| branch_name: ${{ github.ref }} | |
| analysis: | |
| if: github.repository_owner == 'omec-project' | |
| permissions: | |
| actions: read | |
| artifact-metadata: read | |
| attestations: read | |
| checks: read | |
| code-quality: read | |
| contents: read | |
| deployments: read | |
| discussions: read | |
| drives: read | |
| id-token: write | |
| issues: read | |
| models: read | |
| packages: read | |
| pages: read | |
| pull-requests: read | |
| repository-projects: read | |
| security-events: write | |
| statuses: read | |
| vulnerability-alerts: read | |
| uses: omec-project/.github/.github/workflows/scorecard-analysis.yml@c6f69e74f8ee9034dcc237ccbd719de59526aee5 # v0.0.30 | |
| with: | |
| branch_name: ${{ github.ref }} |