@@ -181,6 +181,23 @@ 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+ @make check-instill-sdk
187+ @make build-and-push-models
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+ @make build-and-push-models
197+ @make all EDITION=local-ce:test INITMODEL_ENABLED=true INITMODEL_PATH=${PWD} /integration-test/models/inventory.json
198+ @make wait-models-deploy
199+ @make down
200+
184201.PHONY : integration-test-latest
185202integration-test-latest : # Run integration test on the latest Instill Core
186203 @make build-latest
@@ -196,7 +213,7 @@ integration-test-latest: # Run integration test on the latest Instill Core
196213 @make down
197214
198215.PHONY : integration-test-release
199- integration-test-release : # Run integration test on the release Instill Core
216+ integration-test-release : # Run integration test on the released Instill Core
200217 @make build-release
201218 @make all EDITION=local-ce:test COMPONENT_ENV=${COMPONENT_TEST_ENV}
202219 @docker run --rm \
@@ -318,7 +335,7 @@ console-integration-test-latest: # Run console integration test on the latest
318335 @make down
319336
320337.PHONY : console-integration-test-release
321- console-integration-test-release : # Run console integration test on the release Instill Core
338+ console-integration-test-release : # Run console integration test on the released Instill Core
322339 @make all EDITION=local-ce:test INSTILL_CORE_HOST=${API_GATEWAY_HOST} COMPONENT_ENV=${COMPONENT_TEST_ENV}
323340 @docker run --rm \
324341 -e NEXT_PUBLIC_GENERAL_API_VERSION=v1beta \
@@ -491,6 +508,38 @@ endif
491508 @pkill -f "port-forward"
492509 @make down
493510
511+ .PHONY : build-and-push-models
512+ build-and-push-models : # Helper target to build and push models
513+ @python -c " import instill; print(instill.__version__)"
514+ @python3 -c ' import instill; import os.path; print(os.path.dirname(os.path.dirname(instill.__file__)))'
515+ @SDK_PATH=$$(python3 -c 'import instill; import os.path; print(os.path.dirname(os.path.dirname(instill.__file__ ) ))' 2>/dev/null || echo ""); \
516+ ./integration-test/scripts/build_and_push_models.sh \
517+ " $( PWD) /integration-test/models" \
518+ " localhost:5001" \
519+ " $$ SDK_PATH"
520+
521+ .PHONY : wait-models-deploy
522+ wait-models-deploy : # Helper target to wait for model deployment
523+ @model_count=$$(jq length integration-test/models/inventory.json ) ; \
524+ timeout=600; elapsed=0; spinner=' |/-\\' ; i=0; \
525+ 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 \
526+ 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' ); \
527+ printf " \r[Waiting %3ds/%ds] %c models still deploying... (%d/%d RUNNING)" " $$ elapsed" " $$ timeout" " $$ {spinner:i++%4:1}" " $$ running_count" " $$ model_count" ; \
528+ sleep 1; elapsed=$$((elapsed+1 ) ); \
529+ if [ " $$ elapsed" -ge " $$ timeout" ]; then \
530+ echo " \nTimeout waiting for models to deploy!" ; exit 1; \
531+ fi ; \
532+ done ; \
533+ echo " \nAll $$ model_count models deployed and running."
534+
535+ .PHONY : check-instill-sdk
536+ check-instill-sdk : # Helper target to check if instill-sdk is installed and show version or path if in editable mode
537+ @echo " Checking for instill-sdk installation..." >&2
538+ @if ! python3 -m pip show instill-sdk > /dev/null 2>&1 ; then \
539+ echo " instill-sdk is NOT installed." >&2 ; \
540+ false ; \
541+ fi
542+
494543.PHONY : help
495544help : # # Show this help
496545 @echo " \nMake Application with Instill Core"
0 commit comments