Skip to content

Commit

Permalink
build: Install dependencies only in Tox environments (#1785)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jesse Claven authored Jun 12, 2024
1 parent 6309fd8 commit 8f59a96
Show file tree
Hide file tree
Showing 14 changed files with 51 additions and 41 deletions.
36 changes: 12 additions & 24 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
- name: Lint
run: make lint

mlserver:
test-mlserver:
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -95,20 +95,16 @@ jobs:
uses: snok/install-poetry@v1
with:
virtualenvs-create: false
- name: Install Dependencies
run: |
if [[ ${{ runner.os == 'macOS' }} ]]; then
source ./hack/activate-libomp-macos.sh
fi
poetry install --sync --only dev
- name: Install dependencies
run: poetry install --only test
- name: Test
run: |
if [[ ${{ runner.os == 'macOS' }} ]]; then
source ./hack/activate-libomp-macos.sh
fi
tox -e mlserver
poetry run tox -e mlserver
runtimes:
test-runtimes:
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -152,21 +148,17 @@ jobs:
uses: snok/install-poetry@v1
with:
virtualenvs-create: false
- name: Install Dependencies
run: |
if [[ ${{ runner.os == 'macOS' }} ]]; then
source ./hack/activate-libomp-macos.sh
fi
poetry install --sync --only dev
- name: Install dependencies
run: poetry install --only test
- name: Test
run: |
if [[ ${{ runner.os == 'macOS' }} ]]; then
source ./hack/activate-libomp-macos.sh
fi
tox -c ./runtimes/${{ matrix.tox-environment }}
poetry run tox -c ./runtimes/${{ matrix.tox-environment }}
# Ensure that having all the runtimes installed together works
all-runtimes:
test-all-runtimes:
if: github.event_name == 'push'
strategy:
fail-fast: false
Expand Down Expand Up @@ -209,15 +201,11 @@ jobs:
uses: snok/install-poetry@v1
with:
virtualenvs-create: false
- name: Install Dependencies
run: |
if [[ ${{ runner.os == 'macOS' }} ]]; then
source ./hack/activate-libomp-macos.sh
fi
poetry install --sync --only dev
- name: Install dependencies
run: poetry install --only test
- name: Test
run: |
if [[ ${{ runner.os == 'macOS' }} ]]; then
source ./hack/activate-libomp-macos.sh
fi
tox -e all-runtimes
poetry run tox -e all-runtimes
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ IMAGE_NAME := seldonio/mlserver
.PHONY: install-dev _generate generate run build \
push-test push test lint fmt version clean licenses

.PHONY: bootstrap-test
bootstrap-test:
for _runtime in ./runtimes/*; \
do \
echo "Copying Tox configuration to $$_runtime..."; \
cp tox.runtime.ini $$_runtime/tox.ini; \
done

install-dev:
poetry install --sync --with all-runtimes --with all-runtimes-dev

Expand Down
14 changes: 7 additions & 7 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ opentelemetry-instrumentation-grpc = ">=0.43b0"
opentelemetry-exporter-otlp-proto-grpc = "^1.22.0"
pytest-lazy-fixture = "^0.6.3"

[tool.poetry.group.test.dependencies]
tox = "4.14.2"

[tool.poetry.group.dev.dependencies]
datamodel-code-generator = "0.25.5"
grpcio-tools = "1.48.2"
Expand Down
2 changes: 1 addition & 1 deletion runtimes/alibi-detect/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ isolated_build = true
[testenv]
allowlist_externals = poetry
commands_pre =
poetry install --sync --no-root
poetry install --sync --no-root
poetry install -C {toxinidir}/../../
commands =
python -m pytest {posargs} -n auto \
Expand Down
2 changes: 1 addition & 1 deletion runtimes/alibi-explain/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ isolated_build = true
[testenv]
allowlist_externals = poetry
commands_pre =
poetry install --sync --no-root
poetry install --sync --no-root
poetry install -C {toxinidir}/../../
commands =
python -m pytest {posargs} -n auto \
Expand Down
4 changes: 2 additions & 2 deletions runtimes/catboost/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ isolated_build = true
[testenv]
allowlist_externals = poetry
commands_pre =
poetry install --sync --no-root
poetry install --sync --no-root
poetry install -C {toxinidir}/../../
commands =
python -m pytest {posargs} \
python -m pytest {posargs} -n auto \
{toxinidir}/tests
2 changes: 1 addition & 1 deletion runtimes/huggingface/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ isolated_build = true
[testenv]
allowlist_externals = poetry
commands_pre =
poetry install --sync --no-root
poetry install --sync --no-root
poetry install -C {toxinidir}/../../
commands =
python -m pytest {posargs} -n auto \
Expand Down
2 changes: 1 addition & 1 deletion runtimes/lightgbm/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ isolated_build = true
[testenv]
allowlist_externals = poetry
commands_pre =
poetry install --sync --no-root
poetry install --sync --no-root
poetry install -C {toxinidir}/../../
commands =
python -m pytest {posargs} -n auto \
Expand Down
2 changes: 1 addition & 1 deletion runtimes/mlflow/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ isolated_build = true
[testenv]
allowlist_externals = poetry
commands_pre =
poetry install --sync --no-root
poetry install --sync --no-root
poetry install -C {toxinidir}/../../
commands =
python -m pytest {posargs} -n auto \
Expand Down
2 changes: 1 addition & 1 deletion runtimes/mllib/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ isolated_build = true
[testenv]
allowlist_externals = poetry
commands_pre =
poetry install --sync --no-root
poetry install --sync --no-root
poetry install -C {toxinidir}/../../
commands =
python -m pytest {posargs} -n auto \
Expand Down
2 changes: 1 addition & 1 deletion runtimes/sklearn/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ isolated_build = true
[testenv]
allowlist_externals = poetry
commands_pre =
poetry install --sync --no-root
poetry install --sync --no-root
poetry install -C {toxinidir}/../../
commands =
python -m pytest {posargs} -n auto \
Expand Down
2 changes: 1 addition & 1 deletion runtimes/xgboost/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ isolated_build = true
[testenv]
allowlist_externals = poetry
commands_pre =
poetry install --sync --no-root
poetry install --sync --no-root
poetry install -C {toxinidir}/../../
commands =
python -m pytest {posargs} -n auto \
Expand Down
11 changes: 11 additions & 0 deletions tox.runtime.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[tox]
isolated_build = true

[testenv]
allowlist_externals = poetry
commands_pre =
poetry install --sync --no-root
poetry install -C {toxinidir}/../../
commands =
python -m pytest {posargs} -n auto \
{toxinidir}/tests

0 comments on commit 8f59a96

Please sign in to comment.