Skip to content

VMSDK Python Test

VMSDK Python Test #13

name: VMSDK Python Test
on:
push:
branches:
- main
paths:
- 'src/python/**/*'
- '.github/workflows/vmsdk-test-python.yaml'
pull_request:
paths:
- 'src/python/**/*'
- '.github/workflows/vmsdk-test-python.yaml'
workflow_dispatch:
env:
VMSDK_PYTEST_DIR: 'vmsdk_pytest'
jobs:
vmsdk_pytest:
runs-on: [self-hosted, tdx-guest]
defaults:
run:
working-directory: ${{env.VMSDK_PYTEST_DIR}}
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
path: ${{env.VMSDK_PYTEST_DIR}}
- name: Run PyTest for VMSDK
run: |
set -ex
# Set the "PYTHONDONTWRITEBYTECODE" and "no:cacheprovider" to prevent
# generated some intermediate files by root. Othwerwise, these
# files will fail the action/checkout in the next round of running
# due to the permission issue.
sudo su -c "source setupenv.sh && \
pushd src/python/tests && \
export PYTHONDONTWRITEBYTECODE=1 && \
python3 -m pytest -p no:cacheprovider -v test_sdk.py && \
popd"