Test examples #408
This file contains hidden or 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: Test examples | |
permissions: read-all | |
on: | |
workflow_call: | |
workflow_dispatch: | |
inputs: | |
pull_request_number: | |
description: 'The pull request number' | |
default: '' | |
pytest_args: | |
description: 'Pytest arguments' | |
default: '' | |
skip_windows: | |
description: 'Skip tests on Windows' | |
type: boolean | |
default: false | |
skip_gpu: | |
description: 'Skip tests on gpu' | |
type: boolean | |
default: false | |
concurrency: | |
group: test-examples-${{ github.workflow }}-${{ github.ref }}-${{ github.event.inputs.pytest_args || '' }}-${{github.event.inputs.pull_request_number || ''}} | |
cancel-in-progress: false | |
jobs: | |
examples-cpu: | |
name: Test examples CPU [${{ matrix.group }}/4] | |
runs-on: ubuntu-latest-16-cores | |
timeout-minutes: 80 | |
strategy: | |
fail-fast: false | |
matrix: | |
group: [1, 2, 3, 4] | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
with: | |
lfs: true | |
fetch-depth: 0 # Fetch full history to allow checking out any branch or PR | |
- name: Fetch and Checkout the Pull Request Branch | |
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.pull_request_number != '' }} | |
run: | | |
git fetch origin pull/${{ github.event.inputs.pull_request_number }}/head:pr-${{ github.event.inputs.pull_request_number }} | |
git checkout pr-${{ github.event.inputs.pull_request_number }} | |
- uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0 | |
with: | |
python-version: 3.10.14 | |
- name: cpuinfo | |
run: cat /proc/cpuinfo | |
- name: Install test requirements | |
run: | | |
pip install -r tests/cross_fw/examples/requirements.txt | |
- name: Print installed modules | |
run: pip list | |
- name: Run examples test scope | |
run: | | |
set +e | |
python -m pytest -s -ra tests/cross_fw/examples \ | |
-m 'not cuda' \ | |
--junit-xml=pytest-results.xml \ | |
--durations-path=tests/cross_fw/examples/.test_durations \ | |
--splitting-algorithm=least_duration \ | |
--splits 4 \ | |
--group ${{ matrix.group }} \ | |
${{ github.event.inputs.pytest_args || '' }} | |
ret=$? | |
[ $ret -eq 5 ] && [ -n "${{ github.event.inputs.pytest_args || '' }}" ] && exit 0 || exit $ret | |
env: | |
TQDM_DISABLE: 1 | |
- name: Test Summary | |
if: ${{ !cancelled() }} | |
run: | | |
pip install defusedxml==0.7.1 | |
python .github/scripts/pytest_md_summary.py pytest-results.xml >> $GITHUB_STEP_SUMMARY | |
examples-cuda: | |
name: Test examples CUDA [${{ matrix.group }}/1] | |
runs-on: aks-linux-4-cores-28gb-gpu-tesla-t4 | |
timeout-minutes: 40 | |
if: ${{ github.event_name != 'workflow_dispatch' || github.event.inputs.skip_gpu == 'false' }} | |
strategy: | |
fail-fast: false | |
matrix: | |
group: [1] | |
defaults: | |
run: | |
shell: bash | |
env: | |
DEBIAN_FRONTEND: noninteractive | |
steps: | |
- name: Install dependencies | |
run : | | |
sudo apt-get update | |
sudo apt-get --assume-yes install build-essential ninja-build libgl1-mesa-dev libglib2.0-0 wget make | |
- name: Download CUDA | |
run: | | |
wget -q https://developer.download.nvidia.com/compute/cuda/12.6.3/local_installers/cuda_12.6.3_560.35.05_linux.run | |
sudo sh cuda_12.6.3_560.35.05_linux.run --toolkit --silent | |
- name: Runner info | |
continue-on-error: true | |
run: | | |
export PATH=/usr/local/cuda-12.4/bin${PATH:+:${PATH}} | |
export LD_LIBRARY_PATH=/usr/local/cuda-12.4/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}} | |
nvidia-smi | |
cat /proc/cpuinfo | |
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
with: | |
lfs: true | |
fetch-depth: 0 # Fetch full history to allow checking out any branch or PR | |
- name: Fetch and Checkout the Pull Request Branch | |
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.pull_request_number != '' }} | |
run: | | |
git fetch origin pull/${{ github.event.inputs.pull_request_number }}/head:pr-${{ github.event.inputs.pull_request_number }} | |
git checkout pr-${{ github.event.inputs.pull_request_number }} | |
- uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0 | |
with: | |
python-version: 3.10.14 | |
- name: cpuinfo | |
run: cat /proc/cpuinfo | |
- name: Install test requirements | |
run: | | |
pip install -r tests/cross_fw/examples/requirements.txt | |
- name: Print installed modules | |
run: pip list | |
- name: Run examples test scope | |
run: | | |
set +e | |
python -m pytest -s -ra tests/cross_fw/examples \ | |
-m cuda \ | |
--junit-xml=pytest-results.xml \ | |
--durations-path=tests/cross_fw/examples/.test_durations \ | |
--splitting-algorithm=least_duration \ | |
--splits 1 \ | |
--group ${{ matrix.group }} \ | |
${{ github.event.inputs.pytest_args || '' }} | |
ret=$? | |
[ $ret -eq 5 ] && [ -n "${{ github.event.inputs.pytest_args || '' }}" ] && exit 0 || exit $ret | |
env: | |
TQDM_DISABLE: 1 | |
- name: Test Summary | |
if: ${{ !cancelled() }} | |
run: | | |
pip install defusedxml==0.7.1 | |
python .github/scripts/pytest_md_summary.py pytest-results.xml >> $GITHUB_STEP_SUMMARY | |
examples-win-cpu: | |
timeout-minutes: 80 | |
name: Test examples CPU Windows [${{ matrix.group }}/4] | |
runs-on: windows-2025-16-core | |
if: ${{ github.event_name != 'workflow_dispatch' || github.event.inputs.skip_windows == 'false' }} | |
strategy: | |
fail-fast: false | |
matrix: | |
group: [1, 2, 3, 4] | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
with: | |
lfs: true | |
fetch-depth: 0 # Fetch full history to allow checking out any branch or PR | |
- name: Fetch and Checkout the Pull Request Branch | |
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.pull_request_number != '' }} | |
run: | | |
git fetch origin pull/${{ github.event.inputs.pull_request_number }}/head:pr-${{ github.event.inputs.pull_request_number }} | |
git checkout pr-${{ github.event.inputs.pull_request_number }} | |
- uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0 | |
with: | |
python-version: "3.10" | |
- uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0 | |
- name: Install NNCF and test requirements | |
run: | | |
pip install -r tests/cross_fw/examples/requirements.txt | |
- name: Print installed modules | |
run: pip list | |
- name: Run examples test scope | |
run: | | |
set +e | |
export LIB="${LIB};$(python -c "import sysconfig; print(sysconfig.get_config_var('LIBDIR'))")" | |
export LIB="${LIB};$(python -c "import sys; print(sys.prefix + '/libs')")" | |
export INCLUDE="${INCLUDE};$(python -c "import sysconfig; print(sysconfig.get_path('include'))")" | |
python -m pytest -s -ra tests/cross_fw/examples \ | |
-m 'not cuda' \ | |
--junit-xml=pytest-results.xml \ | |
--durations-path=tests/cross_fw/examples/.test_durations \ | |
--splitting-algorithm=least_duration \ | |
--splits 4 \ | |
--group ${{ matrix.group }} \ | |
${{ github.event.inputs.pytest_args || '' }} | |
ret=$? | |
[ $ret -eq 5 ] && [ -n "${{ github.event.inputs.pytest_args || '' }}" ] && exit 0 || exit $ret | |
env: | |
TQDM_DISABLE: 1 | |
NNCF_EXTENSION_LOAD_TIMEOUT: 180 | |
- name: Test Summary | |
if: ${{ !cancelled() }} | |
run: | | |
pip install defusedxml==0.7.1 | |
python .github/scripts/pytest_md_summary.py pytest-results.xml >> $GITHUB_STEP_SUMMARY |