refactor: Add installation of controller-gen and kustomize, and updat… #15
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: E2E Tests | |
on: | |
push: | |
paths-ignore: | |
- "**.md" | |
pull_request: | |
paths-ignore: | |
- "**.md" | |
jobs: | |
test-e2e: | |
name: E2E Tests | |
runs-on: ubuntu-24.04 | |
steps: | |
- name: Clone the code | |
uses: actions/checkout@v4.2.2 | |
- name: Setup Go | |
uses: actions/setup-go@v5.4.0 | |
with: | |
go-version-file: go.mod | |
- name: Install go-task | |
run: | | |
sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b /usr/local/bin | |
- name: Install k3d | |
run: | | |
curl -s https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | bash | |
- name: Install ctlptl | |
run: | | |
CTLPTL_VERSION=0.8.40 | |
# Use x86_64 architecture for GitHub Actions runners | |
curl -fsSL https://github.com/tilt-dev/ctlptl/releases/download/v${CTLPTL_VERSION}/ctlptl.${CTLPTL_VERSION}.linux.x86_64.tar.gz | \ | |
sudo tar -xzC /usr/local/bin ctlptl | |
sudo chmod +x /usr/local/bin/ctlptl | |
- name: Install controller-gen and kustomize | |
run: | | |
CONTROLLER_GEN_VERSION=v0.17.2 | |
KUSTOMIZE_VERSION=v5.6.0 | |
# Install controller-gen globally | |
go install sigs.k8s.io/controller-tools/cmd/controller-gen@${CONTROLLER_GEN_VERSION} | |
# Install kustomize globally | |
go install sigs.k8s.io/kustomize/kustomize/v5@${KUSTOMIZE_VERSION} | |
# Verify installations | |
controller-gen --version || echo "controller-gen installed" | |
kustomize version | |
- name: Install setup-envtest for tests | |
run: | | |
ENVTEST_VERSION=release-0.20 | |
ENVTEST_K8S_VERSION=1.32 | |
# Ensure bin directory exists just for envtest binaries | |
mkdir -p bin | |
# Install setup-envtest | |
go install sigs.k8s.io/controller-runtime/tools/setup-envtest@${ENVTEST_VERSION} | |
# Setup envtest binaries | |
setup-envtest use ${ENVTEST_K8S_VERSION} --bin-dir bin -p path | |
- name: Verify k3d and ctlptl installation | |
run: | | |
k3d version | |
ctlptl version | |
- name: Create k3d cluster with ctlptl | |
run: | | |
task create-cluster | |
- name: Running Test e2e | |
run: | | |
go mod tidy | |
# Run generate and manifests targets separately | |
task generate | |
task manifests | |
task test-e2e |