@@ -181,6 +181,24 @@ ps: ## List all service containers
181181top : # # Display all running service processes
182182 @EDITION= DEFAULT_USER_UID= docker compose top
183183
184+ .PHONY : integration-test-model-deploy-latest
185+ integration-test-model-deploy-latest : # Run integration test on the latest Instill Core to build, push and deploy dummy models
186+ @export INSTILL_PYTHON_SDK_LOCAL_PATH=$$(make check-instill-sdk ) ; \
187+ make build-and-push-models INSTILL_PYTHON_SDK_LOCAL_PATH=" $$ INSTILL_PYTHON_SDK_LOCAL_PATH"
188+ @make latest EDITION=local-ce:test
189+ @make latest EDITION=local-ce:test INITMODEL_ENABLED=true INITMODEL_PATH=${PWD} /integration-test/models/inventory.json
190+ @make wait-models-deploy
191+ @make down
192+
193+ .PHONY : integration-test-model-deploy-release
194+ integration-test-model-deploy-release : # Run integration test on the released Instill Core to build, push and deploy dummy models
195+ @make all EDITION=local-ce:test
196+ @export INSTILL_PYTHON_SDK_LOCAL_PATH=$$(make check-instill-sdk ) ; \
197+ make build-and-push-models INSTILL_PYTHON_SDK_LOCAL_PATH=" $$ INSTILL_PYTHON_SDK_LOCAL_PATH"
198+ @make all EDITION=local-ce:test INITMODEL_ENABLED=true INITMODEL_PATH=${PWD} /integration-test/models/inventory.json
199+ @make wait-models-deploy
200+ @make down
201+
184202.PHONY : integration-test-latest
185203integration-test-latest : # Run integration test on the latest Instill Core
186204 @make build-latest
@@ -196,7 +214,7 @@ integration-test-latest: # Run integration test on the latest Instill Core
196214 @make down
197215
198216.PHONY : integration-test-release
199- integration-test-release : # Run integration test on the release Instill Core
217+ integration-test-release : # Run integration test on the released Instill Core
200218 @make build-release
201219 @make all EDITION=local-ce:test COMPONENT_ENV=${COMPONENT_TEST_ENV}
202220 @docker run --rm \
@@ -318,7 +336,7 @@ console-integration-test-latest: # Run console integration test on the latest
318336 @make down
319337
320338.PHONY : console-integration-test-release
321- console-integration-test-release : # Run console integration test on the release Instill Core
339+ console-integration-test-release : # Run console integration test on the released Instill Core
322340 @make all EDITION=local-ce:test INSTILL_CORE_HOST=${API_GATEWAY_HOST} COMPONENT_ENV=${COMPONENT_TEST_ENV}
323341 @docker run --rm \
324342 -e NEXT_PUBLIC_GENERAL_API_VERSION=v1beta \
@@ -491,6 +509,40 @@ endif
491509 @pkill -f "port-forward"
492510 @make down
493511
512+ .PHONY : build-and-push-models
513+ build-and-push-models : # Helper target to build and push models
514+ @./integration-test/scripts/build_and_push_models.sh " ${PWD} /integration-test/models" localhost:5001 " ${INSTILL_PYTHON_SDK_LOCAL_PATH} "
515+
516+ .PHONY : wait-models-deploy
517+ wait-models-deploy : # Helper target to wait for model deployment
518+ @model_count=$$(jq length integration-test/models/inventory.json ) ; \
519+ timeout=600; elapsed=0; spinner=' |/-\\' ; i=0; \
520+ while [ " $$ (curl -s http://localhost:8265/api/serve/applications/ | jq " .applications | to_entries | map(select(.key | contains(\" dummy-\" )) | .value.status) | length == $$ model_count and all(. == \" RUNNING\" )" )" != " true" ]; do \
521+ running_count=$$(curl -s http://localhost:8265/api/serve/applications/ | jq '.applications | to_entries | map(select(.key | contains("dummy-" ) ) | .value.status) | map(select(. == " RUNNING" )) | length' ); \
522+ printf " \r[Waiting %3ds/%ds] %c models still deploying... (%d/%d RUNNING)" " $$ elapsed" " $$ timeout" " $$ {spinner:i++%4:1}" " $$ running_count" " $$ model_count" ; \
523+ sleep 1; elapsed=$$((elapsed+1 ) ); \
524+ if [ " $$ elapsed" -ge " $$ timeout" ]; then \
525+ echo " \nTimeout waiting for models to deploy!" ; exit 1; \
526+ fi ; \
527+ done ; \
528+ echo " \nAll $$ model_count models deployed and running."
529+
530+ .PHONY : check-instill-sdk
531+ check-instill-sdk : # Helper target to check if instill-sdk is installed and show version or path if in editable mode
532+ @echo " Checking for instill-sdk installation..."
533+ @if python3 -m pip show instill-sdk > /dev/null 2>&1 ; then \
534+ EDITABLE=$$(python3 -m pip show instill-sdk | grep 'Editable project location' ) ; \
535+ if [ -n " $$ EDITABLE" ]; then \
536+ PATH=$$(python3 -m pip show instill-sdk | awk -F': ' '/Editable project location: /{print $$2}' ) ; \
537+ echo " $$ PATH" ; \
538+ else \
539+ echo " " ; \
540+ fi \
541+ else \
542+ echo " instill-sdk is NOT installed." >&2 ; \
543+ false ; \
544+ fi
545+
494546.PHONY : help
495547help : # # Show this help
496548 @echo " \nMake Application with Instill Core"
0 commit comments