diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 4797b69c0..55bf2ebf5 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -11,8 +11,10 @@ on: jobs: generate: strategy: + fail-fast: false matrix: - python-version: ["3.10"] + python-version: ["3.9", "3.10"] + target: ["dataplane", "model-repository"] runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -26,15 +28,15 @@ jobs: virtualenvs-create: false - name: Install dependencies run: poetry install --sync --only dev - - name: Generate - run: make generate + - name: Generate ${{ matrix.target }} + run: make generate-${{ matrix.target }} - name: Check for changes - run: git --no-pager diff --exit-code . + run: make lint-no-changes lint: strategy: matrix: - python-version: ["3.10"] + python-version: ["3.9", "3.10"] runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 diff --git a/Makefile b/Makefile index 7bda45bca..fa47da669 100644 --- a/Makefile +++ b/Makefile @@ -17,10 +17,17 @@ lock: poetry lock --no-update -C $$_runtime; \ done -_generate: # "private" target to call `fmt` after `generate` - poetry run bash ./hack/generate-types.sh +_generate_model_repository: # "private" target to call `fmt` after `generate` + poetry run bash ./hack/generate-types.sh model_repository -generate: | _generate fmt +_generate_dataplane: # "private" target to call `fmt` after `generate` + poetry run bash ./hack/generate-types.sh dataplane + +generate-model-repository: | _generate_model_repository fmt + +generate-dataplane: | _generate_dataplane fmt + +generate: | _generate_model_repository _generate_dataplane fmt run: mlserver start \ @@ -78,13 +85,14 @@ lint: mypy ./benchmarking mypy ./docs/examples -# Check if something has changed after generation -lint-generate: generate +lint-no-changes: git \ --no-pager diff \ --exit-code \ . +lint-generate: generate lint-no-changes + licenses: tox --recreate -e licenses cut -d, -f1,3 ./licenses/license_info.csv \ diff --git a/hack/generate-types.sh b/hack/generate-types.sh index f3fe831b2..05c922f0e 100755 --- a/hack/generate-types.sh +++ b/hack/generate-types.sh @@ -4,6 +4,8 @@ set -Eeuo pipefail ROOT_FOLDER="$(dirname "${0}")/.." +TARGET="$1" + _generatePB() { local apiName=$1 @@ -33,8 +35,5 @@ _generatePydantic() { --target-python-version 3.6 } -_generatePB dataplane -_generatePydantic dataplane - -_generatePB model_repository -_generatePydantic model_repository +_generatePB "$TARGET" +_generatePydantic "$TARGET"