-
Notifications
You must be signed in to change notification settings - Fork 353
152 lines (149 loc) · 4.55 KB
/
unit_tests.yml
File metadata and controls
152 lines (149 loc) · 4.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
# NOTE: Make sure this file is consistent with .gitlab/tests.yml
name: Unit tests
on:
pull_request:
branches: [main, release/*, feature/*]
push:
branches: [main, release/*, feature/*]
paths:
- ".github/workflows/unit_tests.yml"
- "modelopt/**"
- "tests/unit/**"
- "pyproject.toml"
- "tox.ini"
- "tools/launcher/**"
schedule:
- cron: "0 0 * * *" # Nightly
workflow_dispatch: # On-demand
# Cancel previous runs if new commit is pushed
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
jobs:
check-dco:
uses: ./.github/workflows/_wait_for_checks.yml
permissions:
checks: read
secrets: inherit
with:
match_pattern: "^DCO$"
linux:
needs: [check-dco]
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/ubuntu-setup
- name: Run unit tests
run: pip install tox && COV_ARGS="--cov" tox -e py312-torch211-tf_latest-unit
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: unit
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@v6
- uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Run unit tests (without coverage)
# Some issues with torch 2.10 on Windows, so using 2.9 for now
run: pip install tox && tox -e py312-torch29-tf_latest-unit
multi-py:
if: github.event_name == 'pull_request'
needs: [linux]
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
py: [10, 11, 13]
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/ubuntu-setup
with:
python-version: "3.${{ matrix.py }}"
- name: Run unit tests
run: pip install tox && tox -e py3${{ matrix.py }}-torch211-tf_latest-unit
multi-torch:
if: github.event_name == 'pull_request'
needs: [linux]
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
torch: [28, 29, 210]
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/ubuntu-setup
- name: Run unit tests
run: pip install tox && tox -e py312-torch${{ matrix.torch }}-tf_latest-unit
multi-transformers:
if: github.event_name == 'pull_request'
needs: [linux]
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
tf: [min]
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/ubuntu-setup
- name: Run unit tests
run: pip install tox && tox -e py312-torch211-tf_${{ matrix.tf }}-unit
launcher:
if: github.event_name == 'pull_request'
needs: [linux]
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v6
with:
submodules: recursive
- name: Run launcher tests
working-directory: tools/launcher
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
export PATH="$HOME/.local/bin:$PATH"
uv venv .venv
uv pip install -e . pytest
uv run python3 -m pytest -v
partial-install:
if: github.event_name == 'pull_request'
needs: [linux]
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
test-env: [onnx, torch]
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/ubuntu-setup
- name: Run unit tests
run: pip install tox && tox -e py312-partial-unit-${{ matrix.test-env }}
unit-pr-required-check:
# Run even if some jobs are skipped
if: ${{ github.event_name == 'pull_request' && always() }}
needs: [linux, windows, multi-py, multi-torch, multi-transformers, partial-install, launcher]
runs-on: ubuntu-latest
steps:
- name: Required unit tests did not succeed
if: >-
${{ needs.linux.result != 'success' ||
needs.windows.result != 'success' ||
needs.multi-py.result != 'success' ||
needs.multi-torch.result != 'success' ||
needs.multi-transformers.result != 'success' ||
needs.partial-install.result != 'success' ||
needs.launcher.result != 'success' }}
run: exit 1