mirror of
https://github.com/stefanprodan/podinfo.git
synced 2026-05-05 00:56:42 +00:00
Run end-to-end tests with Github Actions
This commit is contained in:
6
.github/actions/helm/Dockerfile
vendored
Normal file
6
.github/actions/helm/Dockerfile
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
FROM stefanprodan/alpine-base:latest
|
||||
|
||||
COPY entrypoint.sh /entrypoint.sh
|
||||
RUN chmod +x /entrypoint.sh
|
||||
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
9
.github/actions/helm/action.yml
vendored
Normal file
9
.github/actions/helm/action.yml
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
name: 'helm'
|
||||
description: 'A GitHub Action to run helm commands'
|
||||
author: 'Stefan Prodan'
|
||||
branding:
|
||||
icon: 'command'
|
||||
color: 'blue'
|
||||
runs:
|
||||
using: 'docker'
|
||||
image: 'Dockerfile'
|
||||
10
.github/actions/helm/entrypoint.sh
vendored
Normal file
10
.github/actions/helm/entrypoint.sh
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
HELM_V3=3.2.1
|
||||
BIN=/home/runner/bin
|
||||
curl -sSL https://get.helm.sh/helm-v${HELM_V3}-linux-amd64.tar.gz | tar xz
|
||||
mkdir -p ${BIN}
|
||||
cp linux-amd64/helm ${BIN}/helm
|
||||
rm -rf linux-amd64
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
name: multi-arch-build
|
||||
name: build
|
||||
|
||||
on:
|
||||
push:
|
||||
tags: '*'
|
||||
|
||||
jobs:
|
||||
build-push:
|
||||
multi-arch-build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
57
.github/workflows/e2e.yaml
vendored
Normal file
57
.github/workflows/e2e.yaml
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
name: e2e
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- '*'
|
||||
|
||||
jobs:
|
||||
kind:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Restore Go cache
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: ~/go/pkg/mod
|
||||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-go-
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v2-beta
|
||||
with:
|
||||
go-version: 1.14.x
|
||||
- name: Setup Helm
|
||||
uses: ./.github/actions/helm
|
||||
- name: Setup Kubernetes
|
||||
uses: engineerd/setup-kind@v0.4.0
|
||||
- name: Test
|
||||
run: make test
|
||||
- name: Check if working tree is dirty
|
||||
run: |
|
||||
if [[ $(git diff --stat) != '' ]]; then
|
||||
echo 'run make test and commit changes'
|
||||
exit 1
|
||||
fi
|
||||
- name: Build
|
||||
run: |
|
||||
GIT_COMMIT=$(git rev-list -1 HEAD) && \
|
||||
docker build -t test/podinfo:latest --build-arg "REVISION=${GIT_COMMIT}" .
|
||||
kind load docker-image test/podinfo:latest
|
||||
- name: Deploy
|
||||
run: |
|
||||
helm upgrade -i podinfo ./charts/podinfo \
|
||||
--set image.repository=test/podinfo \
|
||||
--set image.tag=latest \
|
||||
--namespace=default \
|
||||
--wait
|
||||
- name: Integration test
|
||||
run: |
|
||||
kubectl rollout status deployment/podinfo --timeout=1m
|
||||
helm test podinfo --logs
|
||||
- name: Debug failure
|
||||
if: failure()
|
||||
run: |
|
||||
kubectl logs -l app=podinfo || true
|
||||
Reference in New Issue
Block a user