Skip to content

Vmcluster lb

Vmcluster lb #2534

Workflow file for this run

name: Build and Test
# This workflow will run on master branch and on any pull requests targeting master
on:
push:
branches:
- master
pull_request:
branches:
- master
types:
- opened
- reopened
- synchronize
- ready_for_review
- converted_to_draft
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
build:
name: Build and Test
runs-on: ubuntu-latest
steps:
- name: Free space
run: |
# cleanup up space to free additional ~20GiB of memory
# which are lacking for multiplaform images build
formatByteCount() { echo $(numfmt --to=iec-i --suffix=B --padding=7 $1'000'); }
getAvailableSpace() { echo $(df -a $1 | awk 'NR > 1 {avail+=$4} END {print avail}'); }
BEFORE=$(getAvailableSpace)
sudo rm -rf /usr/local/lib/android || true
sudo rm -rf /usr/share/dotnet || true
sudo rm -rf /opt/ghc || true
sudo rm -rf /usr/local/.ghcup || true
AFTER=$(getAvailableSpace)
SAVED=$((AFTER-BEFORE))
echo "Saved $(formatByteCount $SAVED)"
- name: Checkout code
uses: actions/checkout@v4
- name: Restore binaries from cache
uses: actions/cache/restore@v4
with:
path: ./bin
key: binary
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "1.23"
id: go
- name: Set output variables
id: vars
run: |
IMAGE_TAG=${GITHUB_SHA:0:7}
echo "IMAGE_TAG=$IMAGE_TAG" >> $GITHUB_OUTPUT
- name: Lint, Test and Build
if: github.event.pull_request.draft == false
env:
GO111MODULE: on
DOCKER_BUILD_ARGS: --cache-from=type=gha --cache-to=type=gha,mode=max
TAG: ${{ steps.vars.outputs.IMAGE_TAG }}
run: |
make lint
make test
TAG=${TAG} make test-e2e
if [ -n '${{secrets.REPO_KEY}}' ]; then
echo ${{secrets.REPO_KEY}} | docker login --username ${{secrets.REPO_USER}} --password-stdin
make publish
else
echo "there is no docker secret, just build"
make build
fi
- name: Prapare binary cache
uses: actions/cache@v4
with:
path: ./bin
key: binary