Adding integration tests package with ptq e2e test example and converting symmetric selection unit test to pytest #1987
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: Create .coveragerc | |
run: | | |
echo "[run]" > .coveragerc | |
echo "dynamic_context = test_function" >> .coveragerc | |
- name: Install Python 3 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- name: Set up environment for common tests | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt coverage pytest pytest-mock | |
- name: Run common tests (unittest) | |
run: coverage run --parallel-mode -m --omit "*__init__.py" --include "model_compression_toolkit/**/*.py" unittest discover tests/common_tests -v | |
- name: Run common tests (pytest) | |
run: coverage run --parallel-mode -m --omit "*__init__.py" --include "model_compression_toolkit/**/*.py" pytest tests_pytest/common | |
- 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 tensorflow==2.13.* sony-custom-layers coverage pytest pytest-mock | |
- name: Run TensorFlow tests (unittest) | |
run: | | |
source tf_env/bin/activate | |
coverage run --parallel-mode -m --omit "*__init__.py" --include "model_compression_toolkit/**/*.py" unittest discover tests/keras_tests -v | |
- name: Run TensorFlow tests (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 sony-custom-layers coverage pytest pytest-mock | |
- name: Run PyTorch tests (unittest) | |
run: | | |
source torch_env/bin/activate | |
coverage run --parallel-mode -m --omit "*__init__.py" --include "model_compression_toolkit/**/*.py" unittest discover tests/pytorch_tests -v | |
- name: Run PyTorch tests (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 --show-contexts | |
- 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 |