Skip to content

fix(container): extend registry wait to 900s and track skipped steps #286

fix(container): extend registry wait to 900s and track skipped steps

fix(container): extend registry wait to 900s and track skipped steps #286

Workflow file for this run

name: Build
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
name: Build and Test
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Cache Go modules
uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Download dependencies
run: go mod download
- name: Verify dependencies
run: go mod verify
- name: Run go vet
run: go vet ./...
- name: Run go fmt
run: |
if [ "$(gofmt -s -l . | grep -v '^vendor/' | wc -l)" -gt 0 ]; then
echo "The following files need formatting:"
gofmt -s -l . | grep -v '^vendor/'
exit 1
fi
- name: Run tests
run: go test -v -race -coverprofile=coverage.txt -covermode=atomic ./...
- name: Check coverage threshold
# Raise THRESHOLD progressively as sibling issues are resolved:
# ≥62% after #61 (API-error cases)
# ≥70% after #62 (update tests)
# ≥75% after #63 (output + flags)
run: |
COVERAGE=$(go tool cover -func=coverage.txt | grep "^total:" | awk '{print $3}' | tr -d '%')
echo "Total coverage: ${COVERAGE}%"
if awk "BEGIN {exit !($COVERAGE < $THRESHOLD)}"; then
echo "Coverage ${COVERAGE}% is below threshold ${THRESHOLD}%"
exit 1
fi
env:
THRESHOLD: 70
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.txt
flags: unittests
fail_ci_if_error: false
- name: Build
run: go build -v -o acloud
- name: Test binary
run: ./acloud --help
build-cross-platform:
name: Cross-platform Build
runs-on: ubuntu-latest
strategy:
matrix:
include:
- goos: linux
goarch: amd64
- goos: linux
goarch: arm64
- goos: darwin
goarch: amd64
- goos: darwin
goarch: arm64
- goos: windows
goarch: amd64
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
run: |
GO_VERSION=$(grep '^go ' go.mod | awk '{print $2}')
wget -q "https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz" -O /tmp/go.tar.gz
sudo rm -rf /usr/local/go
sudo tar -C /usr/local -xzf /tmp/go.tar.gz
echo "/usr/local/go/bin" >> "$GITHUB_PATH"
- name: Build ${{ matrix.goos }}/${{ matrix.goarch }}
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
run: |
if [ "${{ matrix.goos }}" = "windows" ]; then
go build -v -o acloud-${{ matrix.goos }}-${{ matrix.goarch }}.exe
else
go build -v -o acloud-${{ matrix.goos }}-${{ matrix.goarch }}
fi