Change the integration tests. #55
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright 2023 Google LLC | |
# | |
# Licensed 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: Integration Test | |
env: | |
CONFIG_FILE: deploy.toml | |
IMAGE_NAME: $(echo ghcr.io/${{ github.repository }}/echo | tr '[:upper:]' '[:lower:]') | |
WAIT_TIMEOUT: "15m" | |
on: | |
push: | |
branches: | |
- 'main' | |
pull_request: | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the repository | |
uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.20' | |
cache: true | |
- name: Setup kubectl. | |
uses: azure/setup-kubectl@v3 | |
- name: Setup minikube | |
uses: medyagh/setup-minikube@master | |
- name: Login into Github Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Install weaver-kube | |
run: cd cmd/weaver-kube; go build . | |
- name: Build echo example. | |
run: cd examples/echo; go build . | |
- name: Generate app config file | |
run: | | |
CONFIG=$(cat << EOF | |
[serviceweaver] | |
binary = "./examples/echo/echo" | |
[kube] | |
image = ${{ env.IMAGE_NAME }} | |
listeners.echo = {public = true} | |
EOF | |
) | |
echo "$CONFIG" > ${{ env.CONFIG_FILE }} | |
- name: Build the docker image and push | |
run: ./cmd/weaver-kube/weaver-kube deploy ${{ env.CONFIG_FILE }} | |
- name: Deploy the application | |
run: kubectl apply -f ./kube_*.yaml | |
- name: Wait for the deployment to be ready | |
run: kubectl wait --for=condition=Available=True --timeout=90s Deployment -l serviceweaver/app_name=echo | |
- name: Call the echo endpoint | |
run: | | |
LOAD_BALANCER_NAME=$(kubectl get service -l serviceweaver/app_name=collatz -o=go-template --template='{{- range .items -}}{{- if eq .spec.type "LoadBalancer" -}}{{ .metadata.name }}{{- end -}}{{- end -}}') | |
kubectl run -i --rm --restart=Never --image=busybox:latest test-api --command wget -- -q -O - http://$LOAD_BALANCER_NAME?s=testme | |
- name: Display deployment logs | |
if: failure() | |
run: | | |
kubectl get all && \ | |
kubectl describe pod -l app_name=collatz && \ | |
kubectl logs -l app_name=collatz | |
- name: Upload manifest files | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: echo-kube-manifests | |
path: ./kube_*.yaml |