-
Notifications
You must be signed in to change notification settings - Fork 352
207 lines (184 loc) · 5.77 KB
/
e2e-test-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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
name: e2e-test-ci
on:
push:
branches:
- master
pull_request:
branches:
- master
- 1.8.0
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
changes:
runs-on: ubuntu-20.04
outputs:
docs: ${{ steps.filter.outputs.docs }}
go: ${{ steps.filter.outputs.go }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- uses: ./.github/actions/paths-filter
id: filter
with:
token: ${{ secrets.GITHUB_TOKEN }}
filters: |
docs:
- 'docs/**/*'
- '*.md'
go:
- '*.go'
- '**/*.go'
- 'go.mod'
- 'go.sum'
- 'Makefile'
- 'Dockerfile'
- 'test/e2e/**/*'
- 'conf/**'
- 'utils/**'
- ".github/**"
build:
name: Build
runs-on: ubuntu-20.04
needs: changes
if: needs.changes.outputs.go == 'true'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go Env
id: go
uses: actions/setup-go@v4
with:
go-version: '1.20'
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
with:
version: latest
- name: Prepare Host
run: |
curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.11.1/kind-linux-amd64
chmod +x ./kind
sudo mv kind /usr/local/bin
sudo apt install -y pigz
- name: Build images
env:
TAG: dev
ARCH: amd64
REGISTRY: 127.0.0.1:5000
ENABLE_PROXY: "false"
BASE_IMAGE_TAG: "debug"
run: |
echo "building images..."
make clean-image build-images
echo "creating images cache..."
docker save \
${REGISTRY}/apisix:dev \
${REGISTRY}/etcd:dev \
${REGISTRY}/apisix-ingress-controller:dev \
${REGISTRY}/httpbin:dev \
${REGISTRY}/test-backend:dev \
${REGISTRY}/test-timeout:dev \
${REGISTRY}/echo-server:dev \
${REGISTRY}/busybox:dev \
| pigz > docker.tar.gz
- name: cache
uses: actions/upload-artifact@v4
with:
name: docker.tar.gz
path: docker.tar.gz
prepare:
needs: changes
if: needs.changes.outputs.go == 'true'
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Check e2e test cases' naming
run: make e2e-names-check
- name: List test suites and set the matrix
id: set-matrix
run: |
SUITES=($(find test/e2e -type d -iname 'suite-*' | grep -E -o '(\w|\-)*' | grep -v 'test' | grep -v 'e2e' | sort | uniq -u))
echo $SUITES
echo "matrix=$(jq --compact-output --null-input '$ARGS.positional' --args "${SUITES[@]}")" >> $GITHUB_OUTPUT
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
e2e-test:
needs:
- changes
- prepare
- build
runs-on: ubuntu-20.04
strategy:
fail-fast: false # If false, GitHub will not cancels all in-progress jobs in the matrix if any matrix job fails.
matrix:
suite: ${{ fromJson(needs.prepare.outputs.matrix) }}
ingress-class-values: [ "apisix", "apisix-and-all" ]
enabled-etcdserver: [ true, false ]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup Go Env
uses: actions/setup-go@v4
with:
go-version: "1.20"
- name: Install ginkgo
run: |
GINKGO_VERSION=$(cd test/e2e && go list -m -mod=readonly -f {{.Version}} github.com/onsi/ginkgo/v2)
go install github.com/onsi/ginkgo/v2/ginkgo@$GINKGO_VERSION
sudo cp ~/go/bin/ginkgo /usr/local/bin
- name: cache
uses: actions/download-artifact@v4
with:
name: docker.tar.gz
- name: Create K8s cluster
shell: bash
run: |
make kind-up
kubectl wait --for=condition=Ready nodes --all
- name: Load images from cache
run: |
echo "loading docker images..."
sudo apt install -y pigz
pigz -dc docker.tar.gz | docker load
make push-images
- name: Run E2E test suite
shell: bash
env:
E2E_FOCUS: "${{ matrix.suite }}"
ENABLE_PROXY: "false"
INGRESS_CLASS: "${{ matrix.ingress-class-values }}"
ENABLED_ETCD_SERVER: "${{ matrix.enabled-etcdserver }}"
E2E_SKIP_BUILD: "1"
E2E_FLAKE_ATTEMPTS: "2"
E2E_ENV: "ci"
run: |
echo ${E2E_FOCUS} | grep "suite-cluster" && export E2E_NODES=1
make e2e-test