-
Notifications
You must be signed in to change notification settings - Fork 78
138 lines (117 loc) · 3.75 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
name: CI
on:
pull_request:
branches:
- "*"
paths-ignore:
- 'docs/**'
- 'LICENSES/**'
- '**.md'
push:
branches:
- main
paths-ignore:
- 'docs/**'
- 'LICENSES/**'
- '**.md'
permissions:
contents: read
jobs:
format:
name: Verify format
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
with:
go-version-file: go.mod
cache: false
- name: Check go modules
run: |
go mod tidy && git add go.* &&
git diff --cached --exit-code || (echo 'Please run "go mod tidy" to sync Go modules' && exit 1);
- name: Verify gofmt
run: |
make fmt && git add pkg cmd tools test &&
git diff --cached --exit-code || (echo 'Please run "make fmt" to verify gofmt' && exit 1);
build:
name: Build
runs-on: ubuntu-20.04
env:
PLATFORMS: linux/amd64
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
with:
go-version-file: go.mod
- name: Set up QEMU
uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0
with:
version: latest
- name: Available platforms
run: echo ${{ steps.buildx.outputs.platforms }}
- name: Prepare Host
run: |
curl -LO https://dl.k8s.io/release/v1.24.6/bin/linux/amd64/kubectl
chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin/kubectl
unit-test:
name: Unit Test
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
with:
go-version-file: go.mod
check-latest: true
- name: Run UT
run: make unittest
e2e:
env:
PLATFORMS: linux/amd64
name: Kubernetes E2E Testing
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Set up go
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
with:
go-version-file: go.mod
cache: false
- name: Build image
env:
ARCH: amd64
run: |
echo "building images"
make docker-images
- name: Install kind & kubectl
uses: helm/kind-action@v1.8.0
with:
version: v0.20.0
install_only: true
cluster_name: kind
config: e2e-cluster/kind-config.yml
kubectl_version: v1.26.6
verbosity: 4
- name: Create Kubernetes cluster
run: |
kind create cluster --image=kindest/node:v1.26.6 --config e2e-cluster/kind-config.yml && \
kind get kubeconfig > $HOME/.kube/config
- name: Load Images
run: |
kind get clusters
kubectl cluster-info
kind load docker-image godel-local:latest
- name: Apply Godel Yamls
run: |
kubectl apply -k manifests/overlays/e2e-kind && \
kubectl taint nodes -l node-role.kubernetes.io/control-plane= node-role.kubernetes.io/control-plane-;
- name: Run e2e tests
run: |
kind get kubeconfig > $HOME/.kube/config
make e2e && \
./bin/linux_amd64/e2e.test --kubeconfig=${HOME}/.kube/config