Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support the ability to run e2e tests on different testbeds/NICs #147

Merged
merged 5 commits into from
Mar 20, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/e2e.yaml
akiselev1 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ on:
workflow_dispatch:
jobs:
e2e-tests:
runs-on: self-hosted
if: contains(github.event.label.name, 'e2e-test')
if: contains(github.event.label.name, 'e2e-test') || (github.event_name == 'workflow_dispatch')
runs-on: [self-hosted, 810]
steps:
- uses: actions/checkout@v3
with:
Expand Down
78 changes: 78 additions & 0 deletions .github/workflows/e2e710.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: sriov-e2e-test710
run-name: sriov-e2e-test710 initiated by ${{ github.actor }}
on:
pull_request:
types: [labeled]
workflow_dispatch:
jobs:
test710:
if: contains(github.event.label.name, 'test710') || (github.event_name == 'workflow_dispatch')
runs-on: [self-hosted, 710]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: 3.7
- 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"
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
echo "generated=true" >> $GITHUB_ENV
elif [[ ${#tests[@]} -ne 0 ]]; then
test_string="pytest -v --html=report.html --self-contained-html"
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: 3
- name: Display Status
run: echo "This job's status is ${{ job.status }}."
remove-label:
needs: test710
permissions:
pull-requests: write
issues: write
runs-on: ubuntu-latest
if: always() && contains(github.event.label.name, 'test710')
steps:
- name: remove label
run: |
curl --silent -X DELETE -H 'Accept: application/vnd.github.v3+json' -H 'Authorization: token ${{ github.token }}' 'https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.number }}/labels/test710'