|
| 1 | +name: Test Chart |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + pull_request: |
| 6 | + |
| 7 | +jobs: |
| 8 | + test-e2e: |
| 9 | + name: Run on Ubuntu |
| 10 | + runs-on: ubuntu-latest |
| 11 | + steps: |
| 12 | + - name: Clone the code |
| 13 | + uses: actions/checkout@v4 |
| 14 | + |
| 15 | + - name: Setup Go |
| 16 | + uses: actions/setup-go@v5 |
| 17 | + with: |
| 18 | + go-version-file: go.mod |
| 19 | + |
| 20 | + - name: Install the latest version of kind |
| 21 | + run: | |
| 22 | + curl -Lo ./kind https://kind.sigs.k8s.io/dl/latest/kind-linux-amd64 |
| 23 | + chmod +x ./kind |
| 24 | + sudo mv ./kind /usr/local/bin/kind |
| 25 | +
|
| 26 | + - name: Verify kind installation |
| 27 | + run: kind version |
| 28 | + |
| 29 | + - name: Create kind cluster |
| 30 | + run: kind create cluster |
| 31 | + |
| 32 | + - name: Prepare operation-cache-controller |
| 33 | + run: | |
| 34 | + go mod tidy |
| 35 | + make docker-build IMG=operation-cache-controller:v0.1.0 |
| 36 | + kind load docker-image operation-cache-controller:v0.1.0 |
| 37 | +
|
| 38 | + - name: Install Helm |
| 39 | + run: | |
| 40 | + curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash |
| 41 | +
|
| 42 | + - name: Verify Helm installation |
| 43 | + run: helm version |
| 44 | + |
| 45 | + - name: Lint Helm Chart |
| 46 | + run: | |
| 47 | + helm lint ./dist/chart |
| 48 | +
|
| 49 | +# TODO: Uncomment if cert-manager is enabled |
| 50 | +# - name: Install cert-manager via Helm |
| 51 | +# run: | |
| 52 | +# helm repo add jetstack https://charts.jetstack.io |
| 53 | +# helm repo update |
| 54 | +# helm install cert-manager jetstack/cert-manager --namespace cert-manager --create-namespace --set installCRDs=true |
| 55 | +# |
| 56 | +# - name: Wait for cert-manager to be ready |
| 57 | +# run: | |
| 58 | +# kubectl wait --namespace cert-manager --for=condition=available --timeout=300s deployment/cert-manager |
| 59 | +# kubectl wait --namespace cert-manager --for=condition=available --timeout=300s deployment/cert-manager-cainjector |
| 60 | +# kubectl wait --namespace cert-manager --for=condition=available --timeout=300s deployment/cert-manager-webhook |
| 61 | + |
| 62 | +# TODO: Uncomment if Prometheus is enabled |
| 63 | +# - name: Install Prometheus Operator CRDs |
| 64 | +# run: | |
| 65 | +# helm repo add prometheus-community https://prometheus-community.github.io/helm-charts |
| 66 | +# helm repo update |
| 67 | +# helm install prometheus-crds prometheus-community/prometheus-operator-crds |
| 68 | +# |
| 69 | +# - name: Install Prometheus via Helm |
| 70 | +# run: | |
| 71 | +# helm repo add prometheus-community https://prometheus-community.github.io/helm-charts |
| 72 | +# helm repo update |
| 73 | +# helm install prometheus prometheus-community/prometheus --namespace monitoring --create-namespace |
| 74 | +# |
| 75 | +# - name: Wait for Prometheus to be ready |
| 76 | +# run: | |
| 77 | +# kubectl wait --namespace monitoring --for=condition=available --timeout=300s deployment/prometheus-server |
| 78 | + |
| 79 | + - name: Install Helm chart for project |
| 80 | + run: | |
| 81 | + helm install my-release ./dist/chart --create-namespace --namespace operation-cache-controller-system |
| 82 | +
|
| 83 | + - name: Check Helm release status |
| 84 | + run: | |
| 85 | + helm status my-release --namespace operation-cache-controller-system |
| 86 | +
|
| 87 | +# TODO: Uncomment if prometheus.enabled is set to true to confirm that the ServiceMonitor gets created |
| 88 | +# - name: Check Presence of ServiceMonitor |
| 89 | +# run: | |
| 90 | +# kubectl wait --namespace operation-cache-controller-system --for=jsonpath='{.kind}'=ServiceMonitor servicemonitor/operation-cache-controller-controller-manager-metrics-monitor |
0 commit comments