|
| 1 | +# SPDX-FileCopyrightText: 2025 SAP SE or an SAP affiliate company and IronCore contributors |
| 2 | +# SPDX-License-Identifier: Apache-2.0 |
| 3 | + |
| 4 | +name: Test |
| 5 | +on: |
| 6 | + push: |
| 7 | + branches: |
| 8 | + - main |
| 9 | + paths-ignore: |
| 10 | + - '**.md' |
| 11 | + pull_request: |
| 12 | + branches: |
| 13 | + - '*' |
| 14 | + paths-ignore: |
| 15 | + - '**.md' |
| 16 | + workflow_dispatch: {} |
| 17 | +permissions: |
| 18 | + contents: read |
| 19 | +jobs: |
| 20 | + test-chart: |
| 21 | + name: Chart |
| 22 | + runs-on: ubuntu-latest |
| 23 | + steps: |
| 24 | + - name: Check out code |
| 25 | + uses: actions/checkout@v4 |
| 26 | + - name: Set up Go |
| 27 | + uses: actions/setup-go@v5 |
| 28 | + with: |
| 29 | + check-latest: true |
| 30 | + go-version: 1.24.4 |
| 31 | + - name: Fetch latest kubectl version |
| 32 | + id: kubectl |
| 33 | + run: | |
| 34 | + KUBECTL_VERSION=$(curl -sL https://dl.k8s.io/release/stable.txt) |
| 35 | + echo "version=$KUBECTL_VERSION" >> $GITHUB_OUTPUT |
| 36 | + - name: Fetch latest kind version |
| 37 | + id: kind |
| 38 | + run: | |
| 39 | + KIND_VERSION=$(curl -s https://api.github.com/repos/kubernetes-sigs/kind/releases/latest | grep '"tag_name":' | cut -d'"' -f4) |
| 40 | + echo "version=$KIND_VERSION" >> $GITHUB_OUTPUT |
| 41 | + - name: Create k8s kind cluster |
| 42 | + uses: helm/kind-action@v1 |
| 43 | + with: |
| 44 | + version: ${{ steps.kind.outputs.version }} |
| 45 | + cluster_name: kind |
| 46 | + kubectl_version: ${{ steps.kubectl.outputs.version }} |
| 47 | + - name: Prepare network-operator |
| 48 | + run: | |
| 49 | + go mod tidy |
| 50 | + make docker-build IMG=network-operator:v0.1.0 |
| 51 | + kind load docker-image network-operator:v0.1.0 |
| 52 | + - name: Install Helm |
| 53 | + run: | |
| 54 | + curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash |
| 55 | + - name: Verify Helm installation |
| 56 | + run: helm version |
| 57 | + - name: Lint Helm Chart |
| 58 | + run: | |
| 59 | + helm lint ./charts/network-operator |
| 60 | +# TODO: Uncomment if cert-manager is enabled |
| 61 | +# - name: Install cert-manager via Helm |
| 62 | +# run: | |
| 63 | +# helm repo add jetstack https://charts.jetstack.io |
| 64 | +# helm repo update |
| 65 | +# helm install cert-manager jetstack/cert-manager --namespace cert-manager --create-namespace --set installCRDs=true |
| 66 | +# - name: Wait for cert-manager to be ready |
| 67 | +# run: | |
| 68 | +# kubectl wait --namespace cert-manager --for=condition=available --timeout=300s deployment/cert-manager |
| 69 | +# kubectl wait --namespace cert-manager --for=condition=available --timeout=300s deployment/cert-manager-cainjector |
| 70 | +# kubectl wait --namespace cert-manager --for=condition=available --timeout=300s deployment/cert-manager-webhook |
| 71 | +# TODO: Uncomment if Prometheus is enabled |
| 72 | +# - name: Install Prometheus Operator CRDs |
| 73 | +# run: | |
| 74 | +# helm repo add prometheus-community https://prometheus-community.github.io/helm-charts |
| 75 | +# helm repo update |
| 76 | +# helm install prometheus-crds prometheus-community/prometheus-operator-crds |
| 77 | +# - name: Install Prometheus via Helm |
| 78 | +# run: | |
| 79 | +# helm repo add prometheus-community https://prometheus-community.github.io/helm-charts |
| 80 | +# helm repo update |
| 81 | +# helm install prometheus prometheus-community/prometheus --namespace monitoring --create-namespace |
| 82 | +# - name: Wait for Prometheus to be ready |
| 83 | +# run: | |
| 84 | +# kubectl wait --namespace monitoring --for=condition=available --timeout=300s deployment/prometheus-server |
| 85 | + - name: Install Helm chart for project |
| 86 | + run: | |
| 87 | + helm install my-release ./charts/network-operator --create-namespace --namespace network-operator-system |
| 88 | + - name: Check Helm release status |
| 89 | + run: | |
| 90 | + helm status my-release --namespace network-operator-system |
| 91 | +# TODO: Uncomment if prometheus.enabled is set to true to confirm that the ServiceMonitor gets created |
| 92 | +# - name: Check Presence of ServiceMonitor |
| 93 | +# run: | |
| 94 | +# kubectl wait --namespace network-operator-system --for=jsonpath='{.kind}'=ServiceMonitor servicemonitor/network-operator-controller-manager-metrics-monitor |
0 commit comments