Skip to content

Change the integration tests. #59

Change the integration tests.

Change the integration tests. #59

Workflow file for this run

# 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: Srdjan
run: echo ${{env.IMAGE_NAME}}
- 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: Get the name of the echo listener service
run: |
NAME=$(timeout ${{ env.WAIT_TIMEOUT }} /bin/sh -c 'while true; do NAME=$(kubectl get service -l lisName=echo -o jsonpath={.items[].metadata.name}) && echo $NAME && break; done')
echo "SERVICE_NAME=$NAME" >> $GITHUB_ENV
- name: Call the echo endpoint until it succeeds
run: |
timeout ${{ env.WAIT_TIMEOUT }} /bin/sh -c 'while true; do kubectl run -i --rm --restart=Never --image=busybox:latest test-api --command wget -- -q -O - http://${{ env.SERVICE_NAME }}?s=testme && break; done'
- 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: failure()
uses: actions/upload-artifact@v3
with:
name: echo-kube-manifests
path: ./kube_*.yaml