Skip to content

KUBE-552: check for aliveness without blocking on receive from stream #57

KUBE-552: check for aliveness without blocking on receive from stream

KUBE-552: check for aliveness without blocking on receive from stream #57

Workflow file for this run

name: Build
on:
push:
branches:
- main
release:
types:
- published
pull_request:
branches:
- main
jobs:
build:
name: Build
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: 1.22.6
- name: Cache Go modules
uses: actions/cache@v3
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-build-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-build-
- name: Get release tag
if: github.event_name == 'release'
run: echo "RELEASE_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Build Go binary amd64
run: go build -ldflags "-s -w -X main.GitCommit=$GITHUB_SHA -X main.GitRef=$GITHUB_REF -X main.Version=${RELEASE_TAG:-commit-$GITHUB_SHA}" -o bin/castai-cloud-proxy-amd64 ./cmd/proxy
env:
GOOS: linux
GOARCH: amd64
CGO_ENABLED: 0
- name: Build Go binary arm64
run: go build -ldflags "-s -w -X main.GitCommit=$GITHUB_SHA -X main.GitRef=$GITHUB_REF -X main.Version=${RELEASE_TAG:-commit-$GITHUB_SHA}" -o bin/castai-cloud-proxy-arm64 ./cmd/proxy
env:
GOOS: linux
GOARCH: arm64
CGO_ENABLED: 0
- name: Test
run: go test -race ./...
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
# TODO: uncomment after Helm chart is released
# - name: Create k8s Kind Cluster
# uses: helm/kind-action@v1
# with:
# cluster_name: cloud-proxy-e2e
# - uses: azure/[email protected]
# - name: Run e2e tests
# run: |
# echo "$GCP_CREDENTIALS_JSON" > "$GCP_CREDENTIALS"
# ./e2e/run.sh
# env:
# GCP_CREDENTIALS_JSON: ${{ secrets.TEST_GCP_CREDENTIALS }}
# GCP_CREDENTIALS: gcp-credentials.json
- name: Login to Google Artifact Registry
uses: docker/login-action@v3
with:
registry: us-docker.pkg.dev
username: _json_key
password: ${{ secrets.ARTIFACT_BUILDER_JSON_KEY }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
if: ${{ github.event_name == 'pull_request' }}
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push pr
if: github.event_name == 'pull_request'
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/arm64,linux/amd64
push: ${{ github.event_name == 'pull_request' }}
tags: ghcr.io/castai/cloud-proxy:${{ github.sha }}
- name: Build and push main
if: github.event_name != 'release'
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/arm64,linux/amd64
push: ${{ github.event_name != 'pull_request' }}
tags: |
us-docker.pkg.dev/castai-hub/library/cloud-proxy:${{ github.sha }}
- name: Build and push release
if: github.event_name == 'release'
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/arm64,linux/amd64
push: true
tags: |
us-docker.pkg.dev/castai-hub/library/cloud-proxy:${{ env.RELEASE_TAG }}
us-docker.pkg.dev/castai-hub/library/cloud-proxy:latest