Skip to content

Commit

Permalink
ci: test samples on CI (#256)
Browse files Browse the repository at this point in the history
  • Loading branch information
pmalek authored May 13, 2024
1 parent c4cebb1 commit 66287ed
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 12 deletions.
42 changes: 30 additions & 12 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup go
uses: actions/setup-go@v5
Expand Down Expand Up @@ -70,13 +68,40 @@ jobs:
max_attempts: 3
command: make verify.generators

install-with-kustomize:
samples:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup go
uses: actions/setup-go@v5
with:
fetch-depth: 0
go-version-file: go.mod

- name: Create k8s KinD Cluster
uses: helm/[email protected]

- uses: jdx/mise-action@v2
with:
install: false

# We use install.all to install all CRDs and resources also the ones that are not bundled
# in base kustomization (e.g. currently AIGateway) but which have samples defined.
- name: Verify installing CRDs via kustomize works
run: make install.all

- name: Install and delete each sample one by one
run: make test.samples

- name: Verify that uninstalling operator CRDs via kustomize works
run: make uninstall.all

install-with-kustomize:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup go
uses: actions/setup-go@v5
Expand Down Expand Up @@ -122,8 +147,6 @@ jobs:
steps:
- name: checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: setup golang
uses: actions/setup-go@v5
Expand Down Expand Up @@ -198,8 +221,6 @@ jobs:
steps:
- name: checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: setup golang
uses: actions/setup-go@v5
Expand Down Expand Up @@ -251,8 +272,6 @@ jobs:
steps:
- name: checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: setup golang
uses: actions/setup-go@v5
Expand Down Expand Up @@ -400,8 +419,6 @@ jobs:

- name: checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: download tests report
id: download-coverage
Expand Down Expand Up @@ -431,6 +448,7 @@ jobs:
- install-with-kustomize
- build
- unit-tests
- samples
# - conformance-tests
- integration-tests
- integration-tests-bluegreen
Expand Down
15 changes: 15 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,10 @@ test.conformance:
KGO_RELEASE=$(TAG)
GOTESTFLAGS="$(GOTESTFLAGS)"

.PHONY: test.samples
test.samples: kustomize
find ./config/samples -not -name "kustomization.*" -type f | xargs -I{} bash -c "kubectl apply -f {}; kubectl delete -f {}"

# ------------------------------------------------------------------------------
# Gateway API
# ------------------------------------------------------------------------------
Expand Down Expand Up @@ -492,12 +496,23 @@ debug.skaffold.continuous: _ensure-kong-system-namespace
install: manifests kustomize install-gateway-api-crds
$(KUSTOMIZE) build config/crd | kubectl apply --server-side -f -

# Install standard and experimental CRDs into the K8s cluster specified in ~/.kube/config.
.PHONY: install.all
install.all: manifests kustomize install-gateway-api-crds
kubectl apply --server-side -f $(PROJECT_DIR)/config/crd/bases/

# Uninstall CRDs from the K8s cluster specified in ~/.kube/config.
# Call with ignore-not-found=true to ignore resource not found errors during deletion.
.PHONY: uninstall
uninstall: manifests kustomize uninstall-gateway-api-crds
$(KUSTOMIZE) build config/crd | kubectl delete --ignore-not-found=$(ignore-not-found) -f -

# Uninstall standard and experimental CRDs from the K8s cluster specified in ~/.kube/config.
# Call with ignore-not-found=true to ignore resource not found errors during deletion.
.PHONY: uninstall.all
uninstall.all: manifests kustomize uninstall-gateway-api-crds
kubectl delete --ignore-not-found=$(ignore-not-found) -f $(PROJECT_DIR)/config/crd/bases/

# Deploy controller to the K8s cluster specified in ~/.kube/config.
# This will wait for operator's Deployment to get Available.
# This uses a temporary directory becuase "kustomize edit set image" would introduce
Expand Down

0 comments on commit 66287ed

Please sign in to comment.