Add k8s test action and build test image

This commit is contained in:
Mikael Elkiaer 2023-09-19 19:53:49 +00:00
parent 70384eae3c
commit beff7c9f08
2 changed files with 48 additions and 0 deletions

24
.github/actions/test-in-k8s/action.yaml vendored Normal file
View File

@ -0,0 +1,24 @@
name: Test in Kubernetes
description: Run tests in Kubernetes (KIND)
inputs:
test-image-tag:
description: Image to load
runs:
using: composite
steps:
- name: Install Kubernetes
uses: helm/kind-action@v1.8.0
- name: Load test image
run: |
kind load docker-image ${{ inputs.test-image-tag }}
shell: bash
- name: Install Traefik
run: |
helm install traefik traefik --repo https://traefik.github.io/charts --wait --timeout 120s
shell: bash
- name: Install Homepage
run: |
helm install homepage homepage --repo http://jameswynn.github.io/helm-charts --wait --timeout 120s
shell: bash

View File

@ -84,6 +84,30 @@ jobs:
flavor: | flavor: |
latest=auto latest=auto
# Build and load Docker image with Buildx
# https://github.com/docker/build-push-action
- name: Build and load Docker image
uses: docker/build-push-action@v5
with:
context: .
load: true
tags: test
labels: ${{ steps.meta.outputs.labels }}
build-args: |
BUILDTIME=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }}
VERSION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}
REVISION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }}
# https://github.com/docker/setup-qemu-action#about
# platforms: linux/amd64,linux/arm64,linux/riscv64,linux/ppc64le,linux/s390x,linux/386,linux/mips64le,linux/mips64,linux/arm/v7,linux/arm/v6
platforms: linux/amd64
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Test in Kubernetes
uses: ./.gitbub/actions/test-in-k8s
with:
test-image-tag: test
# Build and push Docker image with Buildx (don't push on PR) # Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action # https://github.com/docker/build-push-action
- name: Build and push Docker image - name: Build and push Docker image