| name: Python tests | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - ci_* | |
| paths-ignore: | |
| - "js/**" | |
| - "api-inference-community/**" | |
| pull_request: | |
| types: [assigned, opened, synchronize, reopened] | |
| paths-ignore: | |
| - "js/**" | |
| - "api-inference-community/**" | |
| env: | |
| HUGGINGFACE_CO_STAGING: yes | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: ["3.7", "3.10"] | |
| test_repository: ["Repository only", "Everything else"] | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v2 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install dependencies | |
| run: | | |
| sudo apt install -y libsndfile1-dev | |
| pip install --upgrade pip | |
| pip install .[testing] | |
| - run: | | |
| if [[ "${{ matrix.test_repository }}" == "Repository only" ]] | |
| then | |
| pytest --log-cli-level=INFO -sv ./tests/test_repository.py -k RepositoryTest | |
| else | |
| pytest --log-cli-level=INFO -sv ./tests/ -k 'not RepositoryTest' | |
| fi | |
| build_pytorch: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: ["3.7", "3.10"] | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v2 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install dependencies | |
| run: | | |
| pip install --upgrade pip | |
| pip install .[testing,torch] | |
| - run: pytest -sv ./tests/test_hubmixin* | |
| build_tensorflow: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: ["3.7", "3.10"] | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v2 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install dependencies | |
| run: | | |
| sudo apt install -y graphviz | |
| pip install --upgrade pip | |
| pip install .[testing,tensorflow] | |
| - run: pytest -sv ./tests/test_tf* | |
| - run: pytest -sv ./tests/test_keras* | |
| build_fastai: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: ["3.7", "3.9"] | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v2 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install dependencies | |
| run: | | |
| pip install --upgrade pip | |
| pip install .[testing,fastai] | |
| - run: pytest -sv ./tests/test_fastai* | |
| tests_lfs: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - name: Set up Python | |
| uses: actions/setup-python@v2 | |
| with: | |
| python-version: "3.10" | |
| - run: | | |
| git config --global user.email "ci@dummy.com" | |
| git config --global user.name "ci" | |
| - name: Install dependencies | |
| run: | | |
| pip install --upgrade pip | |
| pip install .[testing] | |
| - run: RUN_GIT_LFS_TESTS=1 pytest -sv ./tests/ -k "HfLargefilesTest" | |