name: Test Central Dashboard
on:
  pull_request:
    paths:
    - tests/install_KinD_create_KinD_cluster_install_kustomize.sh
    - .github/workflows/centraldashboard_test.yaml
    - applications/centraldashboard/upstream/**
    - tests/istio*
    - common/istio*/**

permissions:
  contents: read
  actions: read

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - name: Checkout
      uses: actions/checkout@v4

    - name: Install KinD, Create KinD cluster and Install kustomize
      run: ./tests/install_KinD_create_KinD_cluster_install_kustomize.sh

    - name: Install Istio
      run: ./tests/istio-cni_install.sh

    - name: Create kubeflow namespace
      run: kustomize build common/kubeflow-namespace/base | kubectl apply -f -

    - name: Install central-dashboard
      run: |
        kustomize build applications/centraldashboard/upstream/overlays/kserve | kubectl apply -f -
        kubectl wait --for=condition=Ready pods --all --all-namespaces --timeout 180s
