Skip to content

sriov-e2e-test initiated by akiselev1 #68

sriov-e2e-test initiated by akiselev1

sriov-e2e-test initiated by akiselev1 #68

Workflow file for this run

name: sriov-e2e-test
run-name: sriov-e2e-test initiated by ${{ github.actor }}
on:
pull_request:
types: [ labeled ]
workflow_dispatch:
inputs:
tag:
description: 'NIC hardware'
required: true
default: '810'
type: choice
options:
- 810
- 710
jobs:
prepare-label:
runs-on: ubuntu-latest
outputs:
label: ${{ steps.step1.outputs.label }}
steps:
- name: Check label
id: step1
run: |
if [ ${{ github.event.label.name }} == 'e2e-test' ]; then
echo "label=810" >> $GITHUB_OUTPUT
elif [ ${{ github.event.label.name }} == 'e2e-test-710' ]; then
echo "label=710" >> $GITHUB_OUTPUT
elif [ -n ${{ github.event.inputs.tag }} ]; then
echo "label=${{ github.event.inputs.tag }}" >> $GITHUB_OUTPUT
fi
e2e-tests:
needs: [ prepare-label ]
if: ${{ needs.prepare-label.outputs.label }}
runs-on: ${{ needs.prepare-label.outputs.label }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
if [ -f sriov/requirements.txt ]; then pip install -r sriov/requirements.txt; fi
pip install mock
- name: e2e test
working-directory: ${{ github.workspace }}
run: |
files=`git diff --name-only origin/main`
echo "diff files: $files"
pyfiles="conftest.py config.py configtestdata.py utils.py exec.py macros.py e2e.yaml"
mode=""
tests=()
for f in ${files}; do
file=$(basename $f)
if [[ " ${pyfiles} " =~ " ${file} " ]]; then
mode="full"
break
elif [[ "$f" =~ "sriov/tests/" ]]; then
parentdir=$(dirname "$f")
testname=$(basename "${parentdir}")
tests+=("${testname}")
fi
done
cd sriov/tests
cp /config/*.yaml ./
if [[ "${mode}" == "full" ]]; then
pytest -v --html=report.html --self-contained-html SR_IOV_* common --ignore-glob="*test_SR_IOV_Sanity_Performance.py"
echo "generated=true" >> $GITHUB_ENV
elif [[ ${#tests[@]} -ne 0 ]]; then
test_string="pytest -v --html=report.html --self-contained-html --ignore-glob='*test_SR_IOV_Sanity_Performance.py'"
for testname in $(echo "${tests[@]}" | tr ' ' '\n' | sort -u); do
test_string="${test_string} ${testname}"
echo "Testing ${testname}"
done
${test_string}
echo "generated=true" >> $GITHUB_ENV
else
echo "no common code or test case code change - no e2e run"
echo "generated=false" >> $GITHUB_ENV
fi
- name: Upload HTML Artifact
if: ${{ env.generated == 'true' }}
uses: actions/upload-artifact@v3
with:
name: html-report
path: sriov/tests/report.html
retention-days: 30
- name: Display Status
run: echo "This job's status is ${{ job.status }}."