Skip to content

validation-bare-metal #8

validation-bare-metal

validation-bare-metal #8

name: validation-bare-metal
on:
# allow manually trigger
workflow_dispatch:
inputs:
branch-to-checkout:
type: string
default: 'main'
required: false
description: 'Branch name to use'
validation-tests:
type: string
default: 'tests/single/video/pacing'
required: true
description: 'Validation tests to run'
env:
# Customize the env if
BUILD_TYPE: 'Release'
DPDK_VERSION: '23.11'
# Bellow ENV variables are required to be defined on runner side:
# TEST_PF_PORT_P: '0000:49:00.0'
# TEST_PF_PORT_R: '0000:49:00.1'
# TEST_PORT_P: '0000:49:01.2'
# TEST_PORT_R: '0000:49:01.3'
# TEST_DMA_PORT_P: '0000:6a:01.0'
# TEST_DMA_PORT_R: '0000:6f:01.0'
permissions:
contents: read
jobs:
validation-build-mtl:
runs-on: [Linux, self-hosted, DPDK]
timeout-minutes: 60
outputs:
pipenv-activate: ${{ steps.pipenv-install.outputs.VIRTUAL_ENV }}
steps:
- name: 'preparation: Harden Runner'
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
with:
egress-policy: audit
- name: 'preparation: Checkout MTL'
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: '${{ inputs.branch-to-checkout }}'
- name: 'preparation: Checkout DPDK'
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
repository: 'DPDK/dpdk'
ref: 'v${{ env.DPDK_VERSION }}'
path: 'dpdk'
- name: 'configuration: Install the build dependency'
run: |
sudo apt-get install -y git gcc meson python3 python3-pyelftools pkg-config libnuma-dev libjson-c-dev libpcap-dev libgtest-dev libsdl2-dev libsdl2-ttf-dev libssl-dev
sudo apt-get install -y systemtap-sdt-dev
- name: 'configuration: Apply dpdk patches'
run: |
patch -d "dpdk" -p1 -i <(cat patches/dpdk/${{ env.DPDK_VERSION }}/*.patch)
- name: 'installation: Build dpdk'
run: |
cd dpdk
meson build
ninja -C build
cd build
sudo ninja install
- name: 'installation: Build mtl'
run: |
./build.sh
sudo ldconfig
- name: 'installation: Install pipenv environment'
working-directory: tests/validation
id: pipenv-install
run: |
sudo apt remove -y pipenv || true
sudo apt install -y python3-virtualenv python3-pip
python3 -m pip install pipenv
python3 -m pipenv install -r requirements.txt
echo "VIRTUAL_ENV=$(python3 -m pipenv --venv)/bin/activate" >> "$GITHUB_ENV"
validation-run-tests:
needs: [validation-build-mtl]
runs-on: [Linux, self-hosted, DPDK]
steps:
- name: 'preparation: Harden Runner'
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
with:
egress-policy: audit
- name: 'preparation: Kill MtlManager and pytest routines'
run: |
sudo killall -SIGINT pipenv || true
sudo killall -SIGINT pytest || true
sudo killall -SIGINT MtlManager || true
- name: 'preparation: Binding network adapter'
run: |
sudo ./script/nicctl.sh create_vf "${TEST_PF_PORT_P}" || true
sudo ./dpdk/usertools/dpdk-devbind.py -b vfio-pci "${TEST_DMA_PORT_P}" || true
sudo ./dpdk/usertools/dpdk-devbind.py -b vfio-pci "${TEST_DMA_PORT_R}" || true
- name: 'preparation: Start MtlManager at background'
run: |
sudo MtlManager &
- name: 'execution: Run tests in pipenv environment'
working-directory: tests/validation
run: |
source "$(python3 -m pipenv --venv)/bin/activate"
sudo --preserve-env python3 -m pipenv run pytest '${{ inputs.validation-tests }}' --nic="${TEST_PORT_P},${TEST_PORT_R}" --media=/mnt/media --build='../..'
validation-cleanup-tests:
needs: [validation-build-mtl, validation-run-tests]
runs-on: [Linux, self-hosted, DPDK]
if: always()
steps:
- name: 'preparation: Harden Runner'
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
with:
egress-policy: audit
- name: 'cleanup: Kill MtlManager and pytest routines'
run: |
sudo killall -SIGINT pipenv || true
sudo killall -SIGINT pytest || true
sudo killall -SIGINT MtlManager || true
- name: 'cleanup: Restore valid owner to repository and directories'
run: |
sudo chown -R "${USER}" "$(pwd)"