Skip to content

Improve CI

Improve CI #39

Workflow file for this run

name: Unit tests
on:
pull_request:
branches: [main, release/*]
paths:
- ".github/workflows/unit_tests.yml"
- "modelopt/**"
- "tests/unit/**"
- "pyproject.toml"
- "setup.py"
- "tox.ini"
push:
branches: [main, release/*]
paths:
- ".github/workflows/unit_tests.yml"
- "modelopt/**"
- "tests/unit/**"
- "pyproject.toml"
- "setup.py"
- "tox.ini"
# Cancel previous runs if new commit is pushed
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
linux:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Run unit tests
run: pip install tox && COV_ARGS="--cov" tox -e py312-torch28-unit
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
verbose: true
windows:
if: github.event_name == 'pull_request'
needs: [linux]
runs-on: windows-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Run unit tests (without coverage)
run: pip install tox && tox -e py312-torch28-unit
multi-py:
if: github.event_name == 'pull_request'
needs: [linux]
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
matrix:
py: [10, 11]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.${{ matrix.py }}"
- name: Run unit tests
run: pip install tox && tox -e py3${{ matrix.py }}-torch28-unit
multi-torch:
if: github.event_name == 'pull_request'
needs: [linux]
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
matrix:
torch: [25, 26, 27]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Run unit tests
run: pip install tox && tox -e py312-torch${{ matrix.torch }}-unit
partial-install:
if: github.event_name == 'pull_request'
needs: [linux]
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
matrix:
test-env: [onnx, torch]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Run unit tests
run: pip install tox && tox -e py312-partial-unit-${{ matrix.test-env }}