Pass WLM Client to redis service. #509
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
# This workflow will build a golang project | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go | |
name: go-build-and-test | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Add workloadagentplatform submodule | |
run: | | |
git submodule add https://github.com/GoogleCloudPlatform/workloadagentplatform | |
cd workloadagentplatform | |
git checkout c271b7e1b5adb90dff344c969bb44ee1133d0f8c | |
cd .. | |
find workloadagentplatform/sharedprotos -type f -exec sed -i 's|"sharedprotos|"workloadagentplatform/sharedprotos|g' {} + | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: '1.23.2' | |
- name: Install Protoc | |
uses: arduino/setup-protoc@v3 | |
- name: Install protoc-gen-go | |
run: | | |
go install github.com/golang/protobuf/protoc-gen-go@latest | |
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest | |
- name: Compile protocol buffers | |
run: | | |
export PATH=${PATH}:`go env GOPATH`/bin | |
protoc --go_opt=paths=source_relative protos/**/*.proto workloadagentplatform/sharedprotos/**/*.proto --go_out=. | |
- name: Get the latest dependency versions | |
run: | | |
cp go.mod go.mod.orig | |
cp go.sum go.sum.orig | |
go clean -modcache | |
go mod tidy | |
echo "**************************** Latest go.mod dependencies ****************************" | |
cat go.mod | |
echo "**************************** Latest go.sum dependencies ****************************" | |
cat go.sum | |
echo "**************************** End of dependencies ****************************" | |
mv go.mod.orig go.mod | |
mv go.sum.orig go.sum | |
go clean -modcache | |
- name: Install dependencies in vendor mode | |
run: go mod vendor | |
- name: Build linux binary | |
run: env GOOS=linux GOARCH=amd64 go build -mod=vendor -v -o ../google_cloud_workload_agent | |
working-directory: cmd | |
- name: Build windows binary | |
run: env GOOS=windows GOARCH=amd64 go build -mod=vendor -v -o ../google_cloud_workload_agent | |
working-directory: cmd | |
- name: Test | |
run: go test -v ./... | |
- name: Notify on failure | |
if: ${{ failure() && contains(github.ref, 'main') }} | |
uses: cinotify/github-action@main | |
with: | |
to: '[email protected]' | |
subject: '[Failure] GitHub Workload Agent build failure' | |
body: 'There was a failure for the GitHub Workload Agent workflow action.\n\n https://github.com/GoogleCloudPlatform/workloadagent/actions/runs/${{ github.run_id }}' |