feat: add scaleway inference provider #8703
Workflow file for this run
This file contains hidden or 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/**" | |
jobs: | |
build-ubuntu: | |
runs-on: ubuntu-latest | |
env: | |
UV_HTTP_TIMEOUT: 600 # max 10min to install deps | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.8", "3.13"] | |
test_name: | |
[ | |
"Repository only", | |
"Everything else", | |
"Inference only", | |
"Xet only" | |
] | |
include: | |
- python-version: "3.13" # LFS not ran on 3.8 | |
test_name: "lfs" | |
- python-version: "3.8" | |
test_name: "fastai" | |
- python-version: "3.10" # fastai not supported on 3.12 and 3.11 -> test it on 3.10 | |
test_name: "fastai" | |
- python-version: "3.8" | |
test_name: "tensorflow" | |
- python-version: "3.10" # tensorflow not supported on 3.12 -> test it on 3.10 | |
test_name: "tensorflow" | |
- python-version: "3.8" # test torch~=1.11 on python 3.8 only. | |
test_name: "Python 3.8, torch_1.11" | |
- python-version: "3.12" # test torch latest on python 3.12 only. | |
test_name: "torch_latest" | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
# Setup venv | |
# TODO: revisit when https://github.com/astral-sh/uv/issues/1526 is addressed. | |
- name: Setup venv + uv | |
run: | | |
pip install --upgrade uv | |
uv venv | |
# Install dependencies | |
- name: Install dependencies | |
run: | | |
uv pip install "huggingface_hub[testing] @ ." | |
case "${{ matrix.test_name }}" in | |
"Repository only" | "Everything else" | "Inference only") | |
sudo apt update | |
sudo apt install -y libsndfile1-dev | |
;; | |
lfs) | |
git config --global user.email "[email protected]" | |
git config --global user.name "ci" | |
;; | |
fastai) | |
uv pip install "huggingface_hub[fastai] @ ." | |
;; | |
torch_latest) | |
uv pip install "huggingface_hub[torch] @ ." | |
uv pip install --upgrade torch | |
;; | |
"Python 3.8, torch_1.11") | |
uv pip install "huggingface_hub[torch] @ ." | |
uv pip install torch~=1.11 | |
;; | |
tensorflow) | |
sudo apt update | |
sudo apt install -y graphviz | |
uv pip install "huggingface_hub[tensorflow-testing] @ ." | |
;; | |
esac | |
# If not "Xet only", we want to test upload/download with regular LFS workflow | |
# => uninstall hf_xet to make sure we are not using it. | |
if [[ "${{ matrix.test_name }}" != "Xet only" ]]; then | |
uv pip uninstall hf_xet | |
fi | |
# Run tests | |
- name: Run tests | |
working-directory: ./src # For code coverage to work | |
run: | | |
source ../.venv/bin/activate | |
PYTEST="python -m pytest --cov=./huggingface_hub --cov-report=xml:../coverage.xml --vcr-record=none --reruns 8 --reruns-delay 2 --only-rerun '(OSError|Timeout|HTTPError.*502|HTTPError.*504||not less than or equal to 0.01)'" | |
case "${{ matrix.test_name }}" in | |
"Repository only") | |
# Run repo tests concurrently | |
PYTEST="$PYTEST ../tests -k 'TestRepository' -n 4" | |
echo $PYTEST | |
eval $PYTEST | |
;; | |
"Inference only") | |
# Run inference tests concurrently | |
PYTEST="$PYTEST ../tests -k 'test_inference' -n 4" | |
echo $PYTEST | |
eval $PYTEST | |
;; | |
"Everything else") | |
PYTEST="$PYTEST ../tests -k 'not TestRepository and not test_inference and not test_xet' -n 4" | |
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*" | |
eval "$PYTEST ../tests/test_serialization.py" | |
;; | |
"Python 3.8, torch_1.11" | torch_latest) | |
eval "$PYTEST ../tests/test_hub_mixin*" | |
eval "$PYTEST ../tests/test_serialization.py" | |
;; | |
"Xet only") | |
PYTEST="$PYTEST ../tests -k 'test_xet' -n 4" | |
echo $PYTEST | |
eval $PYTEST | |
;; | |
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. | |
runs-on: windows-latest | |
env: | |
DISABLE_SYMLINKS_IN_WINDOWS_TESTS: 1 | |
UV_HTTP_TIMEOUT: 600 # max 10min to install deps | |
GIT_CLONE_PROTECTION_ACTIVE: false # See https://github.com/git-lfs/git-lfs/issues/5754 | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.8", "3.11"] | |
test_name: ["Everything else", "Xet only"] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
# Setup venv | |
# TODO: revisit when https://github.com/astral-sh/uv/issues/1526 is addressed. | |
- name: Setup venv + uv | |
run: | | |
pip install --upgrade uv | |
uv venv | |
# Install dependencies | |
- name: Install dependencies | |
run: | | |
uv pip install "huggingface_hub[testing] @ ." | |
if ("${{ matrix.test_name }}" -eq "Xet only") { | |
uv pip install hf_xet | |
} | |
# Run tests | |
- name: Run tests | |
working-directory: ./src # For code coverage to work | |
run: | | |
..\.venv\Scripts\activate | |
$PYTEST_ARGS = @( | |
"-m", "pytest", | |
"-n", "4", | |
"--cov=./huggingface_hub", | |
"--cov-report=xml:../coverage.xml", | |
"--vcr-record=none", | |
"--reruns", "8", | |
"--reruns-delay", "2", | |
"--only-rerun", "(OSError|Timeout|HTTPError.*502|HTTPError.*504|not less than or equal to 0.01)", | |
"../tests" | |
) | |
switch ("${{ matrix.test_name }}") { | |
"Xet only" { | |
python $PYTEST_ARGS -k "test_xet" | |
} | |
"Everything else" { | |
python $PYTEST_ARGS -k "not test_xet" | |
} | |
} | |
# Upload code coverage | |
- name: Upload coverage reports to Codecov with GitHub Action | |
uses: codecov/codecov-action@v3 | |
with: | |
files: ./coverage.xml | |
verbose: true |