Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ Makefile text eol=lf
.pre-commit-config.yaml export-ignore
tests/ export-ignore
docs/ export-ignore
*.md export-ignore
*.md export-ignore
11 changes: 9 additions & 2 deletions .github/workflows/bench.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: OVMobileBench CI

on:
push:
branches: [ main, develop ]
branches: [main, develop]
pull_request:
branches: [ main ]
branches: [main]
workflow_dispatch:
inputs:
device_serial:
Expand All @@ -17,7 +17,14 @@ concurrency:
cancel-in-progress: true

jobs:
# Run pre-commit only once on ubuntu-latest
pre-commit:
uses: ./.github/workflows/stage-pre-commit.yml
secrets: inherit

# Run CI matrix for all OS after pre-commit passes
ci-matrix:
needs: pre-commit
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/ci-orchestrator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,24 @@ on:
default: 'emulator-5554'

jobs:
# Stage 1: Lint and Test
lint-test:
uses: ./.github/workflows/stage-lint-test.yml
# Stage 1: Test
test:
uses: ./.github/workflows/stage-test.yml
with:
os: ${{ inputs.os }}
secrets: inherit

# Stage 2: Build Package (runs in parallel with validation)
build:
needs: lint-test
needs: test
uses: ./.github/workflows/stage-build.yml
with:
os: ${{ inputs.os }}
secrets: inherit

# Stage 3: Validation (runs in parallel with build)
validation:
needs: lint-test
needs: test
uses: ./.github/workflows/stage-validation.yml
with:
os: ${{ inputs.os }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/stage-device-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ jobs:

device-test-adb:
if: |
(github.event_name == 'workflow_dispatch' ||
contains(github.event.head_commit.message, '[device-test-adb]')) &&
(github.event_name == 'workflow_dispatch' ||
contains(github.event.head_commit.message, '[device-test-adb]')) &&
inputs.os == 'ubuntu-latest'
runs-on: self-hosted
steps:
Expand Down
29 changes: 29 additions & 0 deletions .github/workflows/stage-pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Pre-commit

on:
workflow_call:

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0 # Fetch all history for all branches

- 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 dependencies
run: |
pip install --upgrade pip
pip install pre-commit

- name: Run pre-commit
run: pre-commit run --all-files --show-diff-on-failure
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Lint and Test
name: Test

on:
workflow_call:
Expand All @@ -8,7 +8,7 @@ on:
type: string

jobs:
lint-and-test:
test:
runs-on: ${{ inputs.os }}
steps:
- uses: actions/checkout@v5
Expand All @@ -30,15 +30,6 @@ jobs:
pip install -r requirements.txt
pip install -e .

- name: Run Black
run: black --check ovmobilebench tests

- name: Run Ruff
run: ruff check ovmobilebench tests

- name: Run MyPy
run: mypy ovmobilebench --ignore-missing-imports

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

Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/stage-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ jobs:

- name: Validate example config
run: |
python -c "from ovmobilebench.config.loader import load_experiment; load_experiment('experiments/android_example.yaml')"
python -c "from ovmobilebench.config.loader import load_experiment; \
load_experiment('experiments/android_example.yaml')"

- name: CLI help test
run: |
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -136,3 +136,5 @@ experiments/results/
ovmb_cache
artifacts
junit.xml

*.DS_Store*
18 changes: 18 additions & 0 deletions .markdownlint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"default": true,
"MD013": false,
"MD033": {
"allowed_elements": ["br", "sup", "sub", "details", "summary", "img", "API", "arch", "target"]
},
"MD041": false,
"MD024": {
"siblings_only": true
},
"MD040": false,
"MD025": false,
"MD036": false,
"MD028": false,
"MD051": false,
"MD046": false,
"MD001": false
}
39 changes: 30 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ repos:
- id: name-tests-test
args: ['--pytest-test-first']

- repo: https://github.com/asottile/pyupgrade
rev: v3.19.1
hooks:
- id: pyupgrade
args: ['--py311-plus']

- repo: https://github.com/psf/black
rev: 24.4.2
hooks:
Expand All @@ -35,28 +41,43 @@ repos:
rev: v1.10.0
hooks:
- id: mypy
additional_dependencies: [types-all]
additional_dependencies: [types-PyYAML, types-paramiko]
args: ['--ignore-missing-imports']
exclude: '^tests/'
files: '^ovmobilebench/(?!android/installer/).*\.py$'

- repo: https://github.com/pycqa/isort
rev: 5.13.2
hooks:
- id: isort
args: ['--profile', 'black', '--line-length', '100']

- repo: https://github.com/pycqa/docformatter
rev: v1.7.5
hooks:
- id: docformatter
args: ['--in-place', '--wrap-summaries', '100', '--wrap-descriptions', '100']

- repo: https://github.com/commitizen-tools/commitizen
rev: v3.27.0
hooks:
- id: commitizen
stages: [commit-msg]

- repo: https://github.com/adrienverge/yamllint
rev: v1.35.1
hooks:
- id: yamllint
args: ['--strict']

- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.43.0
hooks:
- id: markdownlint
args: ['--fix']

- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
hooks:
- id: codespell
args: ['--skip=*.json,*.yaml,*.yml,*.txt,*.csv,*.lock', '--ignore-words-list=nd,teh,hist']

ci:
autofix_prs: false
autoupdate_schedule: monthly
autoupdate_schedule: weekly
autoupdate_commit_msg: '[pre-commit.ci] pre-commit autoupdate'
skip: []
submodules: false
12 changes: 12 additions & 0 deletions .yamllint
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
extends: default

rules:
line-length:
max: 120
level: warning
comments:
min-spaces-from-content: 1
comments-indentation: disable
document-start: disable
truthy:
allowed-values: ['true', 'false', 'on', 'off']
Loading
Loading