Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/workflows/merlin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,23 @@ jobs:
version: v1.58.1
working-directory: api

check-generated-clients:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache-dependency-path: api/go.sum
- name: Install codegen tools
# generate-client-go calls goimports, installed by `make setup` into
# $(go env GOPATH)/bin, which must be on PATH for the bare goimports call.
run: |
make setup
echo "$(go env GOPATH)/bin" >> "$GITHUB_PATH"
- name: Verify generated clients are in sync with swagger.yaml
run: make verify-client

test-api:
runs-on: ubuntu-latest
services:
Expand Down Expand Up @@ -493,6 +510,7 @@ jobs:
uses: ./.github/workflows/release.yml
needs:
- create-version
- check-generated-clients
- build-api
- build-batch-predictor-base-image
- build-pyfunc-server-base-image
Expand Down
26 changes: 24 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ generate-client-go:
@echo "Generating Go client from swagger.yaml"
@mv ${CLIENT_GO_EXAMPLES_DIR} ${TEMP_CLIENT_GO_EXAMPLES_DIR}
@rm -rf ${CLIENT_GO_OUTPUT_DIR}
@docker run --rm -v ${PWD}/:/local openapitools/openapi-generator-cli:v7.1.0 generate \
@docker run --rm -u "$$(id -u):$$(id -g)" -v ${PWD}/:/local openapitools/openapi-generator-cli:v7.1.0 generate \
--input-spec /local/swagger.yaml \
--generator-name go \
--output /local/api/client_tmp/. \
Expand All @@ -215,13 +215,35 @@ TEMP_CLIENT_PYTHON_OUTPUT_DIR = ./python/sdk/client_tmp
.PHONY: generate-client-python
generate-client-python:
rm -rf ${CLIENT_PYTHON_OUTPUT_DIR}
@docker run --rm -v ${PWD}/:/local openapitools/openapi-generator-cli:v7.1.0 generate \
@docker run --rm -u "$$(id -u):$$(id -g)" -v ${PWD}/:/local openapitools/openapi-generator-cli:v7.1.0 generate \
--input-spec /local/swagger.yaml \
--generator-name python \
--output /local/python/sdk/. \
--config /local/openapi-sdk-codegen.yaml


# Generated OpenAPI client paths checked for drift against swagger.yaml.
# Scoped to the client directories so the untracked python/sdk/.openapi-generator/
# manifest (a sibling of client/, dropped by the generator) cannot false-positive.
GENERATED_CLIENT_PATHS = api/client python/sdk/client python/sdk/client_README.md
.PHONY: verify-client
verify-client: generate-client
@echo "Verifying generated OpenAPI clients are in sync with swagger.yaml ..."
@drift="$$(git status --porcelain -- ${GENERATED_CLIENT_PATHS})"; \
if [ -n "$$drift" ]; then \
echo ""; \
echo "ERROR: generated OpenAPI clients are out of sync with swagger.yaml."; \
echo "The following generated files differ from what is committed:"; \
echo "$$drift"; \
echo ""; \
git --no-pager diff -- ${GENERATED_CLIENT_PATHS}; \
echo ""; \
echo "Run 'make generate-client' and commit the regenerated clients."; \
exit 1; \
fi; \
echo "Generated OpenAPI clients are in sync with swagger.yaml."


.PHONY: generate-proto
generate-proto:
@echo "> Generating specification configuration from Proto file..."
Expand Down
88 changes: 80 additions & 8 deletions api/client/model_prediction_job_config.go

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

Loading
Loading