Skip to content

Use Ruff TYPE_CHECKING blocks #450

Use Ruff TYPE_CHECKING blocks

Use Ruff TYPE_CHECKING blocks #450

Workflow file for this run

name: Python package
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10"]
pytorch-version: ["1.4.0", "1.5.1", "1.6.0", "1.7.1", "1.8", "1.9", "1.10", "1.11", "1.12", "1.13", "2.0", "2.1", "2.2"]
include:
- python-version: 3.11
pytorch-version: 2.0
- python-version: 3.11
pytorch-version: 2.1
- python-version: 3.11
pytorch-version: 2.2
exclude:
- python-version: 3.8
pytorch-version: 1.7.1
- python-version: 3.9
pytorch-version: 1.4.0
- python-version: 3.9
pytorch-version: 1.5.1
- python-version: 3.9
pytorch-version: 1.6.0
- python-version: 3.9
pytorch-version: 1.7.1
- python-version: 3.10
pytorch-version: 1.4.0
- python-version: 3.10
pytorch-version: 1.5.1
- python-version: 3.10
pytorch-version: 1.6.0
- python-version: 3.10
pytorch-version: 1.7.1
- python-version: 3.10
pytorch-version: 1.8
- python-version: 3.10
pytorch-version: 1.6.0
- python-version: 3.10
pytorch-version: 1.9
- python-version: 3.10
pytorch-version: 1.10
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install pytest pytest-cov
pip install torch==${{ matrix.pytorch-version }} torchvision transformers
pip install compressai
- name: mypy
if: ${{ matrix.pytorch-version == '2.2' }}
run: |
python -m pip install mypy==1.9.0
mypy --install-types --non-interactive .
- name: pytest
if: ${{ matrix.pytorch-version == '2.2' }}
run: |
pytest --cov=torchinfo --cov-report= --durations=0
- name: pytest
if: ${{ matrix.pytorch-version != '2.2' }}
run: |
pytest --no-output -k "not test_eval_order_doesnt_matter and not test_google and not test_uninitialized_tensor and not test_input_size_half_precision and not test_recursive_with_missing_layers and not test_flan_t5_small"
- name: codecov
uses: codecov/codecov-action@v1