CI #872
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| schedule: | |
| # Nightly K8s-version-matrix smoke at 04:17 UTC. Off-peak slot avoids | |
| # contention with US/EU working-hours PR traffic and the lint cache. | |
| - cron: '17 4 * * *' | |
| permissions: | |
| contents: read | |
| jobs: | |
| validate-yaml-json: | |
| name: Validate YAML/JSON | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up promtool | |
| env: | |
| PROMETHEUS_VERSION: 2.55.1 | |
| run: | | |
| set -euo pipefail | |
| mkdir -p /tmp/prometheus | |
| asset="prometheus-${PROMETHEUS_VERSION}.linux-amd64.tar.gz" | |
| base_url="https://github.com/prometheus/prometheus/releases/download/v${PROMETHEUS_VERSION}" | |
| curl -sSLO "${base_url}/${asset}" | |
| curl -sSLO "${base_url}/sha256sums.txt" | |
| grep " ${asset}$" sha256sums.txt | sha256sum -c - | |
| tar -xzf "${asset}" --strip-components=1 -C /tmp/prometheus "prometheus-${PROMETHEUS_VERSION}.linux-amd64/promtool" | |
| echo "/tmp/prometheus" >> "${GITHUB_PATH}" | |
| - name: Validate YAML and Grafana JSON | |
| run: make validate-yaml-json | |
| markdown-links: | |
| name: Markdown links | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Check local Markdown links | |
| run: make check-markdown-links | |
| examples: | |
| name: Examples | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: go.mod | |
| cache: true | |
| - name: Execute example scripts | |
| run: make check-examples | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: go.mod | |
| cache: true | |
| - name: golangci-lint | |
| uses: golangci/golangci-lint-action@v9 | |
| with: | |
| version: v2.12.2 | |
| args: --timeout=5m | |
| build: | |
| name: Build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: go.mod | |
| cache: true | |
| - name: Generate | |
| run: make generate | |
| - name: Build | |
| run: make build | |
| - name: Verify no diff after generate | |
| run: | | |
| git diff --exit-code || (echo "Generated files are out of date. Run 'make generate'." && exit 1) | |
| test: | |
| name: Test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: go.mod | |
| cache: true | |
| - name: Run tests | |
| run: make test | |
| - name: Upload coverage | |
| uses: actions/upload-artifact@v7 | |
| if: always() | |
| with: | |
| name: coverage | |
| path: cover.out | |
| conformance: | |
| name: Conformance | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: go.mod | |
| cache: true | |
| - name: Run reference conformance suites | |
| run: make conformance | |
| - name: Verify hello-world custom-substrate proof | |
| run: make conformance-hello-world | |
| cli-smoke: | |
| name: CLI Smoke and Stress | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: go.mod | |
| cache: true | |
| - name: Run CLI smoke and stress tests | |
| run: make cli-smoke cli-stress | |
| install-render: | |
| name: Install Render | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up Helm | |
| uses: azure/setup-helm@v5 | |
| - name: Set up kubectl | |
| uses: azure/setup-kubectl@v5 | |
| - name: Verify install render | |
| run: scripts/verify-install.sh render | |
| kind-smoke: | |
| name: Kind Install Smoke | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| if: github.event_name == 'pull_request' | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up Helm | |
| uses: azure/setup-helm@v5 | |
| - name: Set up kubectl | |
| uses: azure/setup-kubectl@v5 | |
| - name: Set up kind | |
| uses: helm/kind-action@v1 | |
| with: | |
| install_only: true | |
| - name: Install chart and run quickstart smoke | |
| env: | |
| KAPRO_CI_KEEP_CLUSTER_ON_FAILURE: "true" | |
| KAPRO_CI_QUICKSTARTS: direct,flux,argo,oci | |
| run: scripts/ci-kind-smoke.sh | |
| - name: Collect Kind smoke diagnostics | |
| if: failure() | |
| run: | | |
| mkdir -p kind-smoke-diagnostics | |
| kind export logs --name kapro-ci-smoke kind-smoke-diagnostics/kind || true | |
| kubectl --context kind-kapro-ci-smoke get events -A --sort-by=.lastTimestamp > kind-smoke-diagnostics/events.txt || true | |
| kubectl --context kind-kapro-ci-smoke get all -A -o wide > kind-smoke-diagnostics/all.txt || true | |
| kubectl --context kind-kapro-ci-smoke get substrates.kapro.io,fleets.kapro.io,clusters.kapro.io,plans.kapro.io,promotions.kapro.io,promotionruns.runtime.kapro.io,targets.runtime.kapro.io -A -o yaml > kind-smoke-diagnostics/kapro-resources.yaml || true | |
| kubectl --context kind-kapro-ci-smoke -n kapro-system logs deploy/kapro-kapro-operator --tail=-1 > kind-smoke-diagnostics/operator.log || true | |
| - name: Upload Kind smoke diagnostics | |
| if: failure() | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: kind-smoke-diagnostics | |
| path: kind-smoke-diagnostics/ | |
| release-smoke: | |
| name: Release Smoke | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up Helm | |
| uses: azure/setup-helm@v5 | |
| - name: Verify release packaging | |
| run: VERSION=v0.6.0 make release-smoke | |
| docker: | |
| name: Docker Build (dry-run) | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| if: github.event_name == 'pull_request' | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v4 | |
| - name: Build operator image (no push) | |
| uses: docker/build-push-action@v7 | |
| with: | |
| context: . | |
| file: build/package/Dockerfile.operator | |
| platforms: linux/amd64 | |
| push: false | |
| tags: ghcr.io/kapro-dev/kapro-operator:pr-${{ github.event.number }} | |
| - name: Build cluster-controller image (no push) | |
| uses: docker/build-push-action@v7 | |
| with: | |
| context: . | |
| file: build/package/Dockerfile.cluster-controller | |
| platforms: linux/amd64 | |
| push: false | |
| tags: ghcr.io/kapro-dev/kapro-cluster-controller:pr-${{ github.event.number }} | |
| kind-smoke-matrix: | |
| # K8s version matrix for the Kind install smoke. Runs nightly on | |
| # schedule and on-demand via workflow_dispatch. The single-version | |
| # Kind Install Smoke job above runs on pull requests. | |
| name: Kind Smoke (K8s ${{ matrix.k8s }}) | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 25 | |
| if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| k8s: | |
| - v1.28.13 | |
| - v1.29.8 | |
| - v1.30.4 | |
| - v1.31.0 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up Helm | |
| uses: azure/setup-helm@v5 | |
| - name: Set up kubectl | |
| uses: azure/setup-kubectl@v5 | |
| - name: Set up kind | |
| uses: helm/kind-action@v1 | |
| with: | |
| install_only: true | |
| - name: Install chart and run quickstart smoke | |
| env: | |
| KAPRO_CI_KIND_IMAGE: kindest/node:${{ matrix.k8s }} | |
| KAPRO_CI_KIND_CLUSTER: kapro-ci-${{ matrix.k8s }} | |
| KAPRO_CI_KEEP_CLUSTER_ON_FAILURE: "true" | |
| KAPRO_CI_QUICKSTARTS: direct,flux,argo,oci | |
| run: scripts/ci-kind-smoke.sh | |
| - name: Collect Kind smoke diagnostics | |
| if: failure() | |
| env: | |
| KAPRO_CI_KIND_CLUSTER: kapro-ci-${{ matrix.k8s }} | |
| run: | | |
| mkdir -p kind-smoke-diagnostics | |
| kind export logs --name "${KAPRO_CI_KIND_CLUSTER}" kind-smoke-diagnostics/kind || true | |
| kubectl --context "kind-${KAPRO_CI_KIND_CLUSTER}" get events -A --sort-by=.lastTimestamp > kind-smoke-diagnostics/events.txt || true | |
| kubectl --context "kind-${KAPRO_CI_KIND_CLUSTER}" get all -A -o wide > kind-smoke-diagnostics/all.txt || true | |
| kubectl --context "kind-${KAPRO_CI_KIND_CLUSTER}" get substrates.kapro.io,fleets.kapro.io,clusters.kapro.io,plans.kapro.io,promotions.kapro.io,promotionruns.runtime.kapro.io,targets.runtime.kapro.io -A -o yaml > kind-smoke-diagnostics/kapro-resources.yaml || true | |
| kubectl --context "kind-${KAPRO_CI_KIND_CLUSTER}" -n kapro-system logs deploy/kapro-kapro-operator --tail=-1 > kind-smoke-diagnostics/operator.log || true | |
| - name: Upload Kind smoke diagnostics | |
| if: failure() | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: kind-smoke-diagnostics-${{ matrix.k8s }} | |
| path: kind-smoke-diagnostics/ |