blob: 8676c2fbeeb716308cdf5bbfa227d68e3548fdf9 [file] [log] [blame]
#
# 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: k8s-timer-ci
on:
schedule:
- cron: '0 1 * * 1'
jobs:
changes:
runs-on: ubuntu-latest
outputs:
docs: ${{ steps.filter.outputs.docs }}
go: ${{ steps.filter.outputs.go }}
steps:
- name: Checkout
uses: actions/checkout@v2
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/**'
build:
name: Build
runs-on: ubuntu-latest
needs: changes
steps:
- name: Checkout
uses: actions/checkout@v3 # v3.0.2
- name: Set up Go 1.18
id: go
uses: actions/setup-go@v3 # v3.2.0
with:
go-version: '1.18'
- name: Set up QEMU
uses: docker/setup-qemu-action@v2 #v2.0.0
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2 # v2.0.0
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
- name: Build images
env:
TAG: dev
ARCH: amd64
REGISTRY: localhost:5000
ENABLE_PROXY: "false"
run: |
echo "building images..."
make clean-image build-images
echo "creating images cache..."
docker save \
localhost:5000/apache/apisix:dev \
localhost:5000/bitnami/etcd:dev \
localhost:5000/apache/apisix-ingress-controller:dev \
localhost:5000/kennethreitz/httpbin:dev \
localhost:5000/test-backend:dev \
localhost:5000/jmalloc/echo-server:dev \
localhost:5000/busybox:dev \
| pigz > docker.tar.gz
- name: cache
uses: actions/upload-artifact@v3 # v3.1.0
with:
name: docker.tar.gz
path: docker.tar.gz
prepare:
needs: changes
if: needs.changes.outputs.go == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Check e2e test cases' naming
run: make e2e-names-check
Kubernetes-e2e-test:
needs:
- changes
- prepare
- build
runs-on: ubuntu-latest
strategy:
fail-fast: false # If false, GitHub will not cancels all in-progress jobs in the matrix if any matrix job fails.
matrix:
k8s:
- v1.19.11@sha256:07db187ae84b4b7de440a73886f008cf903fcf5764ba8106a9fd5243d6f32729
- v1.20.7@sha256:cbeaf907fc78ac97ce7b625e4bf0de16e3ea725daf6b04f930bd14c67c671ff9
- v1.21.1@sha256:69860bda5563ac81e3c0057d654b5253219618a22ec3a346306239bba8cfa1a6
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive
- name: Install ginkgo
run: |
go install github.com/onsi/ginkgo/v2/ginkgo@v2.1.4
sudo cp ~/go/bin/ginkgo /usr/local/bin
- name: cache
uses: actions/download-artifact@v2 # v2
with:
name: docker.tar.gz
- name: Create Kubernetes ${{ matrix.k8s }} cluster
shell: bash
env:
K8S_VERSION: ${{ matrix.k8s }}
run: |
make kind-up
kubectl wait --for=condition=Ready nodes --all
- name: Load images from cache
run: |
echo "loading docker images..."
pigz -dc docker.tar.gz | docker load
make push-images
- name: Run E2E test suite
shell: bash
env:
ENABLE_PROXY: "false"
E2E_SKIP_BUILD: "1"
E2E_FLAKE_ATTEMPTS: "2"
E2E_ENV: "ci"
E2E_NODES: "8"
run: |
make e2e-test