forked from oam-dev/cluster-gateway
-
Notifications
You must be signed in to change notification settings - Fork 0
156 lines (149 loc) · 4.84 KB
/
ci.yaml
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
name: Go
on:
push:
branches:
- master
workflow_dispatch: {}
pull_request:
branches:
- master
env:
# Common versions
GO_VERSION: '1.20'
GOLANGCI_VERSION: 'v1.49'
KIND_VERSION: 'v0.19.0'
jobs:
detect-noop:
runs-on: ubuntu-22.04
outputs:
noop: ${{ steps.noop.outputs.should_skip }}
steps:
- name: Detect No-op Changes
id: noop
uses: fkirc/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
paths_ignore: '["**.md", "**.mdx", "**.png", "**.jpg"]'
do_not_skip: '["workflow_dispatch", "schedule", "push"]'
concurrent_skipping: false
test:
runs-on: ubuntu-22.04
needs: detect-noop
if: needs.detect-noop.outputs.noop != 'true'
steps:
- name: Set up Go
uses: actions/setup-go@v1
with:
go-version: ${{ env.GO_VERSION }}
id: go
- name: Checkout
uses: actions/checkout@v2
with:
submodules: true
- name: Cache Go Dependencies
uses: actions/cache@v2
with:
path: .work/pkg
key: ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-pkg-
- name: install Kubebuilder
uses: RyanSiu1995/[email protected]
with:
version: 3.1.0
kubebuilderOnly: false
kubernetesVersion: v1.22.0
- name: Run Make test
run: make test
- name: Upload coverage report
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: cover.out
flags: unit-test
name: codecov-umbrella
fail_ci_if_error: true
verbose: true
- name: Run Make
run: make
e2e-cluster-gateway:
runs-on: ubuntu-22.04
needs: detect-noop
if: needs.detect-noop.outputs.noop != 'true'
steps:
- name: Set up Go
uses: actions/setup-go@v1
with:
go-version: ${{ env.GO_VERSION }}
id: go
- name: Checkout
uses: actions/checkout@v2
with:
submodules: true
- name: Cache Go Dependencies
uses: actions/cache@v2
with:
path: .work/pkg
key: ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-pkg-
- name: Create k8s Kind Cluster
uses: helm/[email protected]
- name: Build Image
run: |
make image
kind load docker-image ghcr.io/kluster-manager/cluster-gateway:latest --name chart-testing
- name: Prepare ClusterGateway E2E Environment
run: |
helm install --create-namespace -n cluster-gateway \
cluster-gateway ./charts/cluster-gateway \
--set featureGate.healthiness=true \
--set tag=latest
kubectl wait --for=condition=Available apiservice/v1alpha1.gateway.open-cluster-management.io
go run ./e2e/env/prepare | kubectl apply -f -
- name: Run Make test
run: |
kubectl get clustergateway
make test-e2e
e2e-ocm-addon-cluster-gateway:
runs-on: ubuntu-22.04
needs: detect-noop
if: needs.detect-noop.outputs.noop != 'true'
steps:
- name: Set up Go
uses: actions/setup-go@v1
with:
go-version: ${{ env.GO_VERSION }}
id: go
- name: Checkout
uses: actions/checkout@v2
with:
submodules: true
- name: Cache Go Dependencies
uses: actions/cache@v2
with:
path: .work/pkg
key: ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-pkg-
- name: Install clusteradm
run: curl -L https://raw.githubusercontent.com/open-cluster-management-io/clusteradm/main/install.sh | bash
- name: Create k8s Kind Cluster
uses: helm/[email protected]
- name: Prepare OCM testing environment
run: |
clusteradm init --output-join-command-file join.sh --wait
sh -c "$(cat join.sh) loopback --force-internal-endpoint-lookup"
clusteradm accept --clusters loopback --wait 30
kubectl wait --for=condition=ManagedClusterConditionAvailable managedcluster/loopback
- name: Build image
run: |
make image
kind load docker-image ghcr.io/kluster-manager/cluster-gateway:latest --name chart-testing
kind load docker-image ghcr.io/kluster-manager/cluster-gateway-manager:latest --name chart-testing
- name: Install latest cluster-gateway
run: |
helm install --create-namespace -n open-cluster-management-addon \
cluster-gateway ./charts/addon-manager \
--set tag=latest
go run ./e2e/env/prepare | kubectl apply -f -
- name: Run e2e test
run: |
make test-e2e-ocm