VMSDK Python Test #166
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: VMSDK Python Test | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- 'common/**/*.py' | |
- 'setupenv.sh' | |
- '.github/workflows/vmsdk-test-python.yaml' | |
pull_request: | |
paths: | |
- 'common/**/*.py' | |
- 'setupenv.sh' | |
- '.github/workflows/vmsdk-test-python.yaml' | |
workflow_dispatch: | |
env: | |
VMSDK_PYTEST_DIR: 'vmsdk_pytest' | |
VMSDK_DIR: 'cc-trusted-vmsdk' | |
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 evidence-api repo | |
uses: actions/checkout@v4 | |
with: | |
path: ${{env.VMSDK_PYTEST_DIR}} | |
- name: Checkout cc-trusted-vmsdk repo | |
uses: actions/checkout@v4 | |
with: | |
repository: cc-api/cc-trusted-vmsdk | |
path: ${{env.VMSDK_PYTEST_DIR}}/${{env.VMSDK_DIR}} | |
- name: Run PyTest for VMSDK | |
run: | | |
set -ex | |
cd ${{env.VMSDK_DIR}} | |
# The trick here is that we need to use the local version | |
# of evidence_api instead of the version installed by | |
# setupenv.sh. So uninstall it and reinstall from local. | |
sudo su -c 'source setupenv.sh && \ | |
python3 -m pip uninstall -y evidence_api && \ | |
python3 -m pip install ../common/python && \ | |
cd src/python/tests && \ | |
python3 -m pytest -v test_sdk.py' |