Skip to content

Integration Test

Integration Test #499

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
WAIT_TIMEOUT: "25m"
on:
schedule:
# Every day at 9am PST. For syntax, see:
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#schedule
- cron: '0 16 * * *'
pull_request:
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Check out the repository.
uses: actions/checkout@v3
- name: Load Google Cloud Credentials
uses: google-github-actions/auth@v1
with:
credentials_json: '${{ secrets.GCP_CREDENTIALS }}'
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v1
- name: Install GKE cloud plugin
run: gcloud components install gke-gcloud-auth-plugin
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 'stable'
cache: true
- name: Build weaver-gke
run: cd cmd/weaver-gke; go build .
- name: Build the echo app
run: cd examples/echo; go build .
- name: Generate a random deployment number
run: echo "VERSION=v$RANDOM" >> $GITHUB_ENV
- name: Generate app config file
run: |
CONFIG=$(cat << EOF
[serviceweaver]
binary = "./examples/echo/echo"
name = "echo-${{env.VERSION}}"
[gke]
regions= ["us-west1"]
listeners.echo = {is_public=true, hostname = "echo.serviceweaver.dev"}
["github.com/ServiceWeaver/weaver-gke/examples/echo/Echoer"]
Pattern = "${{env.VERSION}}"
EOF
)
echo "$CONFIG" > ${{ env.CONFIG_FILE }}
cat ${{ env.CONFIG_FILE }}
- name: Deploy the echo app
run: ./cmd/weaver-gke/weaver-gke deploy --detach ${{ env.CONFIG_FILE }}
- name: Wait until ready
# TODO(spetrovic): use the hostname directly once we change the DNS
# records to point to the IP address below.
run: |
timeout ${{ env.WAIT_TIMEOUT }} /bin/sh -c 'while true; do wget -O- -T 10 --header "Host: echo.serviceweaver.dev" http://34.128.184.184:80?s=${{env.VERSION}} && break; sleep 15; done'
- name: Cleanup the echo app
if: always()
run:
./cmd/weaver-gke/weaver-gke kill --force echo-${{env.VERSION}} || true