Skip to content

Commit

Permalink
Using tox shared envs.
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertSamoilescu committed Jun 19, 2024
1 parent f4bc954 commit 89aea98
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 37 deletions.
37 changes: 26 additions & 11 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,11 @@ jobs:
virtualenvs-create: false
- name: Install dependencies
run: poetry install --only test
- name: Activate LibOMP (in MacOS)
if: runner.os == 'macOS'
run: source ./hack/activate-libomp-macos.sh
- name: Test
run: |
if [[ ${{ runner.os == 'macOS' }} ]]; then
source ./hack/activate-libomp-macos.sh
fi
poetry run tox -e mlserver
run: poetry run tox -e mlserver

test-runtimes:
strategy:
Expand Down Expand Up @@ -150,12 +149,11 @@ jobs:
virtualenvs-create: false
- name: Install dependencies
run: poetry install --only test
- name: Activate LibOMP (in MacOS)
if: runner.os == 'macOS'
run: source ./hack/activate-libomp-macos.sh
- name: Test
run: |
if [[ ${{ runner.os == 'macOS' }} ]]; then
source ./hack/activate-libomp-macos.sh
fi
poetry run tox -c ./runtimes/${{ matrix.tox-environment }}
run: poetry run tox -c ./runtimes/${{ matrix.tox-environment }}

# Ensure that having all the runtimes installed together works
test-all-runtimes:
Expand All @@ -165,12 +163,14 @@ jobs:
matrix:
os:
- ubuntu-22.04
- macos-13
python-version:
- "3.9"
- "3.10"
runs-on: ${{ matrix.os }}
steps:
- name: Maximize build space
if: runner.os == 'Linux'
uses: easimon/maximize-build-space@master
with:
remove-dotnet: 'true'
Expand All @@ -181,6 +181,10 @@ jobs:
overprovision-lvm: 'true'
swap-size-mb: 1024
- uses: actions/checkout@v4

- name: Install OpenMP (in MacOS)
if: runner.os == 'macOS'
run: brew install libomp
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
Expand All @@ -195,5 +199,16 @@ jobs:
virtualenvs-create: false
- name: Install dependencies
run: poetry install --only test
- name: Test
- name: Activate LibOMP (in MacOS)
if: runner.os == 'macOS'
run: source ./hack/activate-libomp-macos.sh
- name: Test all runtimes
run: poetry run tox -e all-runtimes
# Install Docker here cause for macOS we get SegFault
# when running runtimes tests with Docker installed - might
# be caused by colima memory usage
- name: Setup Docker (missing on MacOS)
if: runner.os == 'macOS'
run: ./hack/install-docker-macos.sh
- name: Test mlserver with all runtimes
run: poetry run tox -e all-mlserver
56 changes: 30 additions & 26 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ isolated_build = true
envlist =
mlserver
all-runtimes
all-mlserver
py3
requires =
tox-ignore-env-name-mismatch ~= 0.2.0

[testenv]
allowlist_externals = poetry
Expand All @@ -23,45 +26,46 @@ commands =
{toxinidir}/tests \
--ignore={toxinidir}/tests/kafka \
--ignore={toxinidir}/tests/parallel
# kafka tests are failinig for macos when running in parallel
# kafka and parallel tests are failinig for macos when running in parallel
# with the entire test suite. So, we run them separately.
python -m pytest {posargs} \
{toxinidir}/tests/kafka
# parallel tests are failing for macos quite often when running
# with xdist. So, we run them separately without xdist.
python -m pytest {posargs} \
{toxinidir}/tests/kafka \
{toxinidir}/tests/parallel
set_env =
GITHUB_SERVER_URL = {env:GITHUB_SERVER_URL:https\://github.com}
GITHUB_REPOSITORY = {env:GITHUB_REPOSITORY:SeldonIO/MLServer}
GITHUB_REF = {env:GITHUB_REF:refs/heads/master}

[testenv:all-runtimes]
[testenv:{all-runtimes, all-mlserver}]
env_dir = {toxworkdir}{/}static
runner = ignore_env_name_mismatch
commands_pre =
poetry install --sync --no-root \
--with all-runtimes \
--with all-runtimes-dev
commands =
python -m pytest {posargs} -n auto \
{toxinidir}/tests \
{toxinidir}/runtimes/alibi-explain \
{toxinidir}/runtimes/alibi-detect \
{toxinidir}/runtimes/sklearn \
{toxinidir}/runtimes/xgboost \
{toxinidir}/runtimes/mllib \
{toxinidir}/runtimes/lightgbm \
{toxinidir}/runtimes/mlflow \
{toxinidir}/runtimes/huggingface \
--ignore={toxinidir}/tests/kafka \
--ignore={toxinidir}/tests/parallel
# kafka tests are failinig for macos when running in parallel
# with the entire test suite. So, we run them separately.
python -m pytest {posargs} \
{toxinidir}/tests/kafka
# parallel tests are failing for macos quite often when running
# with xdist. So, we run them separately without xdist.
python -m pytest {posargs} \
{toxinidir}/tests/parallel
all-runtimes: \
python -m pytest {posargs} -n auto \
{toxinidir}/tests \
{toxinidir}/runtimes/alibi-explain \
{toxinidir}/runtimes/alibi-detect \
{toxinidir}/runtimes/sklearn \
{toxinidir}/runtimes/xgboost \
{toxinidir}/runtimes/mllib \
{toxinidir}/runtimes/lightgbm \
{toxinidir}/runtimes/mlflow \
{toxinidir}/runtimes/huggingface \
--ignore={toxinidir}/tests/kafka \
--ignore={toxinidir}/tests/parallel
all-mlserver: \
# kafka tests are failinig for macos when running in parallel
# with the entire test suite. So, we run them separately.
python -m pytest {posargs} \
{toxinidir}/tests/kafka
# parallel tests are failing for macos quite often when running
# with xdist. So, we run them separately without xdist.
python -m pytest {posargs} \
{toxinidir}/tests/parallel
set_env =
GITHUB_SERVER_URL = {env:GITHUB_SERVER_URL:https\://github.com}
GITHUB_REPOSITORY = {env:GITHUB_REPOSITORY:SeldonIO/MLServer}
Expand Down

0 comments on commit 89aea98

Please sign in to comment.