diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index e350f345..bb16f008 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -10,23 +10,101 @@ on: - 'v[0-9]+\.[0-9]+\.[0-9]+-?**' pull_request: {} -env: - IMGPKG: go run -modfile hack/imgpkg/go.mod github.com/vmware-tanzu/carvel-imgpkg/cmd/imgpkg - KAPP: go run -modfile hack/kapp/go.mod github.com/k14s/kapp/cmd/kapp - KBLD: go run -modfile hack/kbld/go.mod github.com/vmware-tanzu/carvel-kbld/cmd/kbld - KO: go run -modfile hack/ko/go.mod github.com/google/ko - jobs: + tools: + name: Build and cache tools + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + - uses: actions/setup-go@v6 + with: + go-version-file: go.mod + cache-dependency-path: '**/*.sum' + - &install-controller-gen + name: Install controller-gen + uses: reconcilerio/go-install-action@v1 + with: + package: sigs.k8s.io/controller-tools/cmd/controller-gen + working-directory: hack/controller-gen + output-path-env: CONTROLLER_GEN + - &install-crane + name: Install crane + uses: reconcilerio/install-crane-action@v1 + with: + version: v0.21.5 + - &install-diegen + name: Install diegen + uses: reconcilerio/go-install-action@v1 + with: + package: reconciler.io/dies/diegen + working-directory: hack/diegen + output-path-env: DIEGEN + - &install-goimports + name: Install goimports + uses: reconcilerio/go-install-action@v1 + with: + package: golang.org/x/tools/cmd/goimports + working-directory: hack/goimports + output-path-env: GOIMPORTS + - &install-imgpkg + name: Install imgpkg + uses: reconcilerio/go-install-action@v1 + with: + package: carvel.dev/imgpkg/cmd/imgpkg + working-directory: hack/imgpkg + output-path-env: IMGPKG + - &install-kapp + name: Install kapp + uses: reconcilerio/go-install-action@v1 + with: + package: carvel.dev/kapp/cmd/kapp + working-directory: hack/kapp + output-path-env: KAPP + - &install-kbld + name: Install kbld + uses: reconcilerio/go-install-action@v1 + with: + package: carvel.dev/kbld/cmd/kbld + working-directory: hack/kbld + output-path-env: KBLD + - &install-ko + name: Install ko + uses: reconcilerio/go-install-action@v1 + with: + package: github.com/google/ko + working-directory: hack/ko + output-path-env: KO + - &install-kustomize + name: Install kustomize + uses: reconcilerio/go-install-action@v1 + with: + package: sigs.k8s.io/kustomize/kustomize/v4 + working-directory: hack/kustomize + output-path-env: KUSTOMIZE + - &install-yq + name: Install yq + uses: reconcilerio/go-install-action@v1 + with: + package: github.com/mikefarah/yq/v4 + working-directory: hack/yq + output-path-env: YQ + unit: name: Unit Test runs-on: ubuntu-latest + needs: tools steps: - uses: actions/checkout@v6 - uses: actions/setup-go@v6 with: go-version-file: go.mod cache-dependency-path: '**/*.sum' + - *install-controller-gen + - *install-diegen + - *install-goimports + - *install-kustomize + - *install-yq - name: Test run: make test - name: Report coverage @@ -44,6 +122,7 @@ jobs: stage: name: Stage runs-on: ubuntu-latest + needs: tools env: KO_PLATFORMS: linux/amd64,linux/arm64 steps: @@ -52,7 +131,10 @@ jobs: with: go-version-file: go.mod cache-dependency-path: '**/*.sum' - - name: Start registry + - *install-imgpkg + - *install-kbld + - *install-ko + - name: OCI registry id: registry uses: reconcilerio/registry@v1 - name: Build all platforms for tags @@ -100,50 +182,26 @@ jobs: acceptance: name: Acceptance Test needs: stage - runs-on: ${{ matrix.os }} + runs-on: ubuntu-latest strategy: fail-fast: false matrix: include: - - node: kindest/node:v1.23.17@sha256:14d0a9a892b943866d7e6be119a06871291c517d279aedb816a4b4bc0ec0a5b3 - version: v1.23.17 - os: ubuntu-latest - - node: kindest/node:v1.24.17@sha256:bad10f9b98d54586cba05a7eaa1b61c6b90bfc4ee174fdc43a7b75ca75c95e51 - version: v1.24.17 - os: ubuntu-latest - - node: kindest/node:v1.25.16@sha256:6110314339b3b44d10da7d27881849a87e092124afab5956f2e10ecdb463b025 - version: v1.25.16 - os: ubuntu-latest - - node: kindest/node:v1.26.15@sha256:c79602a44b4056d7e48dc20f7504350f1e87530fe953428b792def00bc1076dd - version: v1.26.15 - os: ubuntu-latest - - node: kindest/node:v1.27.16@sha256:2d21a61643eafc439905e18705b8186f3296384750a835ad7a005dceb9546d20 - version: v1.27.16 - os: ubuntu-latest - - node: kindest/node:v1.28.15@sha256:a7c05c7ae043a0b8c818f5a06188bc2c4098f6cb59ca7d1856df00375d839251 - version: v1.28.13 - os: ubuntu-latest - - node: kindest/node:v1.29.14@sha256:8703bd94ee24e51b778d5556ae310c6c0fa67d761fae6379c8e0bb480e6fea29 - version: v1.29.14 - os: ubuntu-latest - - node: kindest/node:v1.30.13@sha256:397209b3d947d154f6641f2d0ce8d473732bd91c87d9575ade99049aa33cd648 - version: v1.30.13 - os: ubuntu-latest - - node: kindest/node:v1.31.14@sha256:6f86cf509dbb42767b6e79debc3f2c32e4ee01386f0489b3b2be24b0a55aac2b - version: v1.31.14 - os: ubuntu-latest - - node: kindest/node:v1.32.11@sha256:5fc52d52a7b9574015299724bd68f183702956aa4a2116ae75a63cb574b35af8 - version: v1.32.11 - os: ubuntu-latest - - node: kindest/node:v1.33.7@sha256:d26ef333bdb2cbe9862a0f7c3803ecc7b4303d8cea8e814b481b09949d353040 - version: v1.33.7 - os: ubuntu-latest - - node: kindest/node:v1.34.3@sha256:08497ee19eace7b4b5348db5c6a1591d7752b164530a36f855cb0f2bdcbadd48 - version: v1.34.3 - os: ubuntu-latest - - node: kindest/node:v1.35.1@sha256:05d7bcdefbda08b4e038f644c4df690cdac3fba8b06f8289f30e10026720a1ab - version: v1.35.1 - os: ubuntu-latest + - kubernetes-version: v1.23 + - kubernetes-version: v1.24 + - kubernetes-version: v1.25 + - kubernetes-version: v1.26 + - kubernetes-version: v1.27 + - kubernetes-version: v1.28 + - kubernetes-version: v1.29 + - kubernetes-version: v1.30 + - kubernetes-version: v1.31 + - kubernetes-version: v1.32 + - kubernetes-version: v1.33 + - kubernetes-version: v1.34 + - kubernetes-version: v1.35 + - kubernetes-version: v1.36 + - kubernetes-version: v1.37 steps: - uses: actions/checkout@v6 - uses: actions/setup-go@v6 @@ -153,64 +211,18 @@ jobs: - uses: actions/setup-python@v6 with: python-version: "3.10" - - name: Install kind - run: | - cd $(mktemp -d -t kind.XXXX) - curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.31.0/kind-$(go env GOHOSTOS)-$(go env GOHOSTARCH) - chmod +x ./kind - sudo mv ./kind /usr/local/bin - cd - + - *install-imgpkg + - *install-kapp + - *install-kbld - name: Start registry id: registry uses: reconcilerio/registry@v1 - - name: Create Cluster - run: | - set -o errexit - set -o nounset - set -o pipefail - - registry="${{ steps.registry.outputs.registry }}" - cert_dir=$(mktemp -d -t certs.XXXX) - cp "${{ steps.registry.outputs.tls-ca }}" "${cert_dir}/ca.pem" - - # define containerd host config for registry - cat < ${cert_dir}/hosts.toml - server = "https://${registry}" - - [host."https://${registry}"] - capabilities = ["pull"] - ca = "/etc/containerd/certs.d/${registry}/ca.pem" - EOF - - # create a cluster with the local registry enabled in containerd - cat <