Skip to content

add resource utilization calculator #1900

add resource utilization calculator

add resource utilization calculator #1900

name: Coverage Test
on:
workflow_dispatch: # Allow manual triggers
schedule:
- cron: 0 0 * * *
pull_request:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 80
env:
COVERAGE_THRESHOLD: 98
steps:
- uses: actions/checkout@v4
- name: Install Python 3
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Set up Coverage
run: |
python -m pip install --upgrade pip
pip install coverage
- name: Set up TensorFlow environment
run: |
python -m venv tf_env
source tf_env/bin/activate
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install tensorflow==2.13.* coverage pytest
- name: Run TensorFlow testsuite
run: |
source tf_env/bin/activate
coverage run --parallel-mode -m --omit "*__init__.py" --include "model_compression_toolkit/**/*.py" unittest tests/test_suite.py -v
- name: Run TensorFlow pytest
run: |
source tf_env/bin/activate
coverage run --parallel-mode -m --omit "*__init__.py" --include "model_compression_toolkit/**/*.py" pytest tests_pytest/keras
- name: Set up Pytorch environment
run: |
python -m venv torch_env
source torch_env/bin/activate
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install torch==2.0.* torchvision onnx onnxruntime onnxruntime-extensions coverage pytest
- name: Run torch testsuite
run: |
source torch_env/bin/activate
coverage run --parallel-mode -m --omit "*__init__.py" --include "model_compression_toolkit/**/*.py" unittest tests/test_suite.py -v
- name: Run torch pytest
run: |
source torch_env/bin/activate
coverage run --parallel-mode -m --omit "*__init__.py" --include "model_compression_toolkit/**/*.py" pytest tests_pytest/pytorch
- name: Combine Multiple Coverage Files
run: coverage combine
- name: Run Coverage HTML
run: coverage html -i --directory ./coverage_report_html
- name: Archive code coverage results
uses: actions/upload-artifact@v4
with:
name: code-coverage-report
path: |
coverage_report_html
- name: Coverage Report
run: coverage report -i --skip-covered --sort cover --fail-under $COVERAGE_THRESHOLD