| 1 |
name: Run Import Tests |
| 2 |
|
| 3 |
on: |
| 4 |
pull_request: |
| 5 |
paths: |
| 6 |
- "src/**" |
| 7 |
- "tests/**" |
| 8 |
- ".github/**" |
| 9 |
- "examples/**" |
| 10 |
- "setup.py" |
| 11 |
types: [opened, synchronize, reopened] |
| 12 |
|
| 13 |
env: |
| 14 |
HF_HOME: ~/hf_cache |
| 15 |
TESTING_MOCKED_DATALOADERS: "1" |
| 16 |
IS_GITHUB_CI: "1" |
| 17 |
|
| 18 |
jobs: |
| 19 |
run-tests: |
| 20 |
runs-on: ubuntu-latest |
| 21 |
strategy: |
| 22 |
fail-fast: false |
| 23 |
matrix: |
| 24 |
pytorch-version: [ |
| 25 |
latest, |
| 26 |
minimum, |
| 27 |
] |
| 28 |
steps: |
| 29 |
- uses: actions/checkout@v6 |
| 30 |
- name: Set up python 3.10 |
| 31 |
uses: actions/setup-python@v6 |
| 32 |
with: |
| 33 |
python-version: '3.10' |
| 34 |
cache: 'pip' |
| 35 |
cache-dependency-path: 'setup.py' |
| 36 |
|
| 37 |
- name: Install the library |
| 38 |
run: | |
| 39 |
pip install -e . |
| 40 |
pip install pytest-reportlog tabulate setuptools git+https://github.com/muellerzr/import-timer |
| 41 |
|
| 42 |
- name: Show installed libraries |
| 43 |
run: | |
| 44 |
pip freeze |
| 45 |
|
| 46 |
- name: Run Import Tests |
| 47 |
env: |
| 48 |
PYTORCH_VERSION: ${{ matrix.pytorch-version }} |
| 49 |
run: | |
| 50 |
pytest -sv tests/test_imports.py |
| 51 |
|
| 52 |
- name: Generate Report |
| 53 |
if: always() |
| 54 |
run: | |
| 55 |
python utils/log_reports.py >> $GITHUB_STEP_SUMMARY |