From 544d932dbfef8747685d1ab013050246886b78bc Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Sun, 17 Aug 2025 03:02:45 +0200 Subject: [PATCH 1/6] update workflows: enhance Codecov integration with fallback CLI upload, additional logging, and custom configuration path --- codecov.yml => .codecov.yml | 0 .github/workflows/stage-lint-test.yml | 22 ++++++++++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) rename codecov.yml => .codecov.yml (100%) diff --git a/codecov.yml b/.codecov.yml similarity index 100% rename from codecov.yml rename to .codecov.yml diff --git a/.github/workflows/stage-lint-test.yml b/.github/workflows/stage-lint-test.yml index 0087ea4..89033f4 100644 --- a/.github/workflows/stage-lint-test.yml +++ b/.github/workflows/stage-lint-test.yml @@ -28,14 +28,32 @@ jobs: - name: Run tests run: pytest tests/ -v --cov=ovmobilebench --cov=scripts --cov-report=xml --cov-report=term-missing + - name: Check coverage file + run: | + if [ -f coverage.xml ]; then + echo "Coverage file exists" + ls -la coverage.xml + echo "First 20 lines of coverage.xml:" + head -20 coverage.xml + else + echo "Coverage file not found!" + fi + - name: Upload coverage to Codecov uses: codecov/codecov-action@v4 with: files: ./coverage.xml flags: unittests name: codecov-${{ inputs.os }} - fail_ci_if_error: true + fail_ci_if_error: false token: ${{ secrets.CODECOV_TOKEN }} verbose: true + codecov_yml_path: ./codecov.yml env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} \ No newline at end of file + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + + - name: Upload coverage via CLI (fallback) + if: failure() + run: | + pip install codecov + codecov --file ./coverage.xml --flags unittests --name codecov-${{ inputs.os }} --token ${{ secrets.CODECOV_TOKEN }} || echo "CLI upload failed" \ No newline at end of file From f28bc6704f456beb04d3c630be39def4c30a1820 Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Sun, 17 Aug 2025 03:06:01 +0200 Subject: [PATCH 2/6] refactor setup-python-cached: add Python bin path to outputs, ensure PATH is explicitly set, verify tool availability, and enhance pip usage commands --- .../actions/setup-python-cached/action.yml | 39 ++++++++++++------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/.github/actions/setup-python-cached/action.yml b/.github/actions/setup-python-cached/action.yml index cebaf6b..5ebbc4b 100644 --- a/.github/actions/setup-python-cached/action.yml +++ b/.github/actions/setup-python-cached/action.yml @@ -32,12 +32,16 @@ runs: # Get pip cache dir pip_cache = subprocess.check_output([sys.executable, "-m", "pip", "cache", "dir"]).decode().strip() + # Get Python bin directory + python_bin = os.path.dirname(sys.executable) + # Output for GitHub Actions output_file = os.environ.get('GITHUB_OUTPUT', '') if output_file: with open(output_file, 'a') as f: f.write(f"site-packages={site_packages}\n") f.write(f"pip-cache={pip_cache}\n") + f.write(f"python-bin={python_bin}\n") f.write(f"python-version={sys.version}\n") EOF @@ -53,7 +57,7 @@ runs: ~/Library/Python /opt/hostedtoolcache/Python/*/x64/bin /opt/hostedtoolcache/Python/*/x64/lib/python*/site-packages - key: ${{ runner.os }}-py${{ inputs.python-version }}-${{ hashFiles('requirements.txt', 'pyproject.toml') }}-v2 + key: ${{ runner.os }}-py${{ inputs.python-version }}-${{ hashFiles('requirements.txt', 'pyproject.toml') }}-v3 restore-keys: | ${{ runner.os }}-py${{ inputs.python-version }}- @@ -63,28 +67,33 @@ runs: echo "Cache hit: ${{ steps.python-cache.outputs.cache-hit }}" echo "Python version: ${{ steps.python-paths.outputs.python-version }}" echo "Site packages: ${{ steps.python-paths.outputs.site-packages }}" + echo "Python bin: ${{ steps.python-paths.outputs.python-bin }}" + + # Set up PATH first + export PATH="${{ steps.python-paths.outputs.python-bin }}:$HOME/.local/bin:$PATH" + echo "PATH=${{ steps.python-paths.outputs.python-bin }}:$HOME/.local/bin:$PATH" >> $GITHUB_ENV # Always ensure pip is up to date - pip install --upgrade pip + python -m pip install --upgrade pip if [[ "${{ steps.python-cache.outputs.cache-hit }}" != "true" ]]; then echo "Cache miss - installing all dependencies" - pip install -r requirements.txt - pip install -e . + python -m pip install -r requirements.txt + python -m pip install -e . else - echo "Cache hit - verifying and reinstalling if needed" - # Check if black is available - if ! command -v black &> /dev/null; then - echo "Tools not in PATH, reinstalling..." - pip install -r requirements.txt - fi - # Always reinstall the local package in case code changed - pip install -e . --no-deps --force-reinstall + echo "Cache hit - reinstalling packages to ensure they're available" + # Even with cache, we need to reinstall to ensure everything is in PATH + python -m pip install --force-reinstall --no-deps -r requirements.txt + python -m pip install -e . --no-deps --force-reinstall fi - # Ensure tools are in PATH - export PATH="$HOME/.local/bin:$PATH" - echo "PATH=$HOME/.local/bin:$PATH" >> $GITHUB_ENV + # Verify tools are available + echo "Checking tool availability:" + which python + which pip + which black || echo "black not found in PATH" + which ruff || echo "ruff not found in PATH" + which pytest || echo "pytest not found in PATH" - name: Verify installation shell: bash From fcd06e727ed0a8e4b3fb720977248aa99d4fea18 Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Sun, 17 Aug 2025 03:10:24 +0200 Subject: [PATCH 3/6] remove setup-python-cached action: no longer required for workflows and CI processes --- .../actions/setup-python-cached/action.yml | 107 ------------------ .github/workflows/stage-build.yml | 12 +- .github/workflows/stage-device-tests.yml | 24 +++- .github/workflows/stage-lint-test.yml | 20 ++-- .github/workflows/stage-validation.yml | 12 +- 5 files changed, 51 insertions(+), 124 deletions(-) delete mode 100644 .github/actions/setup-python-cached/action.yml diff --git a/.github/actions/setup-python-cached/action.yml b/.github/actions/setup-python-cached/action.yml deleted file mode 100644 index 5ebbc4b..0000000 --- a/.github/actions/setup-python-cached/action.yml +++ /dev/null @@ -1,107 +0,0 @@ -name: 'Setup Python with Cached Dependencies' -description: 'Setup Python and cache entire site-packages directory' - -inputs: - python-version: - description: 'Python version to use' - required: false - default: '3.11' - -runs: - using: 'composite' - steps: - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: ${{ inputs.python-version }} - - - name: Get Python paths - id: python-paths - shell: bash - run: | - # Get Python paths using Python - python << 'EOF' - import os - import sys - import site - import subprocess - - # Get site-packages path - site_packages = site.getsitepackages()[0] - - # Get pip cache dir - pip_cache = subprocess.check_output([sys.executable, "-m", "pip", "cache", "dir"]).decode().strip() - - # Get Python bin directory - python_bin = os.path.dirname(sys.executable) - - # Output for GitHub Actions - output_file = os.environ.get('GITHUB_OUTPUT', '') - if output_file: - with open(output_file, 'a') as f: - f.write(f"site-packages={site_packages}\n") - f.write(f"pip-cache={pip_cache}\n") - f.write(f"python-bin={python_bin}\n") - f.write(f"python-version={sys.version}\n") - EOF - - - name: Cache Python environment - uses: actions/cache@v3 - id: python-cache - with: - path: | - ${{ steps.python-paths.outputs.site-packages }} - ${{ steps.python-paths.outputs.pip-cache }} - ~/.local/bin - ~/.local/lib - ~/Library/Python - /opt/hostedtoolcache/Python/*/x64/bin - /opt/hostedtoolcache/Python/*/x64/lib/python*/site-packages - key: ${{ runner.os }}-py${{ inputs.python-version }}-${{ hashFiles('requirements.txt', 'pyproject.toml') }}-v3 - restore-keys: | - ${{ runner.os }}-py${{ inputs.python-version }}- - - - name: Install dependencies - shell: bash - run: | - echo "Cache hit: ${{ steps.python-cache.outputs.cache-hit }}" - echo "Python version: ${{ steps.python-paths.outputs.python-version }}" - echo "Site packages: ${{ steps.python-paths.outputs.site-packages }}" - echo "Python bin: ${{ steps.python-paths.outputs.python-bin }}" - - # Set up PATH first - export PATH="${{ steps.python-paths.outputs.python-bin }}:$HOME/.local/bin:$PATH" - echo "PATH=${{ steps.python-paths.outputs.python-bin }}:$HOME/.local/bin:$PATH" >> $GITHUB_ENV - - # Always ensure pip is up to date - python -m pip install --upgrade pip - - if [[ "${{ steps.python-cache.outputs.cache-hit }}" != "true" ]]; then - echo "Cache miss - installing all dependencies" - python -m pip install -r requirements.txt - python -m pip install -e . - else - echo "Cache hit - reinstalling packages to ensure they're available" - # Even with cache, we need to reinstall to ensure everything is in PATH - python -m pip install --force-reinstall --no-deps -r requirements.txt - python -m pip install -e . --no-deps --force-reinstall - fi - - # Verify tools are available - echo "Checking tool availability:" - which python - which pip - which black || echo "black not found in PATH" - which ruff || echo "ruff not found in PATH" - which pytest || echo "pytest not found in PATH" - - - name: Verify installation - shell: bash - run: | - echo "=== Installed packages ===" - pip list 2>/dev/null | head -20 || true - echo "..." - echo "=== Package location ===" - python -c "import ovmobilebench; print(f'Package installed at: {ovmobilebench.__file__}')" || echo "Package not found" - echo "=== CLI availability ===" - which ovmobilebench || echo "CLI not in PATH" \ No newline at end of file diff --git a/.github/workflows/stage-build.yml b/.github/workflows/stage-build.yml index 5a73373..ddb64bf 100644 --- a/.github/workflows/stage-build.yml +++ b/.github/workflows/stage-build.yml @@ -13,8 +13,16 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Setup Python with cached dependencies - uses: ./.github/actions/setup-python-cached + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.11' + + - name: Install dependencies + run: | + pip install --upgrade pip + pip install -r requirements.txt + pip install -e . - name: Build package run: python -m build diff --git a/.github/workflows/stage-device-tests.yml b/.github/workflows/stage-device-tests.yml index 48cc4b0..143baec 100644 --- a/.github/workflows/stage-device-tests.yml +++ b/.github/workflows/stage-device-tests.yml @@ -18,8 +18,16 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Setup Python with cached dependencies - uses: ./.github/actions/setup-python-cached + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.11' + + - name: Install dependencies + run: | + pip install --upgrade pip + pip install -r requirements.txt + pip install -e . - name: Set up SSH server run: | @@ -57,8 +65,16 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Setup Python with cached dependencies - uses: ./.github/actions/setup-python-cached + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.11' + + - name: Install dependencies + run: | + pip install --upgrade pip + pip install -r requirements.txt + pip install -e . - name: Check ADB devices run: adb devices diff --git a/.github/workflows/stage-lint-test.yml b/.github/workflows/stage-lint-test.yml index 89033f4..a39a320 100644 --- a/.github/workflows/stage-lint-test.yml +++ b/.github/workflows/stage-lint-test.yml @@ -13,8 +13,16 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Setup Python with cached dependencies - uses: ./.github/actions/setup-python-cached + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.11' + + - name: Install dependencies + run: | + pip install --upgrade pip + pip install -r requirements.txt + pip install -e . - name: Run Black run: black --check ovmobilebench tests @@ -50,10 +58,4 @@ jobs: verbose: true codecov_yml_path: ./codecov.yml env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - - - name: Upload coverage via CLI (fallback) - if: failure() - run: | - pip install codecov - codecov --file ./coverage.xml --flags unittests --name codecov-${{ inputs.os }} --token ${{ secrets.CODECOV_TOKEN }} || echo "CLI upload failed" \ No newline at end of file + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/stage-validation.yml b/.github/workflows/stage-validation.yml index e3a94df..05a8a97 100644 --- a/.github/workflows/stage-validation.yml +++ b/.github/workflows/stage-validation.yml @@ -13,8 +13,16 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Setup Python with cached dependencies - uses: ./.github/actions/setup-python-cached + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.11' + + - name: Install dependencies + run: | + pip install --upgrade pip + pip install -r requirements.txt + pip install -e . - name: Validate example config run: | From d52db3d53e2c0e88cf2db8dad6741be81b6d8913 Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Sun, 17 Aug 2025 03:15:54 +0200 Subject: [PATCH 4/6] update workflows: include `fetch-depth` in lint-test, improve logging for git info, and remove unused Codecov settings --- .github/workflows/ci-orchestrator.yml | 2 +- .github/workflows/stage-build.yml | 2 +- .github/workflows/stage-device-tests.yml | 2 +- .github/workflows/stage-lint-test.yml | 13 ++++++++----- .github/workflows/stage-validation.yml | 2 +- 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci-orchestrator.yml b/.github/workflows/ci-orchestrator.yml index 6c29a44..e4cda61 100644 --- a/.github/workflows/ci-orchestrator.yml +++ b/.github/workflows/ci-orchestrator.yml @@ -42,4 +42,4 @@ jobs: with: os: ${{ inputs.os }} device_serial: ${{ inputs.device_serial }} - secrets: inherit \ No newline at end of file + secrets: inherit diff --git a/.github/workflows/stage-build.yml b/.github/workflows/stage-build.yml index ddb64bf..ef65fbb 100644 --- a/.github/workflows/stage-build.yml +++ b/.github/workflows/stage-build.yml @@ -32,4 +32,4 @@ jobs: with: name: dist-${{ inputs.os }} path: dist/ - retention-days: 7 \ No newline at end of file + retention-days: 7 diff --git a/.github/workflows/stage-device-tests.yml b/.github/workflows/stage-device-tests.yml index 143baec..d4948e5 100644 --- a/.github/workflows/stage-device-tests.yml +++ b/.github/workflows/stage-device-tests.yml @@ -93,4 +93,4 @@ jobs: with: name: benchmark-results-adb-${{ inputs.os }} path: experiments/results/ - retention-days: 30 \ No newline at end of file + retention-days: 30 diff --git a/.github/workflows/stage-lint-test.yml b/.github/workflows/stage-lint-test.yml index a39a320..d98ccb4 100644 --- a/.github/workflows/stage-lint-test.yml +++ b/.github/workflows/stage-lint-test.yml @@ -12,6 +12,8 @@ jobs: runs-on: ${{ inputs.os }} steps: - uses: actions/checkout@v4 + with: + fetch-depth: 0 # Fetch all history for all branches - name: Set up Python uses: actions/setup-python@v4 @@ -36,8 +38,13 @@ jobs: - name: Run tests run: pytest tests/ -v --cov=ovmobilebench --cov=scripts --cov-report=xml --cov-report=term-missing - - name: Check coverage file + - name: Check coverage file and git info run: | + echo "=== Git information ===" + git branch -a + git log --oneline -10 + echo "Current commit: $(git rev-parse HEAD)" + echo "=== Coverage file check ===" if [ -f coverage.xml ]; then echo "Coverage file exists" ls -la coverage.xml @@ -54,8 +61,4 @@ jobs: flags: unittests name: codecov-${{ inputs.os }} fail_ci_if_error: false - token: ${{ secrets.CODECOV_TOKEN }} verbose: true - codecov_yml_path: ./codecov.yml - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/stage-validation.yml b/.github/workflows/stage-validation.yml index 05a8a97..2425c35 100644 --- a/.github/workflows/stage-validation.yml +++ b/.github/workflows/stage-validation.yml @@ -40,4 +40,4 @@ jobs: ovmobilebench all --help ovmobilebench package --help ovmobilebench deploy --help - ovmobilebench report --help \ No newline at end of file + ovmobilebench report --help From 5455cdf0f2a2b9ee3b2a83f0bd3e8209495b67ca Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Sun, 17 Aug 2025 03:25:43 +0200 Subject: [PATCH 5/6] update workflows: migrate Codecov configuration to `.github/codecov.yml`, remove unused settings, and update action version to v5.4.3 --- .codecov.yml | 41 --------------------------- .github/codecov.yml | 19 +++++++++++++ .github/workflows/stage-lint-test.yml | 26 +++-------------- 3 files changed, 23 insertions(+), 63 deletions(-) delete mode 100644 .codecov.yml create mode 100644 .github/codecov.yml diff --git a/.codecov.yml b/.codecov.yml deleted file mode 100644 index 620010b..0000000 --- a/.codecov.yml +++ /dev/null @@ -1,41 +0,0 @@ -codecov: - require_ci_to_pass: yes - token: required - -coverage: - precision: 2 - round: down - range: "70...100" - - status: - project: - default: - target: auto - threshold: 1% - paths: - - "ovmobilebench/" - - "scripts/" - patch: - default: - target: auto - threshold: 1% - -parsers: - gcov: - branch_detection: - conditional: yes - loop: yes - method: no - macro: no - -comment: - layout: "reach,diff,flags,files,footer" - behavior: default - require_changes: no - -ignore: - - "tests/" - - "experiments/" - - "**/__pycache__" - - "**/*.pyc" - - "setup.py" diff --git a/.github/codecov.yml b/.github/codecov.yml new file mode 100644 index 0000000..e6e5eab --- /dev/null +++ b/.github/codecov.yml @@ -0,0 +1,19 @@ +ignore: + - "tests/**" + - "experiments/**" + - "**/__pycache__" + - "**/*.pyc" + - "setup.py" + - "scripts/generate_ssh_config.py" + - "scripts/test_ssh_device_ci.py" + +coverage: + status: + project: + default: + target: auto + threshold: 1% + patch: + default: + target: 80% + threshold: 5% diff --git a/.github/workflows/stage-lint-test.yml b/.github/workflows/stage-lint-test.yml index d98ccb4..3ad985c 100644 --- a/.github/workflows/stage-lint-test.yml +++ b/.github/workflows/stage-lint-test.yml @@ -38,27 +38,9 @@ jobs: - name: Run tests run: pytest tests/ -v --cov=ovmobilebench --cov=scripts --cov-report=xml --cov-report=term-missing - - name: Check coverage file and git info - run: | - echo "=== Git information ===" - git branch -a - git log --oneline -10 - echo "Current commit: $(git rev-parse HEAD)" - echo "=== Coverage file check ===" - if [ -f coverage.xml ]; then - echo "Coverage file exists" - ls -la coverage.xml - echo "First 20 lines of coverage.xml:" - head -20 coverage.xml - else - echo "Coverage file not found!" - fi - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v4 + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v5.4.3 with: - files: ./coverage.xml - flags: unittests - name: codecov-${{ inputs.os }} - fail_ci_if_error: false - verbose: true + files: coverage.xml + From 5cf0b9542079b25e64b880b37fa7cd023cf59f03 Mon Sep 17 00:00:00 2001 From: Alexander Nesterov Date: Sun, 17 Aug 2025 03:29:39 +0200 Subject: [PATCH 6/6] add dependabot configuration: enable weekly updates for pip and GitHub Actions with a limit on open PRs --- .github/dependabot.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..64b9c0b --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,14 @@ +version: 2 +updates: + - package-ecosystem: "pip" + directory: "/" + schedule: + interval: "weekly" + day: "friday" + open-pull-requests-limit: 10 + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" + day: "friday" + open-pull-requests-limit: 10