diff --git a/.github/actions/kfp-cluster/action.yml b/.github/actions/kfp-cluster/action.yml index b0942133cdb..fdcb7dbc2f2 100644 --- a/.github/actions/kfp-cluster/action.yml +++ b/.github/actions/kfp-cluster/action.yml @@ -19,8 +19,8 @@ runs: - name: Build images shell: bash - run: ./.github/resources/scripts/build-images.sh + run: make build-images - name: Deploy KFP shell: bash - run: ./.github/resources/scripts/deploy-kfp.sh + run: make deploy-kfp diff --git a/.github/actions/kfp-tekton-cluster/action.yml b/.github/actions/kfp-tekton-cluster/action.yml index 4c396305e43..47c15b86732 100644 --- a/.github/actions/kfp-tekton-cluster/action.yml +++ b/.github/actions/kfp-tekton-cluster/action.yml @@ -14,8 +14,8 @@ runs: - name: Build images shell: bash - run: ./.github/resources/scripts/build-images.sh + run: make build-images - name: Deploy KFP shell: bash - run: ./.github/resources/scripts/deploy-kfp-tekton.sh + run: make deploy-kfp-tekton diff --git a/.github/workflows/backend-visualization.yml b/.github/workflows/backend-visualization.yml index 7038278f619..ac0879ce4ee 100644 --- a/.github/workflows/backend-visualization.yml +++ b/.github/workflows/backend-visualization.yml @@ -23,4 +23,4 @@ jobs: python-version: '3.9' - name: Run tests - run: ./test/presubmit-backend-visualization.sh + run: make test-backend-visualization-test diff --git a/.github/workflows/backend.yml b/.github/workflows/backend.yml index c17ef0e33a7..41a0ba02651 100644 --- a/.github/workflows/backend.yml +++ b/.github/workflows/backend.yml @@ -40,31 +40,24 @@ jobs: python-version: '3.9' - name: Install sdk run: | - python3 -m venv .venv - . .venv/bin/activate - pip install -e sdk/python + make setup-backend-test - name: Create KFP cluster uses: ./.github/actions/kfp-tekton-cluster - name: "flip coin test" run: | - . .venv/bin/activate - TEST_SCRIPT="test-flip-coin.sh" ./.github/resources/scripts/e2e-test.sh + make test-backend-test-flip-coin - name: "static loop test" run: | - . .venv/bin/activate - TEST_SCRIPT="test-static-loop.sh" ./.github/resources/scripts/e2e-test.sh + make test-backend-test-static-loop - name: "dynamic loop test" run: | - . .venv/bin/activate - TEST_SCRIPT="test-dynamic-loop.sh" ./.github/resources/scripts/e2e-test.sh + make test-backend-test-dynamic-loop - name: "use env" run: | - . .venv/bin/activate - TEST_SCRIPT="test-env.sh" ./.github/resources/scripts/e2e-test.sh + make test-backend-test-env - name: "use volume" run: | - . .venv/bin/activate - TEST_SCRIPT="test-volume.sh" ./.github/resources/scripts/e2e-test.sh + make test-backend-test-volume - name: Collect test results if: always() uses: actions/upload-artifact@v4 diff --git a/.github/workflows/e2e-test.yml b/.github/workflows/e2e-test.yml index 2a89d87a97d..8e371c20351 100644 --- a/.github/workflows/e2e-test.yml +++ b/.github/workflows/e2e-test.yml @@ -37,12 +37,8 @@ jobs: with: k8s_version: ${{ matrix.k8s_version }} - - name: Forward API port - run: ./.github/resources/scripts/forward-port.sh "kubeflow" "ml-pipeline" 8888 8888 - - - name: Initialization tests v1 - working-directory: ./backend/test/initialization - run: go test -v ./... -namespace kubeflow -args -runIntegrationTests=true + - name: Forward Port and initialize tests v1 + run: make test-e2e-initialization-tests-v1 - name: Collect test results if: always() @@ -71,13 +67,8 @@ jobs: with: k8s_version: ${{ matrix.k8s_version }} - - - name: Forward API port - run: ./.github/resources/scripts/forward-port.sh "kubeflow" "ml-pipeline" 8888 8888 - - name: Initialization tests v2 - working-directory: ./backend/test/v2/initialization - run: go test -v ./... -namespace kubeflow -args -runIntegrationTests=true + run: make test-e2e-initialization-tests-v2 - name: Collect test results if: always() @@ -106,12 +97,8 @@ jobs: with: k8s_version: ${{ matrix.k8s_version }} - - name: Forward API port - run: ./.github/resources/scripts/forward-port.sh "kubeflow" "ml-pipeline" 8888 8888 - - name: API integration tests v1 - working-directory: ./backend/test/integration - run: go test -v ./... -namespace ${NAMESPACE} -args -runIntegrationTests=true + run: make test-e2e-api-integration-tests-v1 - name: Collect test results if: always() @@ -140,12 +127,8 @@ jobs: with: k8s_version: ${{ matrix.k8s_version }} - - name: Forward API port - run: ./.github/resources/scripts/forward-port.sh "kubeflow" "ml-pipeline" 8888 8888 - - name: API integration tests v2 - working-directory: ./backend/test/v2/integration - run: go test -v ./... -namespace ${NAMESPACE} -args -runIntegrationTests=true + run: make test-e2e-api-integration-tests-v2 - name: Collect test results if: always() diff --git a/.github/workflows/frontend.yml b/.github/workflows/frontend.yml index f7358f2fc15..0959cefe686 100644 --- a/.github/workflows/frontend.yml +++ b/.github/workflows/frontend.yml @@ -24,12 +24,6 @@ jobs: with: node-version: '22' - - name: Clean npm cache - run: npm cache clean --force - - - name: Install dependencies - run: cd ./frontend && npm ci - - name: Run Frontend Tests - run: cd ./frontend && npm run test:ci + run: make test-frontend diff --git a/.github/workflows/gcpc-modules-tests.yml b/.github/workflows/gcpc-modules-tests.yml index 7ce9f4145e3..4ca856c1aa7 100644 --- a/.github/workflows/gcpc-modules-tests.yml +++ b/.github/workflows/gcpc-modules-tests.yml @@ -21,36 +21,8 @@ jobs: with: python-version: 3.9 - - name: apt-get update - run: sudo apt-get update - - - name: Install protobuf-compiler - run: sudo apt-get install protobuf-compiler -y - - - name: Install setuptools - run: | - pip3 install setuptools - pip3 freeze - - - name: Install Wheel - run: pip3 install wheel==0.42.0 - - - name: Install python sdk - run: pip install sdk/python - - - name: Generate API proto files - working-directory: ./api - run: make clean python - - - name: Install kfp-pipeline-spec from source - run: | - python3 -m pip install api/v2alpha1/python - - - name: Install google-cloud component - run: pip install components/google-cloud - - - name: Install Pytest - run: pip install $(grep 'pytest==' sdk/python/requirements-dev.txt) + - name: Install requirements + run: make setup-grpc-modules-test - name: Run test - run: pytest ./test/gcpc-tests/run_all_gcpc_modules.py + run: make test-grpc-modules diff --git a/.github/workflows/kfp-kubernetes-execution-tests.yml b/.github/workflows/kfp-kubernetes-execution-tests.yml index 9e6c3a40291..53f61efd34f 100644 --- a/.github/workflows/kfp-kubernetes-execution-tests.yml +++ b/.github/workflows/kfp-kubernetes-execution-tests.yml @@ -33,47 +33,8 @@ jobs: with: k8s_version: ${{ matrix.k8s_version }} - - name: Forward API port - run: ./.github/resources/scripts/forward-port.sh "kubeflow" "ml-pipeline" 8888 8888 + - name: Install requirements + run: make setup-kfp-kubernetes-execution-tests-without-kfp - - name: apt-get update - run: sudo apt-get update - - - name: Install protobuf-compiler - run: sudo apt-get install protobuf-compiler -y - - - name: Install setuptools - run: | - pip3 install setuptools - pip3 freeze - - - name: Install Wheel - run: pip3 install wheel==0.42.0 - - - name: Install protobuf - run: pip3 install protobuf==4.25.3 - - - name: Generate API proto files - working-directory: ./api - run: make clean python - - - name: Install kfp-pipeline-spec from source - run: | - python3 -m pip install api/v2alpha1/python - - - name: Generate kfp-kubernetes proto files from source - working-directory: ./kubernetes_platform - run: make clean python - - - name: Install kfp-kubernetes from source - run: | - pip install -e ./kubernetes_platform/python[dev] - - - name: Install requirements - run: pip install -r ./test/kfp-kubernetes-execution-tests/requirements.txt - - - name: Run tests - run: | - export KFP_ENDPOINT="http://localhost:8888" - export TIMEOUT_SECONDS=2700 - pytest ./test/kfp-kubernetes-execution-tests/sdk_execution_tests.py --asyncio-task-timeout $TIMEOUT_SECONDS + - name: Forward port and run tests + run: make test-kfp-kubernetes-execution-tests diff --git a/.github/workflows/kfp-kubernetes-library-test.yml b/.github/workflows/kfp-kubernetes-library-test.yml index f1a7d103ceb..4cd1bd5f2b0 100644 --- a/.github/workflows/kfp-kubernetes-library-test.yml +++ b/.github/workflows/kfp-kubernetes-library-test.yml @@ -33,4 +33,4 @@ jobs: python-version: ${{matrix.python.version}} - name: Run tests - run: ./test/presubmit-test-kfp-kubernetes-library.sh + run: make test-kfp-kubernetes-library-test diff --git a/.github/workflows/kfp-samples.yml b/.github/workflows/kfp-samples.yml index 98fb96f899a..c1af8c19fca 100644 --- a/.github/workflows/kfp-samples.yml +++ b/.github/workflows/kfp-samples.yml @@ -36,9 +36,6 @@ jobs: with: k8s_version: ${{ matrix.k8s_version }} - - name: Forward API port - run: ./.github/resources/scripts/forward-port.sh "kubeflow" "ml-pipeline" 8888 8888 - - - name: Run Samples Tests + - name: Forward port and run samples tests run: | - ./backend/src/v2/test/sample-test.sh + make test-kfp-samples diff --git a/.github/workflows/kfp-sdk-runtime-tests.yml b/.github/workflows/kfp-sdk-runtime-tests.yml index 3403936c161..ded0be8b4e7 100644 --- a/.github/workflows/kfp-sdk-runtime-tests.yml +++ b/.github/workflows/kfp-sdk-runtime-tests.yml @@ -28,4 +28,4 @@ jobs: - name: Run KFP Runtime Code Tests run: | export PULL_NUMBER="${{ github.event.inputs.pull_number || github.event.pull_request.number }}" - ./test/presubmit-test-kfp-runtime-code.sh + make test-kfp-sdk-runtime-tests diff --git a/.github/workflows/kfp-sdk-tests.yml b/.github/workflows/kfp-sdk-tests.yml index 0fb6f85dae6..993240219ac 100644 --- a/.github/workflows/kfp-sdk-tests.yml +++ b/.github/workflows/kfp-sdk-tests.yml @@ -27,5 +27,4 @@ jobs: python-version: ${{ matrix.python }} - name: Run SDK Tests - run: | - ./test/presubmit-tests-sdk.sh + run: make test-kfp-sdk-tests diff --git a/.github/workflows/kubeflow-pipelines-manifests.yml b/.github/workflows/kubeflow-pipelines-manifests.yml index d494e2e0d0a..2fe20e7b51c 100644 --- a/.github/workflows/kubeflow-pipelines-manifests.yml +++ b/.github/workflows/kubeflow-pipelines-manifests.yml @@ -16,4 +16,4 @@ jobs: uses: actions/checkout@v4 - name: Run tests - run: ./manifests/kustomize/hack/presubmit.sh + run: make test-kubeflow-pipelines-manifests diff --git a/.github/workflows/periodic.yml b/.github/workflows/periodic.yml index 44bc1e5f25a..54a681f0739 100644 --- a/.github/workflows/periodic.yml +++ b/.github/workflows/periodic.yml @@ -22,13 +22,10 @@ jobs: uses: ./.github/actions/kfp-cluster with: k8s_version: ${{ matrix.k8s_version }} - - name: Port forward kfp apiserver - run: | - nohup kubectl port-forward --namespace kubeflow svc/ml-pipeline 8888:8888 & - - name: Run Functional Tests - run: | - log_dir=$(mktemp -d) - ./test/kfp-functional-test/kfp-functional-test.sh > $log_dir/periodic_tests.txt + + - name: Port forward and run Functional Tests + run: make test-periodic-test + - name: Collect test results if: always() uses: actions/upload-artifact@v4 diff --git a/.github/workflows/presubmit-backend.yml b/.github/workflows/presubmit-backend.yml index 5ca27fb6aaf..5c96f986e4e 100644 --- a/.github/workflows/presubmit-backend.yml +++ b/.github/workflows/presubmit-backend.yml @@ -10,6 +10,7 @@ on: paths: - 'backend/**' - 'test/presubmit-backend-test.sh' + - '.github/workflows/presubmit-backend.yml' jobs: backend-tests: @@ -25,4 +26,4 @@ jobs: go-version-file: go.mod - name: Run Backend Tests - run: ./test/presubmit-backend-test.sh + run: make test-presubmit-backend diff --git a/.github/workflows/sdk-component-yaml.yml b/.github/workflows/sdk-component-yaml.yml index 11adbcfe1f3..a416b077f86 100644 --- a/.github/workflows/sdk-component-yaml.yml +++ b/.github/workflows/sdk-component-yaml.yml @@ -24,33 +24,8 @@ jobs: with: python-version: 3.9 - - name: apt-get update - run: sudo apt-get update - - - name: Install protobuf-compiler - run: sudo apt-get install protobuf-compiler -y - - - name: Install setuptools - run: | - pip3 install setuptools - pip3 freeze - - - name: Install Wheel - run: pip3 install wheel==0.42.0 - - - name: Install protobuf - run: pip3 install protobuf==4.25.3 - - - name: Generate API proto files - working-directory: ./api - run: make clean python - - - name: Install kfp-pipeline-spec from source - run: | - python3 -m pip install api/v2alpha1/python - - name: Install requirements - run: pip install -r ./test/sdk-execution-tests/requirements.txt + run: make setup-sdk-component-yaml - name: Run component YAML tests - run: ./test/presubmit-component-yaml.sh + run: make test-sdk-component-yaml diff --git a/.github/workflows/sdk-docformatter.yml b/.github/workflows/sdk-docformatter.yml index 12b1c29d705..9fe15a120eb 100644 --- a/.github/workflows/sdk-docformatter.yml +++ b/.github/workflows/sdk-docformatter.yml @@ -23,4 +23,4 @@ jobs: python-version: 3.9 - name: Run docformatter tests - run: ./test/presubmit-docformatter-sdk.sh + run: make test-sdk-docformatter diff --git a/.github/workflows/sdk-execution.yml b/.github/workflows/sdk-execution.yml index db64992621e..6942ea2c1ba 100644 --- a/.github/workflows/sdk-execution.yml +++ b/.github/workflows/sdk-execution.yml @@ -33,39 +33,10 @@ jobs: with: k8s_version: ${{ matrix.k8s_version }} - - name: Forward API port - run: ./.github/resources/scripts/forward-port.sh "kubeflow" "ml-pipeline" 8888 8888 - - - name: apt-get update - run: sudo apt-get update - - - name: Install protobuf-compiler - run: sudo apt-get install protobuf-compiler -y - - - name: Install setuptools - run: | - pip3 install setuptools - pip3 freeze - - - name: Install Wheel - run: pip3 install wheel==0.42.0 - - - name: Install protobuf - run: pip3 install protobuf==4.25.3 - - - name: Generate API proto files - working-directory: ./api - run: make clean python - - - name: Install kfp-pipeline-spec from source - run: | - python3 -m pip install api/v2alpha1/python - + # Same as sdk-component requirements - name: Install requirements - run: pip install -r ./test/sdk-execution-tests/requirements.txt + run: make setup-sdk-component-yaml - - name: Run tests + - name: Forward API port and run tests run: | - export KFP_ENDPOINT="http://localhost:8888" - export TIMEOUT_SECONDS=2700 - pytest ./test/sdk-execution-tests/sdk_execution_tests.py --asyncio-task-timeout $TIMEOUT_SECONDS + make test-sdk-execution diff --git a/.github/workflows/sdk-isort.yml b/.github/workflows/sdk-isort.yml index 527cff1096a..6edf0909ff5 100644 --- a/.github/workflows/sdk-isort.yml +++ b/.github/workflows/sdk-isort.yml @@ -23,4 +23,4 @@ jobs: python-version: 3.9 - name: Run isort tests - run: ./test/presubmit-isort-sdk.sh + run: make test-sdk-isort diff --git a/.github/workflows/sdk-upgrade.yml b/.github/workflows/sdk-upgrade.yml index e35b7358ceb..f36f6cefa12 100644 --- a/.github/workflows/sdk-upgrade.yml +++ b/.github/workflows/sdk-upgrade.yml @@ -23,4 +23,4 @@ jobs: python-version: 3.9 - name: Run SDK upgrade tests - run: ./test/presubmit-test-sdk-upgrade.sh + run: make test-sdk-upgrade diff --git a/.github/workflows/sdk-yapf.yml b/.github/workflows/sdk-yapf.yml index b1c46085ea3..c93b451710d 100644 --- a/.github/workflows/sdk-yapf.yml +++ b/.github/workflows/sdk-yapf.yml @@ -29,8 +29,8 @@ jobs: with: python-version: '3.9' - - name: Install dependencies - run: pip install yapf + - name: Install requirements + run: make setup-sdk-yapf - name: Run YAPF SDK Tests - run: ./test/presubmit-yapf-sdk.sh + run: make test-sdk-yapf \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 00000000000..5228060c5fa --- /dev/null +++ b/Makefile @@ -0,0 +1,176 @@ +SHELL := /bin/bash + +include ./Makefile.setup.mk + +.PHONY: setup-python +setup-python: + python3 -m venv .venv && \ + source .venv/bin/activate + +.PHONY: test-go-unittest +test-go-unittest: + go test -v -cover ./backend/... + +.PHONY: test-backend-test +test-backend-test: + source .venv/bin/activate && \ + TEST_SCRIPT="test-flip-coin.sh" ./.github/resources/scripts/e2e-test.sh && \ + TEST_SCRIPT="test-static-loop.sh" ./.github/resources/scripts/e2e-test.sh && \ + TEST_SCRIPT="test-dynamic-loop.sh" ./.github/resources/scripts/e2e-test.sh && \ + TEST_SCRIPT="test-env.sh" ./.github/resources/scripts/e2e-test.sh && \ + TEST_SCRIPT="test-volume.sh" ./.github/resources/scripts/e2e-test.sh + +.PHONY: test-backend-test-flip-coin +test-backend-test-flip-coin: + source .venv/bin/activate && \ + TEST_SCRIPT="test-flip-coin.sh" && source ./.github/resources/scripts/e2e-test.sh + +.PHONY: test-backend-test-static-loop +test-backend-test-static-loop: + source .venv/bin/activate && \ + TEST_SCRIPT="test-static-loop.sh" && source ./.github/resources/scripts/e2e-test.sh + +.PHONY: test-backend-test-dynamic-loop +test-backend-test-dynamic-loop: + source .venv/bin/activate && \ + TEST_SCRIPT="test-dynamic-loop.sh" && source ./.github/resources/scripts/e2e-test.sh + +.PHONY: test-backend-test-env +test-backend-test-env: + source .venv/bin/activate && \ + TEST_SCRIPT="test-env.sh" && source ./.github/resources/scripts/e2e-test.sh + +.PHONY: test-backend-test-volume +test-backend-test-volume: + source .venv/bin/activate && \ + TEST_SCRIPT="test-volume.sh" && source ./.github/resources/scripts/e2e-test.sh + +.PHONY: test-backend-visualization-test +test-backend-visualization-test: + ./test/presubmit-backend-visualization.sh + +.PHONY: test-e2e-initialization-tests-v1 +test-e2e-initialization-tests-v1: + ./.github/resources/scripts/forward-port.sh "kubeflow" "ml-pipeline" 8888 8888 && \ + cd ./backend/test/initialization && \ + go test -v ./... -namespace kubeflow -args -runIntegrationTests=true + +.PHONY: test-e2e-initialization-tests-v2 +test-e2e-initialization-tests-v2: + ./.github/resources/scripts/forward-port.sh "kubeflow" "ml-pipeline" 8888 8888 && \ + cd ./backend/test/v2/initialization && \ + go test -v ./... -namespace kubeflow -args -runIntegrationTests=true + +.PHONY: test-e2e-api-integration-tests-v1 +test-e2e-api-integration-tests-v1: + ./.github/resources/scripts/forward-port.sh "kubeflow" "ml-pipeline" 8888 8888 && \ + cd ./backend/test/integration && \ + go test -v ./... -namespace ${NAMESPACE} -args -runIntegrationTests=true + +.PHONY: test-e2e-api-integration-tests-v2 +test-e2e-api-integration-tests-v2: + ./.github/resources/scripts/forward-port.sh "kubeflow" "ml-pipeline" 8888 8888 && \ + cd ./backend/test/v2/integration && \ + go test -v ./... -namespace ${NAMESPACE} -args -runIntegrationTests=true + +.PHONY: test-e2e-frontend-integration-test +test-e2e-frontend-integration-test: + ./.github/resources/scripts/forward-port.sh "kubeflow" "ml-pipeline" 8888 8888 && \ + ./.github/resources/scripts/forward-port.sh "kubeflow" "ml-pipeline-ui" 3000 3000 && \ + cd ./test/frontend-integration-test && \ + docker build . -t kfp-frontend-integration-test:local && \ + docker run --net=host kfp-frontend-integration-test:local --remote-run true + +.PHONY: test-e2e-basic-sample-tests +test-e2e-basic-sample-tests: + $(MAKE) setup-python && \ + ./.github/resources/scripts/forward-port.sh "kubeflow" "ml-pipeline" 8888 8888 && \ + pip3 install -r ./test/sample-test/requirements.txt && \ + python3 ./test/sample-test/sample_test_launcher.py sample_test run_test --namespace kubeflow --test-name sequential --results-gcs-dir output && \ + python3 ./test/sample-test/sample_test_launcher.py sample_test run_test --namespace kubeflow --test-name exit_handler --expected-result failed --results-gcs-dir output + +.PHONY: test-frontend +test-frontend: + npm cache clean --force && \ + cd ./frontend && npm ci && \ + npm run test:ci + +.PHONY: test-grpc-modules +test-grpc-modules: + $(MAKE) setup-python && \ + pytest ./test/gcpc-tests/run_all_gcpc_modules.py + +.PHONY: test-kfp-kubernetes-execution-tests +test-kfp-kubernetes-execution-tests: + $(MAKE) setup-python && \ + ./.github/resources/scripts/forward-port.sh "kubeflow" "ml-pipeline" 8888 8888 && \ + export KFP_ENDPOINT="http://localhost:8888" && \ + export TIMEOUT_SECONDS=2700 && \ + pytest ./test/kfp-kubernetes-execution-tests/sdk_execution_tests.py --asyncio-task-timeout $$TIMEOUT_SECONDS + +.PHONY: test-kfp-kubernetes-library-test +test-kfp-kubernetes-library-test: + ./test/presubmit-test-kfp-kubernetes-library.sh + +.PHONY: test-kfp-samples +test-kfp-samples: + $(MAKE) setup-python && \ + ./.github/resources/scripts/forward-port.sh "kubeflow" "ml-pipeline" 8888 8888 && \ + ./backend/src/v2/test/sample-test.sh + +.PHONY: test-kfp-sdk-runtime-tests +test-kfp-sdk-runtime-tests: + $(MAKE) setup-python && \ + ./test/presubmit-test-kfp-runtime-code.sh + +.PHONY: test-kfp-sdk-tests +test-kfp-sdk-tests: + ./test/presubmit-tests-sdk.sh + +.PHONY: test-kubeflow-pipelines-manifests +test-kubeflow-pipelines-manifests: + ./manifests/kustomize/hack/presubmit.sh + +.PHONY: test-periodic-test +test-periodic-test: + $(MAKE) setup-python && \ + nohup kubectl port-forward --namespace kubeflow svc/ml-pipeline 8888:8888 > kubectl-port-forward.log 2>&1 & \ + log_dir=$$(mktemp -d) && \ + ./test/kfp-functional-test/kfp-functional-test.sh > $$log_dir/periodic_tests.txt + +.PHONY: test-presubmit-backend +test-presubmit-backend: + ./test/presubmit-backend-test.sh + +.PHONY: test-sdk-component-yaml +test-sdk-component-yaml: + $(MAKE) setup-python && \ + ./test/presubmit-component-yaml.sh + +.PHONY: test-sdk-docformatter +test-sdk-docformatter: + $(MAKE) setup-python && \ + ./test/presubmit-docformatter-sdk.sh + +.PHONY: test-sdk-execution +test-sdk-execution: + $(MAKE) setup-python && \ + ./.github/resources/scripts/forward-port.sh "kubeflow" "ml-pipeline" 8888 8888 && \ + export KFP_ENDPOINT="http://localhost:8888" && \ + export TIMEOUT_SECONDS=2700 && \ + pytest ./test/sdk-execution-tests/sdk_execution_tests.py --asyncio-task-timeout $$TIMEOUT_SECONDS + +.PHONY: test-sdk-isort +test-sdk-isort: + $(MAKE) setup-python && \ + ./test/presubmit-isort-sdk.sh + +.PHONY: test-sdk-upgrade +test-sdk-upgrade: + $(MAKE) setup-python && \ + ./test/presubmit-test-sdk-upgrade.sh + +.PHONY: test-sdk-yapf +test-sdk-yapf: + $(MAKE) setup-python && \ + ./test/presubmit-yapf-sdk.sh \ No newline at end of file diff --git a/Makefile.setup.mk b/Makefile.setup.mk new file mode 100644 index 00000000000..df208bdc6b3 --- /dev/null +++ b/Makefile.setup.mk @@ -0,0 +1,170 @@ +SHELL := /bin/bash + +.PHONY: create-kind-cluster +create-kind-cluster: + kind create cluster --name kfp --image kindest/node:v1.29.2 --wait 5m && \ + kubectl version --client --short + +.PHONY: build-images +build-images: + ./.github/resources/scripts/build-images.sh + +.PHONY: deploy-kfp-tekton +deploy-kfp-tekton: + ./.github/resources/scripts/deploy-kfp-tekton.sh + +.PHONY: setup-kfp-tekton +setup-kfp-tekton: + $(MAKE) build-images && \ + $(MAKE) deploy-kfp-tekton + +.PHONY: deploy-kfp +deploy-kfp: + ./.github/resources/scripts/deploy-kfp.sh + +.PHONY: setup-kfp +setup-kfp: + $(MAKE) build-images && \ + $(MAKE) deploy-kfp + +.PHONY: setup-python +setup-python: + python3 -m venv .venv && \ + source .venv/bin/activate + +.PHONY: setup-backend-test +setup-backend-test: + python3 -m venv .venv && \ + source .venv/bin/activate && \ + pip install -e sdk/python + +.PHONY: setup-backend-visualization-test +setup-backend-visualization-test: + $(MAKE) setup-python + +.PHONY: setup-frontend-test +setup-frontend-test: + npm cache clean --force && \ + cd ./frontend && npm ci + +.PHONY: setup-grpc-modules-test +setup-grpc-modules-test: + $(MAKE) setup-python && \ + sudo apt-get update && \ + sudo apt-get install protobuf-compiler -y && \ + pip3 install setuptools && \ + pip3 freeze && \ + pip3 install wheel==0.42.0 && \ + pip install sdk/python && \ + cd ./api && \ + make clean python && \ + cd .. && \ + python3 -m pip install api/v2alpha1/python && \ + pip install components/google-cloud && \ + pip install $(shell grep 'pytest==' sdk/python/requirements-dev.txt) && \ + pytest ./test/gcpc-tests/run_all_gcpc_modules.py + +.PHONY: setup-kfp-kubernetes-execution-tests +setup-kfp-kubernetes-execution-tests: + $(MAKE) setup-kfp && \ + $(MAKE) setup-python && \ + sudo apt-get update && \ + sudo apt-get install protobuf-compiler -y && \ + pip3 install setuptools && \ + pip3 freeze && \ + pip3 install wheel==0.42.0 && \ + pip3 install protobuf==4.25.3 && \ + cd ./api && \ + make clean python && \ + cd .. && \ + python3 -m pip install api/v2alpha1/python && \ + cd ./kubernetes_platform && \ + make clean python && \ + cd .. && \ + pip install -e ./kubernetes_platform/python[dev] && \ + pip install -r ./test/kfp-kubernetes-execution-tests/requirements.txt + +.PHONY: setup-kfp-kubernetes-execution-tests-without-kfp +setup-kfp-kubernetes-execution-tests-without-kfp: + $(MAKE) setup-python && \ + sudo apt-get update && \ + sudo apt-get install protobuf-compiler -y && \ + pip3 install setuptools && \ + pip3 freeze && \ + pip3 install wheel==0.42.0 && \ + pip3 install protobuf==4.25.3 && \ + cd ./api && \ + make clean python && \ + cd .. && \ + python3 -m pip install api/v2alpha1/python && \ + cd ./kubernetes_platform && \ + make clean python && \ + cd .. && \ + pip install -e ./kubernetes_platform/python[dev] && \ + pip install -r ./test/kfp-kubernetes-execution-tests/requirements.txt + +.PHONY: setup-kfp-samples +setup-kfp-samples: + $(MAKE) setup-python && \ + $(MAKE) setup-kfp + +.PHONY: setup-kfp-sdk-runtime-tests +setup-kfp-sdk-runtime-tests: + $(MAKE) setup-python + +.PHONY: setup-kfp-sdk-tests +setup-kfp-sdk-tests: + $(MAKE) setup-python + +.PHONY: setup-periodic-test +setup-periodic-test: + $(MAKE) setup-kfp && \ + $(MAKE) setup-python + +.PHONY: setup-sdk-component-yaml +setup-sdk-component-yaml: + $(MAKE) setup-python && \ + sudo apt-get update && \ + sudo apt-get install protobuf-compiler -y && \ + pip3 install setuptools && \ + pip3 freeze && \ + pip3 install wheel==0.42.0 && \ + pip3 install protobuf==4.25.3 && \ + cd ./api && \ + make clean python && \ + cd .. && \ + python3 -m pip install api/v2alpha1/python && \ + pip install -r ./test/sdk-execution-tests/requirements.txt + +.PHONY: setup-sdk-docformatter +setup-sdk-docformatter: + $(MAKE) setup-python + +.PHONY: setup-sdk-execution +setup-sdk-execution: + $(MAKE) setup-python && \ + $(MAKE) setup-kfp && \ + sudo apt-get update && \ + sudo apt-get install protobuf-compiler -y && \ + pip3 install setuptools && \ + pip3 freeze && \ + pip3 install wheel==0.42.0 && \ + pip3 install protobuf==4.25.3 && \ + cd ./api && \ + make clean python && \ + cd .. && \ + python3 -m pip install api/v2alpha1/python && \ + pip install -r ./test/sdk-execution-tests/requirements.txt + +.PHONY: setup-sdk-isort +setup-sdk-isort: + $(MAKE) setup-python + +.PHONY: setup-sdk-upgrade +setup-sdk-upgrade: + $(MAKE) setup-python + +.PHONY: setup-sdk-yapf +setup-sdk-yapf: + $(MAKE) setup-python && \ + pip install yapf \ No newline at end of file diff --git a/test/README.md b/test/README.md index ec9cc7dd49f..b68a52fbebf 100644 --- a/test/README.md +++ b/test/README.md @@ -71,7 +71,7 @@ Tests are automatically triggered on GitHub when: GitHub Actions workflows are defined in the `.github/workflows/` directory. -### Reproducing CI Steps Locally +### Reproducing CI Steps Locally with Make Commands To replicate the steps locally: @@ -84,6 +84,10 @@ To replicate the steps locally: 3. To mimic the GitHub Actions environment, export any required environment variables found in the workflow files. +4. Install the necessary dependencies for the test by running the command `make setup-{test_name}`. The steps for setting up dependencies are defined in the `Makefile.setup.mk` file. + +5. Execute the test using command `make {test_name}` , all the test that can be run using Make commands are mentioned in `Makefile`. + * * * * * Troubleshooting