From beff7c9f08f5c276c3eb4f396effbc40b83d400a Mon Sep 17 00:00:00 2001 From: Mikael Elkiaer <2102306+MikaelElkiaer@users.noreply.github.com> Date: Tue, 19 Sep 2023 19:53:49 +0000 Subject: [PATCH] Add k8s test action and build test image --- .github/actions/test-in-k8s/action.yaml | 24 ++++++++++++++++++++++++ .github/workflows/docker-publish.yml | 24 ++++++++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 .github/actions/test-in-k8s/action.yaml diff --git a/.github/actions/test-in-k8s/action.yaml b/.github/actions/test-in-k8s/action.yaml new file mode 100644 index 00000000..a3014127 --- /dev/null +++ b/.github/actions/test-in-k8s/action.yaml @@ -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 diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 73c530b4..7fab3ab6 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -84,6 +84,30 @@ jobs: flavor: | 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) # https://github.com/docker/build-push-action - name: Build and push Docker image