Support for pydantic<3.0 #224
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Tests | |
on: [ pull_request ] | |
env: | |
MODULE_NAME: thunder | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12' ] | |
torch-version: [ '1.13', '2.0.1', '2.5.0'] | |
exclude: | |
- python-version: '3.8' | |
torch-version: '2.5.0' | |
- python-version: '3.9' | |
torch-version: '2.5.0' | |
- python-version: '3.10' | |
torch-version: '2.5.0' | |
- python-version: '3.11' | |
torch-version: '1.13' | |
- python-version: '3.11' | |
torch-version: '2.5.0' | |
- python-version: '3.12' | |
torch-version: '1.13' | |
- python-version: '3.12' | |
torch-version: '2.0.1' | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Check Python version # https://github.com/python/cpython/issues/95299 | |
id: check-version | |
run: | | |
python_version=$(python --version | awk '{print $2}') | |
major=$(echo $python_version | cut -d'.' -f1) | |
minor=$(echo $python_version | cut -d'.' -f2) | |
if ([ "$major" -eq 3 ] && [ "$minor" -ge 12 ]); then | |
echo "setuptools_present=false" >> $GITHUB_ENV | |
else | |
echo "setuptools_present=true" >> $GITHUB_ENV | |
fi | |
- name: Build the package (python >= 3.12) | |
if: env.setuptools_present == 'false' | |
run: | | |
python -m pip install build | |
python -m build | |
- name: Build the package (python < 3.12) | |
if: env.setuptools_present == 'true' | |
run: | | |
python setup.py sdist | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install -e . | |
python -m pip install -r tests/dev-requirements.txt | |
python -m pip install torch==${{ matrix.torch-version }} | |
cd tests | |
export MODULE_PARENT=$(python -c "import $MODULE_NAME, os; print(os.path.dirname($MODULE_NAME.__path__[0]))") | |
export MODULE_PARENT=${MODULE_PARENT%"/"} | |
cd .. | |
echo $MODULE_PARENT | |
echo "MODULE_PARENT=$(echo $MODULE_PARENT)" >> $GITHUB_ENV | |
- name: Test with pytest | |
run: | | |
pytest tests --junitxml=reports/junit-${{ matrix.python-version }}.xml --cov="$MODULE_PARENT/$MODULE_NAME" --cov-report=xml --cov-branch | |
- name: Generate coverage report | |
run: | | |
coverage xml -o reports/coverage-${{ matrix.python-version }}.xml | |
sed -i -e "s|$MODULE_PARENT/||g" reports/coverage-${{ matrix.python-version }}.xml | |
sed -i -e "s|$(echo $MODULE_PARENT/ | tr "/" .)||g" reports/coverage-${{ matrix.python-version }}.xml | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: reports-${{ matrix.python-version }} | |
path: reports/*-${{ matrix.python-version }}.xml | |
- name: Upload coverage results | |
uses: codecov/codecov-action@v3 | |
with: | |
files: reports/coverage-${{ matrix.python-version }}.xml | |
verbose: true |