Все проверки выполнены успешно
CI / test (push) Successful in 3m33s
Docker / Build and publish worker image (push) Successful in 18m37s
60 строки
1.8 KiB
Makefile
60 строки
1.8 KiB
Makefile
BINARY := bin/rsmon-worker
|
|
VERSION ?= dev
|
|
COMMIT ?= $(shell git rev-parse --short=12 HEAD 2>/dev/null || printf unknown)
|
|
BUILD_DATE ?= $(shell date -u +%Y-%m-%dT%H:%M:%SZ)
|
|
LDFLAGS := -s -w -X main.version=$(VERSION) -X main.commit=$(COMMIT) -X main.buildDate=$(BUILD_DATE)
|
|
|
|
.PHONY: build test test-ssh check image clean
|
|
|
|
build:
|
|
mkdir -p bin
|
|
CGO_ENABLED=0 go build -trimpath -ldflags="$(LDFLAGS)" -o $(BINARY) ./cmd/rsmon-worker
|
|
|
|
test:
|
|
# RSMON_TEST_DOCKER=0 pins this target to the non-Docker unit run even
|
|
# if a developer has the opt-in flag exported in their environment;
|
|
# only the explicit `make test-ssh` target starts containers.
|
|
RSMON_ENV=test CWD=$(CURDIR) RSMON_TEST_DOCKER=0 go test \
|
|
./cmd/rsmon-worker \
|
|
./internal/distworker \
|
|
./internal/installer \
|
|
./internal/installer/harness \
|
|
./internal/sshinstall \
|
|
./internal/webapp \
|
|
./internal/compose \
|
|
./internal/workercluster \
|
|
./internal/wire \
|
|
./internal/checkexec \
|
|
./checks/calls \
|
|
./checks/cbssl \
|
|
./checks/cdns \
|
|
./checks/cftp \
|
|
./checks/chttp \
|
|
./checks/cping \
|
|
./checks/cssh \
|
|
./checks/cssl \
|
|
./checks/ctcp \
|
|
./checks/cudp \
|
|
./checks/cwhois \
|
|
./checks/llmhttp
|
|
|
|
# test-ssh runs the Docker/OpenSSH source-install harness tests against
|
|
# real Alpine, Ubuntu, and Arch fixtures. Requires a working Docker
|
|
# daemon; the fixtures pull/start containers, so this is opt-in and is
|
|
# never part of the default `make test` run.
|
|
test-ssh:
|
|
RSMON_ENV=test CWD=$(CURDIR) RSMON_TEST_DOCKER=1 go test \
|
|
-v -timeout 30m -count=1 ./internal/installer/harness
|
|
|
|
check:
|
|
go mod tidy
|
|
git diff --exit-code -- go.mod go.sum
|
|
$(MAKE) test
|
|
$(MAKE) build
|
|
|
|
image:
|
|
docker build --build-arg VERSION=$(VERSION) --build-arg COMMIT=$(COMMIT) --build-arg BUILD_DATE=$(BUILD_DATE) -t rsmon-worker:local .
|
|
|
|
clean:
|
|
rm -rf bin dist
|