2024-09-27 02:17:07 +00:00
|
|
|
export PATH := $(PATH):$(HOME)/go/bin
|
2024-05-29 03:16:41 +00:00
|
|
|
IMAGE?=fedora:latest
|
2024-09-27 02:17:07 +00:00
|
|
|
#LDFLAGS?=--ldflags '-extldflags "-static -ldl -lc -lm"' --ldflags="-X 'main.commit=$(shell git rev-parse HEAD)' -X 'main.version=$(shell git describe --tags)' -X 'main.date=$(shell date '+%Y-%m-%d %T.%s%z')'"
|
|
|
|
export CC?=muscl-gcc
|
2024-04-23 22:35:08 +00:00
|
|
|
LDFLAGS?=--ldflags '-extldflags "-static"' --ldflags="-X 'main.commit=$(shell git rev-parse HEAD)' -X 'main.version=$(shell git describe --tags)' -X 'main.date=$(shell date '+%Y-%m-%d %T.%s%z')'"
|
2024-09-27 02:17:07 +00:00
|
|
|
export CGO_ENABLED=1
|
2024-05-27 01:52:14 +00:00
|
|
|
VERSION?=$(shell git describe --tags | sed -e 's/^v//' -e 's/-/_/g')
|
2024-04-23 22:35:08 +00:00
|
|
|
.PHONY=jx-cli
|
2024-03-27 20:46:17 +00:00
|
|
|
|
2024-04-23 22:35:08 +00:00
|
|
|
build: jx-cli
|
|
|
|
|
|
|
|
jx-cli:
|
2024-04-22 06:24:38 +00:00
|
|
|
go build -o jx $(LDFLAGS) ./cmd/cli/main.go
|
2024-03-27 23:08:13 +00:00
|
|
|
|
2024-04-23 22:35:08 +00:00
|
|
|
test: jx-cli
|
2024-05-06 00:48:54 +00:00
|
|
|
go test -coverprofile=artifacts/coverage.profile ./...
|
|
|
|
go tool cover -html=artifacts/coverage.profile -o artifacts/code-coverage.html
|
2024-05-29 03:16:41 +00:00
|
|
|
fedora-deps:
|
2024-09-27 02:17:07 +00:00
|
|
|
./jx apply build/rpm.jx.yaml
|
2024-05-27 02:49:36 +00:00
|
|
|
spectool -g -R build/jx.spec
|
2024-05-29 03:16:41 +00:00
|
|
|
curl -L -o - https://go.dev/dl/go1.22.3.linux-amd64.tar.gz | tar -zxvf -
|
|
|
|
rpm: fedora-deps
|
|
|
|
echo Building $(VERSION)
|
2024-05-26 22:57:23 +00:00
|
|
|
rpmbuild -ba --define='version $(VERSION)' build/jx.spec
|
2024-05-29 03:16:41 +00:00
|
|
|
ubuntu-deps:
|
|
|
|
apt-get update -y
|
|
|
|
apt-get install -y git make libluajit-5.1-dev iproute2 gcc curl
|
|
|
|
curl -L -o - https://go.dev/dl/go1.22.3.linux-amd64.tar.gz | tar -zxvf -
|
|
|
|
deb: ubuntu-deps
|
|
|
|
:
|
|
|
|
run:
|
2024-09-27 02:17:07 +00:00
|
|
|
docker run -it -v $(HOME)/.git-credentials:/root/.git-credentials -v $(HOME)/.gitconfig:/root/.gitconfig -v /var/run/docker.sock:/var/run/docker.sock -v $(shell pwd):/src $(IMAGE) sh
|
|
|
|
run-alpine:
|
|
|
|
docker run -it -v $(HOME)/.git-credentials:/root/.git-credentials -v $(HOME)/.gitconfig:/root/.gitconfig -v /var/run/docker.sock:/var/run/docker.sock -v $(shell pwd):/src golang:1.22.6-alpine sh
|
2024-10-08 01:36:19 +00:00
|
|
|
build-container:
|
2024-11-10 18:27:31 +00:00
|
|
|
docker run -it -v $(HOME)/.git-credentials:/root/.git-credentials -v /tmp:/tmp -v $(HOME)/.gitconfig:/root/.gitconfig -v /var/run/docker.sock:/var/run/docker.sock -e WORKSPACE_PATH=$(shell pwd) -v $(shell pwd):/src -w /src rosskeenhouse/build-golang:1.22.6-alpine sh
|
2024-05-29 03:16:41 +00:00
|
|
|
clean:
|
|
|
|
go clean -modcache
|
|
|
|
rm jx
|
2024-09-27 02:17:07 +00:00
|
|
|
go-deps:
|
|
|
|
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
|
|
|
|
go install golang.org/x/vuln/cmd/govulncheck@latest
|
2024-07-01 21:54:18 +00:00
|
|
|
lint:
|
|
|
|
golangci-lint run --verbose ./...
|
2024-07-17 08:34:57 +00:00
|
|
|
vulncheck:
|
|
|
|
govulncheck ./...
|
|
|
|
go vet ./...
|