Skip to content

Commit

Permalink
Merge branch 'develop' into as/update_wwb
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderDokuchaev authored Nov 28, 2024
2 parents 9f1299a + 2db9fb9 commit 3603a82
Show file tree
Hide file tree
Showing 302 changed files with 51,824 additions and 32,615 deletions.
74 changes: 74 additions & 0 deletions .github/scripts/pytest_md_summary.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Copyright (c) 2024 Intel Corporation
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import sys
import xml.etree.ElementTree as ET


def parse_xml_report(xml_file) -> None:
"""
Parse the XML report generated by pytest.
:param xml_file: Path to the XML report file
:return: None
"""
try:
tree = ET.parse(xml_file)
except FileNotFoundError:
sys.exit(1)

root = tree.getroot()

# Build the summary table in Markdown format
table_lines = []
table_lines.append("| Test Name | Status | Time | Message |")
table_lines.append("|:----------|:------:|-----:|:--------|")

# Iterate over test cases
for testcase in root.findall(".//testcase"):
test_name = testcase.get("name")
time_duration = float(testcase.get("time", "0"))
message = ""
if testcase.find("failure") is not None:
status = "$${\color{red}Failed}$$"
message = testcase.find("failure").get("message", "")
elif testcase.find("error") is not None:
status = "$${\color{red}Error}$$"
elif testcase.find("skipped") is not None:
status = "$${\color{orange}Skipped}$$"
message = testcase.find("skipped").get("message", "")
else:
status = "$${\color{green}Ok}$$"

# Append each row to the table
if message:
message = message.splitlines()[0][:60]
table_lines.append(f"| {test_name} | {status} | {time_duration:.0f} | {message} |")

if len(table_lines) > 2:
# Print the summary table only if there are test cases
print("\n".join(table_lines))


if __name__ == "__main__":
"""
This script generates a summary table in Markdown format from an XML report generated by pytest.
Usage in GitHub workflow:
- name: Test Summary
if: ${{ !cancelled() }}
run: |
python .github/scripts/generate_examples_summary.py pytest-results.xml >> $GITHUB_STEP_SUMMARY
"""
try:
parse_xml_report(sys.argv[1])
except Exception as e:
print(f"Error: {e}")
2 changes: 1 addition & 1 deletion .github/workflows/api_set_label.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,5 @@ jobs:
issue_number: ${{ steps.status.outputs.pr_number }},
owner: context.repo.owner,
repo: context.repo.repo,
labels: "API"
name: "API"
})
20 changes: 12 additions & 8 deletions .github/workflows/examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ on:
description: 'Pytest arguments'
default: ''

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 exmaples CPU [${{ matrix.group }}/4]
Expand Down Expand Up @@ -48,19 +52,19 @@ jobs:
run: pip list
- name: Run examples test scope
run: |
python -m pytest -ras tests/cross_fw/examples \
--junit-xml=pytest-results-${{ matrix.group }}.xml \
set +e
python -m pytest -s -ra tests/cross_fw/examples \
--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: Upload artifact
uses: actions/upload-artifact@v4
- name: Test Summary
if: ${{ !cancelled() }}
with:
name: pytest-results-${{ matrix.group }}
path: pytest-results-${{ matrix.group }}.xml
overwrite: True
run: |
python .github/scripts/pytest_md_summary.py pytest-results.xml >> $GITHUB_STEP_SUMMARY
93 changes: 93 additions & 0 deletions .github/workflows/install.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: Test install
permissions: read-all

on:
workflow_dispatch:
inputs:
pull_request_number:
description: 'The pull request number'
default: ''
schedule:
- cron: '0 0 * * *'

jobs:
install-cpu:
name: Test install [${{ matrix.backend }} - ${{ matrix.runner }}]
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
backend: ["torch", "tf", "onnx", "openvino"]
runner: ["windows-latest", "ubuntu-22.04"]
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
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@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0
with:
python-version: "3.10"
cache: pip
- name: Install test requirements
run: |
pip install -r tests/cross_fw/examples/requirements.txt
- name: Print installed modules
run: pip list
- name: Run install test scope
run: pytest tests/cross_fw/install -rA -s --host-configuration cpu --backend ${{ matrix.backend }}

install-torch-gpu:
name: Test install [torch - ubuntu-gpu]
defaults:
run:
shell: bash
runs-on: aks-linux-4-cores-28gb-gpu-tesla-t4
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 virtualenv
- name: Download CUDA
run: |
wget -q https://developer.download.nvidia.com/compute/cuda/12.4.0/local_installers/cuda_12.4.0_550.54.14_linux.run
sudo sh cuda_12.4.0_550.54.14_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
nvcc --version
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
with:
lfs: true
- 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@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0
with:
python-version: 3.10.14
cache: pip
- name: Install test requirements
run: |
pip install -r tests/cross_fw/examples/requirements.txt
- name: Print installed modules
run: pip list
- name: Run install test scope
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}}
pytest tests/cross_fw/install -rA -s --host-configuration gpu --backend torch
12 changes: 6 additions & 6 deletions .github/workflows/precommit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,13 @@ jobs:
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.1.1/local_installers/cuda_12.1.1_530.30.02_linux.run
sudo sh cuda_12.1.1_530.30.02_linux.run --toolkit --silent
wget -q https://developer.download.nvidia.com/compute/cuda/12.4.0/local_installers/cuda_12.4.0_550.54.14_linux.run
sudo sh cuda_12.4.0_550.54.14_linux.run --toolkit --silent
- name: Runner info
continue-on-error: true
run: |
export PATH=/usr/local/cuda-12.1/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-12.1/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
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
nvcc --version
Expand All @@ -147,8 +147,8 @@ jobs:
python -c "import torch; print(torch.cuda.is_available())"
- name: Run PyTorch precommit test scope
run: |
export PATH=/usr/local/cuda-12.1/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-12.1/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
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}}
make test-torch-cuda
tensorflow:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ examples/post_training_quantization/openvino/yolov8/yolov8n*
examples/post_training_quantization/openvino/yolov8_quantize_with_accuracy_control/yolov8n*
examples/**/runs/**
examples/**/results/**
examples/llm_compression/openvino/tiny_llama_find_hyperparams/statistics
compressed_graph.dot
original_graph.dot
datasets/**
Expand Down
Loading

0 comments on commit 3603a82

Please sign in to comment.