# The checks that CI runs. .PHONY: test test: test-go test-sidecar test-deploy STATICCHECK ?= staticcheck # CI's workflow pod has no C compiler, so it sets RACE empty. RACE ?= -race .PHONY: test-go test-go: test -z "$$(gofmt -l .)" || { gofmt -l .; exit 1; } go mod tidy -diff go vet ./... $(STATICCHECK) ./... go test $(RACE) -covermode=atomic -coverprofile=coverage.out ./... .PHONY: test-sidecar test-sidecar: cd sidecar && npm ci --silent && npm test KUSTOMIZE ?= kubectl kustomize .PHONY: test-deploy test-deploy: $(KUSTOMIZE) deploy > /dev/null # The sidecar's image, with Chrome for Testing at the current stable # version, and the smoke test that proves it before anything pushes it. # CI reads the version from chrome-version and builds the same two # targets with docker buildx, adding OCI labels to each. CHROME_VERSION ?= $(shell curl -fsS --max-time 30 https://googlechromelabs.github.io/chrome-for-testing/last-known-good-versions.json | jq -r .channels.Stable.version) PKG_DATE ?= $(shell date -u +%Y%m%d) SIDECAR_IMAGE ?= gofer-sidecar:dev .PHONY: chrome-version chrome-version: @echo $(CHROME_VERSION) .PHONY: sidecar-image sidecar-image: chrome=$(CHROME_VERSION) \ && docker build --pull --target image --build-arg CHROME_VERSION=$$chrome --build-arg PKG_DATE=$(PKG_DATE) -t $(SIDECAR_IMAGE) sidecar \ && docker build --target test --build-arg CHROME_VERSION=$$chrome --build-arg PKG_DATE=$(PKG_DATE) sidecar