From 4c1a70e412d5b350a3ced79730f66d073f390eaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20H=C3=A5rek=20Andreassen?= Date: Sat, 26 Oct 2024 19:04:22 +0200 Subject: [PATCH] chore: Replace justfile with Makefile MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Tim HĂ„rek Andreassen --- .build.yml | 12 ++++++------ Makefile | 41 +++++++++++++++++++++++++++++++++++++++++ justfile | 38 -------------------------------------- 3 files changed, 47 insertions(+), 44 deletions(-) create mode 100644 Makefile delete mode 100644 justfile diff --git a/.build.yml b/.build.yml index 65139dd..3c11967 100644 --- a/.build.yml +++ b/.build.yml @@ -2,7 +2,7 @@ image: alpine/edge oauth: git.sr.ht/OBJECTS:RW git.sr.ht/REPOSITORIES:RO git.sr.ht/PROFILE:RO packages: - go - - just + - make - hut sources: - git@git.sr.ht:~timharek/yr @@ -14,7 +14,7 @@ tasks: - setup: | echo 'cd yr' >> ~/.buildenv - test: | - just test + make test - build: | tag=$(git describe --exact-match --tags HEAD 2>/dev/null || true) if [ -z "$tag" ]; then @@ -24,7 +24,7 @@ tasks: version=$(echo "$tag" | tr -d 'v') - just build-release $tag $version darwin amd64 - just build-release $tag $version darwin arm64 - just build-release $tag $version linux amd64 - just build-release $tag $version windows amd64 + make GOOS="darwin" ARCH="amd64" build-release + make GOOS="dawrin" ARCH="aarch64" build-release + make GOOS="linux" ARCH="amd64" build-release + make GOOS="windows" ARCH="amd64" build-release diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..f753898 --- /dev/null +++ b/Makefile @@ -0,0 +1,41 @@ +prefix = /usr/local + +# Support upper case PREFIX +ifneq ($(PREFIX),) + prefix := $(PREFIX) +endif + +bindir = $(prefix)/bin +builddir = ./build + +VERSION = 0.0.5 + +.PHONY: build +build: + go build -o $(builddir) + +.PHONY: install +install: build + install -m 0755 $(builddir)/yr $(bindir) + +.PHONY: clean +clean: + rm -f $(builddir)/* + rm -rf yr-* + rm -f yr-*.tar.gz + +.PHONY: build-release +build-release: build + mkdir -p yr-$(VERSION) + cp $(builddir)/yr* yr-$(VERSION)/ + + tar czf yr-$(VERSION)-$(GOOS)-$(ARCH).tar.gz yr-$(VERSION) + hut git artifact upload --rev $(tag) yr-$(VERSION)-$(GOOS)-$(ARCH).tar.gz + +.PHONY: test +test: + go test ./... + +.PHONY: vet +vet: + go vet ./... diff --git a/justfile b/justfile deleted file mode 100644 index ba2866d..0000000 --- a/justfile +++ /dev/null @@ -1,38 +0,0 @@ -builddir := "./build" -prefix := env_var_or_default("PREFIX", "/usr/local") -bindir := prefix + "/bin" - -default: - just --list - -dev +args='--help': - go run main.go {{args}} - -test: - go test ./... - -tidy: - go mod tidy - -vet: - go vet ./... - -clean: - rm -f build/* - rm -rf yr-* - rm -f yr-*.tar.gz - -build: - go build -o {{builddir}}/ - -build-release tag version os arch: - GOOS="{{os}}" GOARCH="{{arch}}" just build - - mkdir -p yr-{{version}} - cp {{builddir}}/yr* yr-{{version}}/ - - tar czf yr-{{version}}-{{os}}-{{arch}}.tar.gz yr-{{version}} - hut git artifact upload --rev {{tag}} yr-{{version}}-{{os}}-{{arch}}.tar.gz - -install: build - install -m 0755 {{builddir}}/yr {{bindir}}