diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 7350cd61c..4797b69c0 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -9,24 +9,47 @@ on: branches: [master] jobs: + generate: + strategy: + matrix: + python-version: ["3.10"] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Install Poetry + uses: snok/install-poetry@v1 + with: + virtualenvs-create: false + - name: Install dependencies + run: poetry install --sync --only dev + - name: Generate + run: make generate + - name: Check for changes + run: git --no-pager diff --exit-code . + lint: + strategy: + matrix: + python-version: ["3.10"] runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: Set up Python 3.10 + - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: - python-version: "3.10" + python-version: ${{ matrix.python-version }} - name: Install Poetry uses: snok/install-poetry@v1 with: virtualenvs-create: false - name: Install dependencies - run: | - make install-dev + run: poetry install --sync --only dev - name: Lint - run: | - make lint + run: make lint mlserver: strategy: @@ -72,11 +95,9 @@ jobs: with: virtualenvs-create: false - name: Install Dependencies - run: | - poetry install --sync --only dev + run: poetry install --sync --only dev - name: Test - run: | - tox -e mlserver + run: tox -e mlserver runtimes: strategy: @@ -116,11 +137,9 @@ jobs: with: virtualenvs-create: false - name: Install Dependencies - run: | - poetry install --sync --only dev + run: poetry install --sync --only dev - name: Test - run: | - tox -c ./runtimes/${{ matrix.tox-environment }} + run: tox -c ./runtimes/${{ matrix.tox-environment }} # Ensure that having all the runtimes installed together works all-runtimes: @@ -180,8 +199,6 @@ jobs: with: virtualenvs-create: false - name: Install Dependencies - run: | - poetry install --sync --only dev + run: poetry install --sync --only dev - name: Test - run: | - tox -e all-runtimes + run: tox -e all-runtimes diff --git a/Makefile b/Makefile index cd4d03a15..7bda45bca 100644 --- a/Makefile +++ b/Makefile @@ -67,7 +67,7 @@ test: tox -c $$_runtime; \ done -lint: generate +lint: black --check . flake8 . mypy ./mlserver @@ -77,7 +77,9 @@ lint: generate done mypy ./benchmarking mypy ./docs/examples - # Check if something has changed after generation + +# Check if something has changed after generation +lint-generate: generate git \ --no-pager diff \ --exit-code \ diff --git a/hack/generate-types.sh b/hack/generate-types.sh index a26c6ef35..f3fe831b2 100755 --- a/hack/generate-types.sh +++ b/hack/generate-types.sh @@ -1,3 +1,7 @@ +#!/usr/bin/env bash + +set -Eeuo pipefail + ROOT_FOLDER="$(dirname "${0}")/.." _generatePB() {