Test pull requests using github actions
This commit is contained in:
parent
57d1eb6aa3
commit
b392fed580
18 changed files with 214 additions and 56 deletions
117
.github/workflows/ci.yaml
vendored
Normal file
117
.github/workflows/ci.yaml
vendored
Normal file
|
|
@ -0,0 +1,117 @@
|
|||
name: CI
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- "*"
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Set up Go 1.14
|
||||
uses: actions/setup-go@v1
|
||||
with:
|
||||
go-version: 1.14
|
||||
id: go
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v1
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
id: buildx
|
||||
uses: crazy-max/ghaction-docker-buildx@v1
|
||||
with:
|
||||
buildx-version: latest
|
||||
qemu-version: latest
|
||||
|
||||
- name: Available platforms
|
||||
run: echo ${{ steps.buildx.outputs.platforms }}
|
||||
|
||||
- name: Prepare Host
|
||||
run: |
|
||||
sudo apt-get -qq update || true
|
||||
sudo apt-get install -y pigz
|
||||
curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.17.0/bin/linux/amd64/kubectl
|
||||
chmod +x ./kubectl
|
||||
sudo mv ./kubectl /usr/local/bin/kubectl
|
||||
|
||||
- name: Build images
|
||||
env:
|
||||
TAG: 1.0.0-dev
|
||||
ARCH: amd64
|
||||
REGISTRY: ingress-controller
|
||||
run: |
|
||||
echo "building images..."
|
||||
make clean-image build image
|
||||
make -C test/e2e-image image
|
||||
|
||||
echo "creating images cache..."
|
||||
docker save \
|
||||
nginx-ingress-controller:e2e \
|
||||
ingress-controller/nginx-ingress-controller:1.0.0-dev \
|
||||
| pigz > docker.tar.gz
|
||||
|
||||
- name: cache
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: docker.tar.gz
|
||||
path: docker.tar.gz
|
||||
|
||||
kubernetes:
|
||||
name: Kubernetes
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
strategy:
|
||||
matrix:
|
||||
k8s: [v1.14.10, v1.15.11, v1.16.9, v1.17.5, v1.18.4]
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v1
|
||||
|
||||
- name: cache
|
||||
uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: docker.tar.gz
|
||||
|
||||
- name: Create Kubernetes ${{ matrix.k8s }} cluster
|
||||
id: kind
|
||||
uses: engineerd/setup-kind@v0.4.0
|
||||
with:
|
||||
version: v0.8.1
|
||||
config: test/e2e/kind.yaml
|
||||
image: kindest/node:${{ matrix.k8s }}
|
||||
|
||||
# delete-artifact
|
||||
- uses: geekyeggo/delete-artifact@v1
|
||||
with:
|
||||
name: docker.tar.gz
|
||||
failOnError: false
|
||||
|
||||
- name: Prepare cluster for testing
|
||||
id: local-path
|
||||
run: |
|
||||
kubectl version
|
||||
echo
|
||||
echo "installing helm 3..."
|
||||
curl -sSL https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash
|
||||
|
||||
- name: Load images from cache
|
||||
run: |
|
||||
echo "loading docker images..."
|
||||
pigz -dc docker.tar.gz | docker load
|
||||
|
||||
- name: Run e2e tests
|
||||
env:
|
||||
KIND_CLUSTER_NAME: kind
|
||||
SKIP_CLUSTER_CREATION: true
|
||||
SKIP_IMAGE_CREATION: true
|
||||
run: |
|
||||
kind get kubeconfig > $HOME/.kube/kind-config-kind
|
||||
make kind-e2e-test
|
||||
Loading…
Add table
Add a link
Reference in a new issue