Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
c03e9db
add e2e testing: implement full pipeline with Android SDK/NDK setup, …
allnes Aug 21, 2025
3643c7e
enhance Android setup and CI: add verification-only mode, implement C…
allnes Aug 21, 2025
19a3b61
add tests: implement SSL fixes for Android SDK, introduce `--verify-o…
allnes Aug 21, 2025
a86a3fb
remove e2e tests and CLI tests: drop unused Android ResNet50 e2e conf…
allnes Aug 22, 2025
e725604
update workflows and tests: switch to Ubuntu ARM native for e2e, refi…
allnes Aug 22, 2025
fcfd672
update tests: add emulator helper test to skip list due to adb failure
allnes Aug 22, 2025
6b77e8a
enhance scripts: add KVM and Hypervisor.framework verification, diagn…
allnes Aug 22, 2025
2c2058b
update workflows and Android setup: handle Linux ARM64 limitations by…
allnes Aug 22, 2025
d0aa17d
update workflows: switch Android emulator architecture to x86_64 on U…
allnes Aug 22, 2025
4926e16
update workflows: switch Android workflows to use a dedicated x86_64 …
allnes Aug 22, 2025
3b6c6ac
update workflows: generalize Android CI to dynamically use matrix-bas…
allnes Aug 22, 2025
a60c9b6
update workflows: add architecture parameter to Android setup command…
allnes Aug 22, 2025
3cb155c
update tests: add architecture selection from config file in emulator…
allnes Aug 22, 2025
d3e30f8
update tests: set default architecture in emulator helper for consist…
allnes Aug 22, 2025
73b6baa
enhance Android setup and tests: streamline SDK/NDK configuration, im…
allnes Aug 22, 2025
6d5358e
update tests: set x86_64 as default architecture in Android setup and…
allnes Aug 22, 2025
8d5f11a
enhance workflows and tests: add explicit AVD environment variable co…
allnes Aug 22, 2025
9ba3fa2
update tests: fix path assertion logic in Android config test to hand…
allnes Aug 22, 2025
7c2d98f
update tests: normalize path handling across test cases for platform …
allnes Aug 22, 2025
6092a2b
update tests: improve path normalization and refactor environment con…
allnes Aug 22, 2025
68eb4d7
enhance Android setup and tests: add auto-detection and defaulting fo…
allnes Aug 22, 2025
7f26cc1
refactor Android setup: initialize `avd_name` earlier, add detailed A…
allnes Aug 22, 2025
c6adf38
enhance Android workflow and tests: switch macOS configuration to act…
allnes Aug 22, 2025
a65c906
fix: normalize architecture strings for Android SDK compatibility
allnes Aug 22, 2025
459b1c8
update tests: refactor path handling in environment config tests for …
allnes Aug 22, 2025
c2759cb
update Android workflow: enable Ubuntu x86_64 config, comment out mac…
allnes Aug 22, 2025
162ea48
update Android workflow: replace $HOME with $PWD for cache and enviro…
allnes Aug 22, 2025
7e2d9bc
update Android workflow: persist environment variables to GitHub for …
allnes Aug 22, 2025
1128e10
update Android workflow and OpenVINO builder: refine architecture map…
allnes Aug 22, 2025
da8a3c0
update Android CI workflows: enforce ccache usage for C/C++ compilation
allnes Aug 22, 2025
de226af
add tests: improve coverage to 100% for config loader, schema, OpenVI…
allnes Aug 22, 2025
7ea8c08
update tests: refactor and remove obsolete AndroidDevice test cases
allnes Aug 22, 2025
dda7812
update tests: add mocks for file operations and refactor `Packager` t…
allnes Aug 22, 2025
3dbcfff
update tests: validate logger calls in Packager tests with platform-c…
allnes Aug 22, 2025
2aeea66
update tests: replace Mock with dicts and adjust assertions for andro…
allnes Aug 23, 2025
743a073
update tests: enhance `wait_for_boot` timeout logic and improve test …
allnes Aug 23, 2025
5af3bf2
update tests: enhance platform compatibility for sdkmanager file crea…
allnes Aug 23, 2025
2fe02c1
update tests: improve mock usage and fix resolved test cases in Andro…
allnes Aug 23, 2025
6bea3b7
update tests: enhance mock usage and fix integration tests for Androi…
allnes Aug 23, 2025
3104f7a
update tests: simplify mock usage in `test_display_helper` and update…
allnes Aug 23, 2025
870eb95
update tests: handle Windows temp file behavior and refine cleanup in…
allnes Aug 23, 2025
485cf0f
migrate e2e: relocate E2E tests to `helpers` directory and update pat…
allnes Aug 23, 2025
2889a50
fix: correct `helpers` typo in paths and enhance tests for report dis…
allnes Aug 23, 2025
bc6eec6
add tests: improve coverage across modules including builders, device…
allnes Aug 24, 2025
5c4187e
update tests: enhance platform compatibility and Windows-specific logic
allnes Aug 24, 2025
aee73ee
update tests: skip fish shell test on Windows in `test_env_coverage`
allnes Aug 24, 2025
f3cc2db
Merge branch 'main' into an/add-e2e
allnes Aug 24, 2025
ddaa3a9
update builders: use `config.options.CMAKE_BUILD_TYPE` for build type…
allnes Aug 24, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 64 additions & 9 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,72 @@
ignore:
- "tests/**"
- "experiments/**"
- "**/__pycache__"
- "**/*.pyc"
- "setup.py"
codecov:
require_ci_to_pass: true
notify:
wait_for_ci: true

coverage:
precision: 2
round: down
range: "99...100"

status:
project:
default:
target: auto
target: 99%
threshold: 1%
base: auto
flags:
- unit
paths:
- "ovmobilebench"
- "helpers"
if_not_found: failure
if_ci_failed: error
informational: false
only_pulls: false

patch:
default:
target: 80%
threshold: 5%
target: 99%
threshold: 1%
base: auto
if_not_found: failure
if_ci_failed: error
informational: false
only_pulls: false

parsers:
gcov:
branch_detection:
conditional: true
loop: true
method: false
macro: false

comment:
layout: "reach,diff,flags,files,footer"
behavior: default
require_changes: false
require_base: true
require_head: true
branches:
- "main"
- "develop"

flags:
unit:
paths:
- ovmobilebench/
- helpers/
carryforward: false

ignore:
- "tests/**/*"
- "experiments/**/*"
- "docs/**/*"
- "examples/**/*"
- "setup.py"
- "**/__init__.py"
- "**/test_*.py"
- "**/*_test.py"
- "**/__pycache__"
- "**/*.pyc"
257 changes: 257 additions & 0 deletions .github/workflows/e2e-android-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,257 @@
name: E2E Android Test - Full Pipeline Example

on:
push:
branches: [main, develop]
pull_request:
branches: [main]
# schedule:
# - cron: '0 2 * * *' # Daily at 2 AM UTC
workflow_dispatch:
inputs:
clear_cache:
description: 'Clear all caches and rebuild from scratch'
required: false
default: 'false'
type: choice
options:
- 'false'
- 'true'

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
e2e-android-pipeline:
strategy:
matrix:
include:
- os: ubuntu-latest # Ubuntu
android-api: 30
arch: x86_64
config_file: experiments/android_x86_64_ci.yaml
# - os: macOS-latest # macOS on Apple Silicon (M1/M2)
# android-api: 30
# arch: arm64-v8a # Android ARM64 architecture
# config_file: experiments/android_example.yaml
runs-on: ${{ matrix.os }}

steps:
# === SETUP PHASE ===
- name: Checkout code
uses: actions/checkout@v5

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
cache-dependency-path: |
requirements.txt
setup.py

- name: Install OVMobileBench
run: |
pip install --upgrade pip
pip install -r requirements.txt
pip install -e .

- name: Install build tools
run: |
if [ "${{ runner.os }}" = "Linux" ]; then
sudo apt-get update
sudo apt-get install -y ccache ninja-build
elif [ "${{ runner.os }}" = "macOS" ]; then
# Check if already installed to save time
brew list ccache &>/dev/null || brew install ccache
brew list ninja &>/dev/null || brew install ninja
fi

- name: Setup Java for Android
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'

- name: Enable KVM for Android emulator (Linux only)
if: runner.os == 'Linux'
run: bash helpers/scripts/setup_kvm_linux.sh

- name: Enable Hypervisor.framework for Android emulator (macOS only)
if: runner.os == 'macOS'
run: bash helpers/scripts/setup_hypervisor_macos.sh

- name: Cache Android SDK
uses: actions/cache@v4
id: android-sdk-cache
with:
path: ovmb_cache/android-sdk
key: android-sdk-${{ runner.os }}-${{ matrix.android-api }}-${{ matrix.arch }}-v1${{
github.event.inputs.clear_cache == 'true' && '-nocache' || '' }}
restore-keys: |
android-sdk-${{ runner.os }}-${{ matrix.android-api }}-${{ matrix.arch }}-
android-sdk-${{ runner.os }}-${{ matrix.android-api }}-
android-sdk-${{ runner.os }}-

- name: Cache Models
uses: actions/cache@v4
id: models-cache
with:
path: ovmb_cache/models
key: models-${{ runner.os }}-${{ hashFiles('helpers/model_helper.py') }}-v1
restore-keys: |
models-${{ runner.os }}-
models-

- name: Setup Android SDK/NDK via OVMobileBench
run: |
# Check if cache was forced to be cleared
if [ "${{ github.event.inputs.clear_cache }}" = "true" ]; then
echo "🧹 Cache clearing was requested - installing from scratch"
rm -rf $PWD/ovmb_cache/android-sdk 2>/dev/null || true
rm -rf $PWD/ovmb_cache/models 2>/dev/null || true
fi

# Use config file from matrix
echo "📱 Using configuration: ${{ matrix.config_file }}"
echo " Architecture: ${{ matrix.arch }}"
echo " OS: ${{ matrix.os }}"

# Set Android environment variables for AVD location
export ANDROID_HOME=$PWD/ovmb_cache/android-sdk
export ANDROID_SDK_ROOT=$PWD/ovmb_cache/android-sdk
export ANDROID_SDK_HOME=$PWD/ovmb_cache/android-sdk
export ANDROID_AVD_HOME=$PWD/ovmb_cache/android-sdk/.android/avd

# Export to GitHub Environment for subsequent steps
echo "ANDROID_HOME=$ANDROID_HOME" >> $GITHUB_ENV
echo "ANDROID_SDK_ROOT=$ANDROID_SDK_ROOT" >> $GITHUB_ENV
echo "ANDROID_SDK_HOME=$ANDROID_SDK_HOME" >> $GITHUB_ENV
echo "ANDROID_AVD_HOME=$ANDROID_AVD_HOME" >> $GITHUB_ENV

echo "📍 Environment variables set:"
echo " ANDROID_HOME=$ANDROID_HOME"
echo " ANDROID_SDK_ROOT=$ANDROID_SDK_ROOT"
echo " ANDROID_SDK_HOME=$ANDROID_SDK_HOME"
echo " ANDROID_AVD_HOME=$ANDROID_AVD_HOME"

python -m ovmobilebench.cli setup-android \
-c ${{ matrix.config_file }} \
--api ${{ matrix.android-api }} \
--arch ${{ matrix.arch }} \
--create-avd \
--verbose

# Display cache stats
echo "📊 Android SDK setup complete:"
echo " Cache size: $(du -sh $PWD/ovmb_cache 2>/dev/null || echo 'calculating...')"

# List created AVDs
echo "📱 Created AVDs:"
ls -la $ANDROID_AVD_HOME 2>/dev/null || echo "AVD directory not found"

# === PREPARE EMULATOR ===
- name: Start Android Emulator
run: |
# Environment variables should already be set from previous step
echo "📍 Starting emulator with environment:"
echo " ANDROID_AVD_HOME=$ANDROID_AVD_HOME"
echo "📱 Available AVDs:"
ls -la $ANDROID_AVD_HOME 2>/dev/null || echo "No AVDs found"

python helpers/emulator_helper.py -c ${{ matrix.config_file }} start-emulator &
# Give emulator a moment to start before checking
sleep 10
python helpers/emulator_helper.py -c ${{ matrix.config_file }} wait-for-boot

- name: Setup ccache
uses: hendrikmuhs/[email protected]
with:
key: ${{ runner.os }}-${{ matrix.arch }}-android
create-symlink: true
max-size: 2G

# Models are already in ovmb_cache, no separate cache needed

# === PREPARE MODEL ===
- name: Download ResNet-50 model
run: python helpers/model_helper.py -c ${{ matrix.config_file }} download-resnet50

# === OVMOBILEBENCH PIPELINE ===
- name: List available devices
run: python -m ovmobilebench.cli list-devices

- name: Build OpenVINO for Android
run: |
python -m ovmobilebench.cli build \
-c ${{ matrix.config_file }} \
--verbose

- name: Show ccache statistics
run: |
echo "📊 ccache statistics:"
ccache --show-stats

- name: Package OpenVINO runtime and model
run: |
python -m ovmobilebench.cli package \
-c ${{ matrix.config_file }} \
--verbose

- name: Deploy to Android device
run: |
python -m ovmobilebench.cli deploy \
-c ${{ matrix.config_file }} \
--verbose

- name: Run benchmark on device
run: |
python -m ovmobilebench.cli run \
-c ${{ matrix.config_file }} \
--verbose

- name: Generate benchmark report
run: |
python -m ovmobilebench.cli report \
-c ${{ matrix.config_file }} \
--verbose

# === ALTERNATIVE: Run all stages at once ===
- name: Run complete pipeline (alternative)
if: false # Set to true to use this instead of individual stages
run: |
python -m ovmobilebench.cli all \
-c ${{ matrix.config_file }} \
--verbose

# === VALIDATION ===
- name: Validate results
run: python helpers/validate_results.py

- name: Display benchmark results
run: python helpers/display_results.py

# === CLEANUP ===
- name: Stop emulator
if: always()
run: |
# Environment variables should already be set from setup step
python helpers/emulator_helper.py -c ${{ matrix.config_file }} stop-emulator

- name: Upload artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: benchmark-results-${{ matrix.os }}-api${{ matrix.android-api }}
path: |
artifacts/
retention-days: 7

# === REPORT TO PR ===
- name: Post results to PR
if: github.event_name == 'pull_request'
run: |
python helpers/pr_comment.py \
--api ${{ matrix.android-api }} \
--pr ${{ github.event.pull_request.number }}
2 changes: 1 addition & 1 deletion .github/workflows/stage-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
pip install -e .

- name: Run tests
run: pytest tests/ -v --cov=ovmobilebench --cov=scripts --junitxml=junit.xml -o junit_family=legacy
run: pytest tests/ -v --cov=ovmobilebench --cov=helpers --junitxml=junit.xml -o junit_family=legacy

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -138,3 +138,4 @@ artifacts
junit.xml

*.DS_Store*
valid_cache_dir
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ repos:
rev: v2.4.1
hooks:
- id: codespell
args: ['--skip=*.json,*.yaml,*.yml,*.txt,*.csv,*.lock', '--ignore-words-list=nd,teh,hist,carmel']
args: ['--skip=*.json,*.yaml,*.yml,*.txt,*.csv,*.lock', '--ignore-words-list=nd,teh,hist,carmel,helpers']

ci:
autofix_prs: false
Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ lint:
test:
pytest tests/ -v

test-e2e:
# E2E tests moved to helpers directory as utility scripts
@echo "E2E scripts are now in helpers/ directory"

clean:
rm -rf artifacts/
rm -rf build/
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ See [Configuration Reference](docs/configuration.md) for details.
- **[Build Guide](docs/build-guide.md)** - Building OpenVINO for mobile
- **[Benchmarking Guide](docs/benchmarking.md)** - Running and interpreting benchmarks
- **[Testing Guide](docs/testing.md)** - Running and writing tests
- **[End-to-End Testing](docs/e2e-testing.md)** - E2E test infrastructure and examples
- **[CI/CD Integration](docs/ci-cd.md)** - GitHub Actions and automation
- **[API Reference](docs/api-reference.md)** - Python API documentation
- **[Troubleshooting](docs/troubleshooting.md)** - Common issues and solutions
Expand All @@ -60,7 +61,8 @@ See [Configuration Reference](docs/configuration.md) for details.
- 🔄 **CI/CD Ready** - GitHub Actions integration included
- 📈 **Reproducible** - Full provenance tracking of builds and runs
- 🤖 **Android SDK/NDK Installer** - Automated setup of Android development tools
- 🔗 **Auto-Download** - Fetch latest OpenVINO builds for your platform
- 🔗 **Auto-Clone & Build** - Automatically clones OpenVINO with submodules if not present
- 📁 **Config-Based Paths** - All paths managed through YAML config, no environment variables needed

## 🔧 Supported Platforms

Expand Down
Loading
Loading