Skip to content

Commit 22619eb

Browse files
committed
consolidate test jobs in ci
1 parent e7b3bfe commit 22619eb

File tree

1 file changed

+22
-67
lines changed

1 file changed

+22
-67
lines changed

.github/workflows/operator-ci.yaml

Lines changed: 22 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,22 @@ env:
4747
PLATFORMS: linux/amd64,linux/arm64
4848

4949
jobs:
50-
# Test operator across supported Kubernetes versions
50+
# Test operator across supported Kubernetes versions and test suites
5151
tests:
5252
runs-on: ubuntu-latest
5353
strategy:
5454
matrix:
55-
# Test on all supported K8s versions (matches docs/kubernetes-support.md)
55+
# Standard E2E tests on all supported K8s versions
5656
k8s-version: ["1.31.12", "1.32.8", "1.33.4", "1.34.0"]
57+
test-suite: ["e2e"]
58+
include:
59+
# Deployment policy tests on 15-node cluster (K8s 1.34 only)
60+
- k8s-version: "1.34.0"
61+
test-suite: deployment-policy
62+
kind-config: k8s-tests/chainsaw/deployment-policy/kind-config.yaml
63+
make-target: deployment-policy-tests
5764
fail-fast: false # Continue testing other versions if one fails
65+
name: ${{ matrix.test-suite }}-tests (k8s-${{ matrix.k8s-version }})
5866
steps:
5967
- uses: actions/checkout@v4
6068
with:
@@ -71,14 +79,14 @@ jobs:
7179
registry: ${{ env.REGISTRY }}
7280
username: ${{ github.actor }}
7381
password: ${{ secrets.GITHUB_TOKEN }}
74-
- name: Kubernetes KinD Cluster v${{ matrix.k8s-version }}
82+
- name: Create Kubernetes KinD Cluster v${{ matrix.k8s-version }}
7583
id: kind
7684
uses: helm/kind-action@v1
7785
with:
7886
version: v0.30.0
7987
node_image: kindest/node:v${{ matrix.k8s-version }}
80-
config: operator/config/local-dev/kind-config.yaml
81-
cluster_name: kind
88+
config: ${{ matrix.kind-config || 'operator/config/local-dev/kind-config.yaml' }}
89+
cluster_name: skyhook-test
8290
# Cache build tools and dependencies for faster builds
8391
- name: Restore cached Binaries
8492
id: cached-binaries
@@ -103,74 +111,21 @@ jobs:
103111
path: |
104112
${{ github.workspace }}/operator/bin
105113
~/.cache/go-build
106-
# Run full test suite including e2e tests
107-
- name: end-to-end-tests
114+
# Run test suite
115+
- name: Run ${{ matrix.test-suite }} tests
108116
run: |
109117
cd operator
110-
make setup-kind-cluster
111-
make test
112-
113-
# Test deployment policies on 15-node cluster
114-
deployment-policy-tests:
115-
runs-on: ubuntu-latest
116-
steps:
117-
- uses: actions/checkout@v4
118-
with:
119-
fetch-tags: true
120-
fetch-depth: 0
121-
- name: Setup Go ${{ env.GO_VERSION }}
122-
uses: actions/setup-go@v5
123-
with:
124-
go-version: ${{ env.GO_VERSION }}
125-
cache-dependency-path: operator/go.sum
126-
- name: Log in to the Container registry
127-
uses: docker/login-action@v3
128-
with:
129-
registry: ${{ env.REGISTRY }}
130-
username: ${{ github.actor }}
131-
password: ${{ secrets.GITHUB_TOKEN }}
132-
- name: Create 15-node Kind Cluster
133-
id: kind
134-
uses: helm/kind-action@v1
135-
with:
136-
version: v0.30.0
137-
node_image: kindest/node:v1.34.0
138-
config: k8s-tests/chainsaw/deployment-policy/kind-config.yaml
139-
cluster_name: skyhook-dp-test
140-
# Cache build tools and dependencies for faster builds
141-
- name: Restore cached Binaries
142-
id: cached-binaries
143-
uses: actions/cache/restore@v4
144-
with:
145-
key: ${{ env.GO_VERSION }}-${{ runner.os }}-${{ runner.arch }}-bin-${{ hashFiles('operator/deps.mk') }}
146-
restore-keys: ${{ env.GO_VERSION }}-${{ runner.os }}-${{ runner.arch }}-bin-
147-
path: |
148-
${{ github.workspace }}/operator/bin
149-
~/.cache/go-build
150-
- name: Install dependencies
151-
if: steps.cached-binaries.outputs.cache-hit != 'true'
152-
run: |
153-
cd operator
154-
make install-deps
155-
- name: Save cached Binaries
156-
id: save-cached-binaries
157-
if: steps.cached-binaries.outputs.cache-hit != 'true'
158-
uses: actions/cache/save@v4
159-
with:
160-
key: ${{ env.GO_VERSION }}-${{ runner.os }}-${{ runner.arch }}-bin-${{ hashFiles('operator/deps.mk') }}
161-
path: |
162-
${{ github.workspace }}/operator/bin
163-
~/.cache/go-build
164-
# Run deployment policy E2E tests
165-
- name: deployment-policy-e2e-tests
166-
run: |
167-
cd operator
168-
make deployment-policy-tests
118+
if [ "${{ matrix.test-suite }}" = "e2e" ]; then
119+
make setup-kind-cluster
120+
make test
121+
else
122+
make ${{ matrix.make-target }}
123+
fi
169124
170125
# Build multi-platform container image and push to registry
171126
build-and-push-operator:
172127
runs-on: ubuntu-latest
173-
needs: [tests, deployment-policy-tests] # Don't run the build and push if tests fail
128+
needs: [tests] # Don't run the build and push if tests fail
174129
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job.
175130
permissions:
176131
contents: read

0 commit comments

Comments
 (0)