Skip to content

Merge pull request #27 from Ruoyu-y/golang-vsock #5

Merge pull request #27 from Ruoyu-y/golang-vsock

Merge pull request #27 from Ruoyu-y/golang-vsock #5

name: VMSDK Python Test
on:
push:
branches:
- main
paths:
- 'src/python/**/*'
- 'setupenv.sh'
- '.github/workflows/vmsdk-test-python.yaml'
pull_request:
paths:
- 'src/python/**/*'
- 'setupenv.sh'
- '.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: Clean up intermediate files
continue-on-error: true
run: |
# Remove the intermediate files that could be left
# by previous run with sudo. Otherwise, the checkout
# will fail with permission issue.
sudo rm -fr ./*
- 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"