-
Notifications
You must be signed in to change notification settings - Fork 12
114 lines (92 loc) · 2.67 KB
/
go.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
# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
name: Go
on:
pull_request:
types:
- opened
- synchronize
- reopened
branches:
- main
push:
branches:
- main
env:
KWOK_REPO: kubernetes-sigs/kwok
KWOK_LATEST_RELEASE: v0.5.2
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.20'
- name: Lint
uses: golangci/golangci-lint-action@v5
with:
version: 'v1.58.0'
args: -v --timeout 5m
skip-cache: true
- name: vet
run:
make vet
- name: fmt
run:
test -z "$(go fmt ./...)"
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.20'
- name: Test
run: go test -v ./...
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.20'
- name: Build
run: make build
test-k8s:
needs: [check, test, build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.20'
- name: Build
run: make build
- name: Set up Helm
uses: azure/[email protected]
with:
version: v3.14.4
- name: Create k8s Kind Cluster
uses: helm/kind-action@v1
- name: Install KWOK node simulator
run: |
kubectl apply -f "https://github.com/${KWOK_REPO}/releases/download/${KWOK_LATEST_RELEASE}/kwok.yaml"
kubectl apply -f "https://github.com/${KWOK_REPO}/releases/download/${KWOK_LATEST_RELEASE}/stage-fast.yaml"
kubectl apply -f https://github.com/${KWOK_REPO}/raw/main/kustomize/stage/pod/chaos/pod-init-container-running-failed.yaml
kubectl apply -f https://github.com/${KWOK_REPO}/raw/main/kustomize/stage/pod/chaos/pod-container-running-failed.yaml
kubectl apply -f charts/overrides/kwok/pod-complete.yml
- name: Add virtual nodes to the cluster
run: |
helm install virtual-nodes charts/virtual-nodes -f charts/virtual-nodes/values-example.yaml
kubectl get nodes
- name: Run knavigator with an example test
run: |
kubectl create ns k8s-test
kubectl create priorityclass normal-priority --value=100000
./bin/knavigator -tasks resources/tests/k8s/test-job.yml
kubectl get job -n k8s-test