name: Test Jupyter Web Application
on:
  pull_request:
    paths:
    - tests/install_KinD_create_KinD_cluster_install_kustomize.sh
    - .github/workflows/jupyter_web_application_test.yaml
    - applications/jupyter/jupyter-web-app/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: Build & Apply manifests
      run: |
        cd applications/jupyter/jupyter-web-app/upstream
        kubectl create ns kubeflow
        kustomize build overlays/istio | kubectl apply -f -
        kubectl wait --for=condition=Ready pods --all --all-namespaces --timeout 180s
