Add question answering to inference client #4383
Workflow file for this run
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: Python tests | |
on: | |
push: | |
branches: | |
- main | |
- ci_* | |
paths-ignore: | |
- "docs/**" | |
pull_request: | |
types: [assigned, opened, synchronize, reopened] | |
paths-ignore: | |
- "docs/**" | |
env: | |
HUGGINGFACE_PRODUCTION_USER_TOKEN: ${{ secrets.HUGGINGFACE_PRODUCTION_USER_TOKEN }} | |
jobs: | |
build-ubuntu: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.8", "3.11"] | |
test_name: | |
[ | |
"Repository only", | |
"Everything else", | |
"torch", | |
] | |
include: | |
- python-version: "3.11" # LFS not ran on 3.8 | |
test_name: "lfs" | |
- python-version: "3.8" | |
test_name: "fastai" # fastai not supported on 3.11 -> test it on 3.10 | |
- python-version: "3.10" | |
test_name: "fastai" | |
- python-version: "3.8" | |
test_name: "tensorflow" # Tensorflow not supported on 3.11 -> test it on 3.10 | |
- python-version: "3.10" | |
test_name: "tensorflow" | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
# Install dependencies | |
- name: Configure and install dependencies | |
run: | | |
pip install --upgrade pip | |
pip install .[testing] | |
case "${{ matrix.test_name }}" in | |
"Repository only" | "Everything else") | |
sudo apt install -y libsndfile1-dev | |
;; | |
lfs) | |
git config --global user.email "[email protected]" | |
git config --global user.name "ci" | |
;; | |
fastai | torch) | |
pip install .[${{ matrix.test_name }}] | |
;; | |
tensorflow) | |
sudo apt install -y graphviz | |
pip install .[tensorflow] | |
;; | |
esac | |
# Easy debugging if CI is broken | |
- name: Pip freeze | |
run: pip freeze | |
# Run tests | |
- name: Run tests | |
working-directory: ./src # For code coverage to work | |
run: | | |
PYTEST="python -m pytest --cov=./huggingface_hub --cov-report=xml:../coverage.xml --vcr-record=none" | |
case "${{ matrix.test_name }}" in | |
"Repository only") | |
# Run repo tests concurrently | |
PYTEST="$PYTEST ../tests -k 'TestRepository' -n8" | |
echo $PYTEST | |
eval $PYTEST | |
;; | |
"Everything else") | |
PYTEST="$PYTEST ../tests -k 'not TestRepository'" | |
echo $PYTEST | |
eval $PYTEST | |
;; | |
lfs) | |
eval "RUN_GIT_LFS_TESTS=1 $PYTEST ../tests -k 'HfLargefilesTest'" | |
;; | |
fastai) | |
eval "$PYTEST ../tests/test_fastai*" | |
;; | |
tensorflow) | |
# Cannot be on same line since '_tf*' checks if tensorflow is NOT imported by default | |
eval "$PYTEST ../tests/test_tf*" | |
eval "$PYTEST ../tests/test_keras*" | |
;; | |
torch) | |
eval "$PYTEST ../tests/test_hubmixin*" | |
;; | |
esac | |
# Upload code coverage | |
- name: Upload coverage reports to Codecov with GitHub Action | |
uses: codecov/codecov-action@v3 | |
with: | |
files: ./coverage.xml | |
verbose: true | |
build-windows: | |
# (almost) Duplicate config compared to `build-ubuntu` but running on Windows. | |
# Please make sure to keep it updated as well. | |
# Lighter version of the tests with only 1 test suite running on Python3.8. | |
runs-on: windows-latest | |
env: | |
DISABLE_SYMLINKS_IN_WINDOWS_TESTS: 1 | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.8"] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
# Install dependencies | |
- name: Configure and install dependencies | |
run: | | |
pip install --upgrade pip | |
pip install .[testing] | |
# sudo apt install -y libsndfile1-dev | |
# Easy debugging if CI is broken | |
- name: Pip freeze | |
run: pip freeze | |
# Run tests | |
- name: Run tests | |
working-directory: ./src # For code coverage to work | |
run: python -m pytest --cov=./huggingface_hub --cov-report=xml:../coverage.xml --vcr-record=none ../tests | |
# Upload code coverage | |
- name: Upload coverage reports to Codecov with GitHub Action | |
uses: codecov/codecov-action@v3 | |
with: | |
files: ./coverage.xml | |
verbose: true |