1
0
mirror of https://github.com/mudler/luet.git synced 2025-05-06 07:16:29 +00:00
luet/Makefile

92 lines
2.2 KiB
Makefile
Raw Permalink Normal View History

# go tool nm ./luet | grep Commit
2020-05-26 19:07:09 +00:00
override LDFLAGS += -X "github.com/mudler/luet/cmd.BuildTime=$(shell date -u '+%Y-%m-%d %I:%M:%S %Z')"
override LDFLAGS += -X "github.com/mudler/luet/cmd.Version=$(shell git describe --dirty --always --tags)"
2019-06-05 16:20:39 +00:00
NAME ?= luet
PACKAGE_NAME ?= $(NAME)
PACKAGE_CONFLICT ?= $(PACKAGE_NAME)-beta
ROOT_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
2019-06-05 16:20:39 +00:00
.PHONY: all
all: deps build
2019-11-05 16:21:06 +00:00
.PHONY: fmt
fmt:
go fmt ./...
2019-06-05 16:20:39 +00:00
.PHONY: test
test:
2024-08-01 07:05:03 +00:00
go run github.com/onsi/ginkgo/v2/ginkgo -r --flake-attempts=3 ./...
2019-06-05 16:20:39 +00:00
2019-12-31 14:22:11 +00:00
.PHONY: test-integration
test-integration:
tests/integration/run.sh
2019-06-11 16:04:57 +00:00
.PHONY: coverage
coverage:
2024-08-01 07:05:03 +00:00
go run github.com/onsi/ginkgo/v2/ginkgo --flake-attempts=3 --fail-fast -cover -covermode=atomic -coverprofile=coverage.txt -r .
2019-06-05 16:20:39 +00:00
.PHONY: help
help:
# make all => deps test lint build
# make deps - install all dependencies
# make test - run project tests
# make lint - check project code style
# make build - build project for all supported OSes
.PHONY: clean
clean:
rm -rf release/
2019-12-31 14:22:11 +00:00
rm -rf tests/integration/shunit2
rm -rf tests/integration/bin
2019-06-05 16:20:39 +00:00
.PHONY: deps
deps:
go env
# Installing dependencies...
2024-06-24 14:01:00 +00:00
go get golang.org/x/lint/golint
go get github.com/mitchellh/gox
2019-06-05 16:20:39 +00:00
.PHONY: build
build:
CGO_ENABLED=0 go build -ldflags '$(LDFLAGS)'
2020-05-26 19:07:09 +00:00
.PHONY: build-small
build-small:
@$(MAKE) LDFLAGS+="-s -w" build
2020-06-12 16:47:18 +00:00
upx --brute -1 $(NAME)
2020-05-26 19:07:09 +00:00
.PHONY: image
image:
docker build --rm -t luet/base .
2019-06-05 16:20:39 +00:00
.PHONY: lint
lint:
golint ./... | grep -v "be unexported"
2019-11-10 17:04:06 +00:00
.PHONY: vendor
vendor:
go mod vendor
.PHONY: test-docker
test-docker:
docker run -v $(ROOT_DIR):/go/src/github.com/mudler/luet \
--workdir /go/src/github.com/mudler/luet -ti golang:latest \
bash -c "make test"
.PHONY: test-integration-docker
test-integration-docker:
docker run -v $(ROOT_DIR):/go/src/github.com/mudler/luet -v /var/run/docker.sock:/var/run/docker.sock \
--workdir /go/src/github.com/mudler/luet -ti golang:latest \
bash -c "apt-get update && apt-get install docker.io && make test-integration"
multiarch-build:
goreleaser build --snapshot --clean
multiarch-build-small:
@$(MAKE) multiarch-build
for file in $(ROOT_DIR)/release/**/* ; do \
upx --brute -1 $${file} ; \
done