Skip to content

REF: Move auth code to service for better scalability #2394

REF: Move auth code to service for better scalability

REF: Move auth code to service for better scalability #2394

Workflow file for this run

name: Python CI
on:
push:
branches:
- '*'
pull_request:
types: ['opened', 'reopened', 'synchronize']
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
lint:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ "ubuntu-latest" ]
python-version: [ "3.10" ]
steps:
- name: Check out code
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: recursive
- name: Set up Python environment
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: flake8 Lint
uses: py-actions/flake8@v2
with:
path: "xinference"
args: "--config setup.cfg"
- name: black
uses: psf/black@stable
with:
src: "xinference"
options: "--check"
version: "23.12.0"
- uses: isort/isort-action@master
with:
sortPaths: "xinference"
configuration: "--check-only --diff --sp setup.cfg"
- name: mypy
run: pip install mypy && mypy --install-types --non-interactive xinference
- name: codespell
run: pip install codespell && codespell xinference
- name: Set up Node.js
uses: actions/setup-node@v1
with:
node-version: 16
# ESLint and Prettier must be in `package.json`
- name: Install Node.js dependencies
run: cd xinference/web/ui && npm ci
- name: ESLint Check
run: cd xinference/web/ui && npx eslint .
- name: Prettier Check
run: cd xinference/web/ui && ./node_modules/.bin/prettier --check .
build_test_job:
runs-on: ${{ matrix.os }}
needs: lint
env:
CONDA_ENV: test
SELF_HOST_PYTHON: /root/miniconda3/envs/inference_test/bin/python
defaults:
run:
shell: bash -l {0}
strategy:
fail-fast: false
matrix:
os: [ "ubuntu-latest", "macos-latest", "windows-latest" ]
python-version: [ "3.8", "3.9", "3.10", "3.11" ]
module: [ "xinference" ]
exclude:
- { os: macos-latest, python-version: 3.9 }
- { os: macos-latest, python-version: 3.10 }
- { os: windows-latest, python-version: 3.9 }
- { os: windows-latest, python-version: 3.10 }
include:
- { os: self-hosted, module: gpu, python-version: 3.9}
steps:
- name: Check out code
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: recursive
- name: Set up conda ${{ matrix.python-version }}
uses: conda-incubator/setup-miniconda@v2
if: ${{ matrix.module != 'gpu' }}
with:
python-version: ${{ matrix.python-version }}
activate-environment: ${{ env.CONDA_ENV }}
- name: Install dependencies
env:
MODULE: ${{ matrix.module }}
if: ${{ matrix.module != 'gpu' }}
run: |
pip install "llama-cpp-python>=0.2.23"
pip install transformers
pip install torch
pip install accelerate
pip install sentencepiece
pip install transformers_stream_generator
pip install bitsandbytes
pip install ctransformers
pip install sentence-transformers
pip install s3fs
pip install modelscope
pip install diffusers
pip install protobuf
pip install -e ".[dev]"
pip install "jinja2==3.1.2"
working-directory: .
- name: Test with pytest
env:
MODULE: ${{ matrix.module }}
run: |
if [ "$MODULE" == "gpu" ]; then
${{ env.SELF_HOST_PYTHON }} -m pip install "openai>1"
${{ env.SELF_HOST_PYTHON }} -m pip install -U modelscope
${{ env.SELF_HOST_PYTHON }} -m pip install -U sse_starlette
${{ env.SELF_HOST_PYTHON }} -m pip install -U xoscar
${{ env.SELF_HOST_PYTHON }} -m pip install -U "python-jose[cryptography]"
${{ env.SELF_HOST_PYTHON }} -m pip install -U "passlib[bcrypt]"
${{ env.SELF_HOST_PYTHON }} -m pip install -U "aioprometheus[starlette]"
${{ env.SELF_HOST_PYTHON }} -m pytest --timeout=1500 \
-W ignore::PendingDeprecationWarning \
--cov-config=setup.cfg --cov-report=xml --cov=xinference xinference/model/image/tests/test_stable_diffusion.py
else
pytest --timeout=1500 \
-W ignore::PendingDeprecationWarning \
--cov-config=setup.cfg --cov-report=xml --cov=xinference xinference/client/tests/test_client.py
pytest --timeout=1500 \
-W ignore::PendingDeprecationWarning \
--cov-config=setup.cfg --cov-report=xml --cov=xinference --ignore xinference/client/tests/test_client.py --ignore xinference/model/image/tests/test_stable_diffusion.py xinference
fi
working-directory: .