Skip to content

Commit aa62bbd

Browse files
committed
add ci run for Kubernetes test
1 parent 175b12d commit aa62bbd

File tree

1 file changed

+73
-0
lines changed

1 file changed

+73
-0
lines changed

.github/workflows/pre-main.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Test Incoming Changes
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
workflow_dispatch:
9+
10+
11+
jobs:
12+
lint:
13+
name: Run Kubernetes test
14+
runs-on: ubuntu-22.04
15+
env:
16+
KUBECTL_VERSION: "v1.32.1"
17+
KIND_VERSION: "v0.20.0"
18+
KIND_NODE_IMAGE: "kindest/node:v1.27.3"
19+
GO_VERSION: "1.23.1"
20+
GOLANGCI_LINT_VERSION: "v1.60"
21+
22+
steps:
23+
- name: Set up Go ${{ env.GO_VERSION }}
24+
uses: actions/setup-go@v5
25+
with:
26+
go-version: ${{ env.GO_VERSION }}
27+
28+
- name: Disable default go problem matcher
29+
run: echo "::remove-matcher owner=go::"
30+
31+
- name: Check out code
32+
uses: actions/checkout@v4
33+
with:
34+
ref: ${{ github.sha }}
35+
36+
- name: Install kubectl
37+
run: |
38+
curl -LO "https://dl.k8s.io/release/${{ env.KUBECTL_VERSION }}/bin/linux/amd64/kubectl"
39+
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
40+
41+
- name: Install Kind
42+
run: |
43+
curl -Lo ./kind https://kind.sigs.k8s.io/dl/${{ env.KIND_VERSION }}/kind-linux-amd64
44+
chmod +x ./kind
45+
sudo mv ./kind /usr/local/bin/
46+
47+
- name: Create Kind Cluster
48+
run: |
49+
kind create cluster --name test-cluster --image "${{ env.KIND_NODE_IMAGE }}"
50+
51+
- name: Set kubectl context for Kind cluster
52+
run: |
53+
kind get kubeconfig --name test-cluster > kubeconfig.yaml
54+
export KUBECONFIG=kubeconfig.yaml
55+
kubectl cluster-info --context kind-test-cluster
56+
57+
- name: Wait for Kind Cluster to Be Ready
58+
run: |
59+
kubectl wait --for=condition=Ready nodes --all --timeout=120s || echo "Waiting for nodes to be ready timed out."
60+
61+
- name: Build kubectl-commatrix
62+
run: make build
63+
64+
- name: Install kubectl-commatrix
65+
run: sudo make install
66+
67+
- name: Verify kubectl-commatrix Installation
68+
run: |
69+
kubectl commatrix generate --help
70+
71+
- name: generate commatrix with csv format
72+
run: |
73+
kubectl commatrix generate --format csv

0 commit comments

Comments
 (0)