-
Notifications
You must be signed in to change notification settings - Fork 109
176 lines (156 loc) · 6.04 KB
/
ci-testing.yml
File metadata and controls
176 lines (156 loc) · 6.04 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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
name: CI testing
# see: https://help.github.com/en/actions/reference/events-that-trigger-workflows
on: # Trigger the workflow on push or pull request, but only for the main branch
push:
branches: [main]
pull_request: {}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
defaults:
run:
shell: bash
env:
#CI: "true"
TORCH_URL_RC: "https://download.pytorch.org/whl/test/cpu/torch_test.html"
TORCH_URL_NIGHTLY: "https://download.pytorch.org/whl/nightly/cpu"
TORCH_URL_STABLE: "https://download.pytorch.org/whl/cpu"
jobs:
pytester:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["ubuntu-22.04", "macOS-15", "windows-latest"]
python-version: ["3.10"]
requires: ["latest", "nightly"] # , 'oldest'
suite: ["core", "ops", "grads"]
include:
- { os: "ubuntu-22.04", python-version: "3.10", requires: "oldest", suite: "core" }
- { os: "ubuntu-22.04", python-version: "3.10", requires: "oldest", suite: "ops" }
- { os: "ubuntu-22.04", python-version: "3.10", requires: "oldest", suite: "grads" }
- { os: "ubuntu-24.04", python-version: "3.11", requires: "latest" }
- { os: "ubuntu-24.04", python-version: "3.12", requires: "latest" }
- { os: "ubuntu-24.04", python-version: "3.13", requires: "latest" }
exclude:
- { os: "windows-latest", suite: "ops" }
- { os: "windows-latest", suite: "grads" }
# Timeout: https://stackoverflow.com/a/59076067/4521646
timeout-minutes: 35
steps:
- uses: actions/checkout@v5
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
- name: Setup Ubuntu
if: runner.os == 'Linux'
run: |
sudo apt-get update -qq --fix-missing
sudo apt-get install -y libblas3 liblapack3 libopenblas-dev
pip install --force-reinstall numpy
- name: Set min. dependencies
if: matrix.requires == 'oldest'
run: |
for fpath in ('requirements/base.txt', 'requirements/test.txt'):
req = open(fpath).read().replace('>=', '==')
open(fpath, 'w').write(req)
shell: python
- name: set default Torch source
run: echo "TORCH_URL=$TORCH_URL_STABLE" >> $GITHUB_ENV
- name: switch Torch source to nightly
if: matrix.requires == 'nightly'
run: |
echo "TORCH_URL=$TORCH_URL_NIGHTLY" >> $GITHUB_ENV
echo "PIP_EXTRA_FLAG=--pre" >> $GITHUB_ENV
- name: Install Mac specific dependencies
if: runner.os == 'macOS'
run: brew install libomp
- name: Install package & dependencies
run: |
pip install -e . -U \
${PIP_EXTRA_FLAG} -r requirements/test.txt \
--extra-index-url=${TORCH_URL}
pip list
- name: re-Install dependencies
if: matrix.requires != 'nightly'
run: |
pip install -q wget
# download script and adjust torch versions in requirements
python -m wget https://raw.githubusercontent.com/Lightning-AI/utilities/main/scripts/adjust-torch-versions.py
for fpath in `ls requirements/*.txt`; do \
python ./adjust-torch-versions.py $fpath ${{ matrix.pytorch-version }}; \
done
# re-install with adjusted torch versions
pip install ${PIP_EXTRA_FLAG} -r requirements/devel.txt \
--extra-index-url=${TORCH_URL}
pip list
- name: Testing Local
if: matrix.suite == 'core'
run: |
coverage run --source thunder -m \
pytest thunder/tests/ \
--ignore=thunder/tests/distributed \
--ignore=thunder/tests/test_ops.py \
--ignore=thunder/tests/test_grad.py \
-v --datefmt="%Y%m%d-%H:%M:%S.%f" \
--random-order-seed=$GITHUB_RUN_ID \
-n 4 --durations=250
- name: Testing Distributed
# run all found tests in given past as standalone
if: runner.os == 'Linux' && matrix.suite == 'core'
run: |
pytest thunder/tests/distributed/ \
-v --datefmt="%Y%m%d-%H:%M:%S.%f" \
--random-order-seed=$GITHUB_RUN_ID \
--durations=250
- name: Testing Ops
if: matrix.suite == 'ops'
run: |
coverage run --source thunder -m \
pytest thunder/tests/test_ops.py \
-v --datefmt="%Y%m%d-%H:%M:%S.%f" \
--random-order-seed=$GITHUB_RUN_ID \
-n 4 --durations=250
- name: Testing Grads
if: matrix.suite == 'grads'
run: |
coverage run --source thunder -m \
pytest thunder/tests/test_grad.py \
-v --datefmt="%Y%m%d-%H:%M:%S.%f" \
--random-order-seed=$GITHUB_RUN_ID \
-n 4 --durations=250
- name: Testing interpreter
if: matrix.python-version != '3.10'
run: |
python -m pytest \
thunder/tests/test_interpreter.py \
thunder/tests/test_jit_general.py \
-v -n 4 --durations=50 --cov=thunder
- name: Statistics
run: |
coverage report
coverage xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
flags: unittests
env_vars: OS,PYTHON
name: codecov-umbrella
fail_ci_if_error: false
testing-guardian:
runs-on: ubuntu-latest
needs: pytester
if: always()
steps:
- run: echo "${{ needs.pytester.result }}"
- name: failing...
if: needs.pytester.result == 'failure'
run: exit 1
- name: cancelled or skipped...
if: contains(fromJSON('["cancelled", "skipped"]'), needs.pytester.result)
timeout-minutes: 1
run: sleep 90