From 0ff72b99d914461030e8f5f6fafd8c6bc7977d3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Motiejus=20Jak=C5=A1tys?= Date: Wed, 29 Sep 2021 14:29:26 +0300 Subject: [PATCH] remove unnecessary support for prebuilt binaries the users will know how to build the binaries themselves. --- .build.yml | 3 --- Makefile | 31 ++++--------------------------- release | 28 +++++++--------------------- 3 files changed, 11 insertions(+), 51 deletions(-) diff --git a/.build.yml b/.build.yml index cab512c..306c8f8 100644 --- a/.build.yml +++ b/.build.yml @@ -13,8 +13,5 @@ tasks: make -C undocker coverage.html - lint: | make -C undocker -O -j$(nproc) lint - - binaries: | - make -C undocker -O -j$(nproc) all - cat undocker/sha256sum-*.txt artifacts: - undocker/coverage.html diff --git a/Makefile b/Makefile index 7a1d5da..6ac20ef 100644 --- a/Makefile +++ b/Makefile @@ -1,32 +1,15 @@ SCRIPTS = $(shell awk '/#!\/bin\/(ba)?sh/&&FNR==1{print FILENAME}' $(shell git ls-files)) GODEPS = $(shell git ls-files '*.go' go.mod go.sum) -GOOSARCHS = $(sort darwin/amd64 linux/amd64) VSN ?= $(shell git describe --dirty) VSNHASH = $(shell git rev-parse --verify HEAD) LDFLAGS = -ldflags "-X main.Version=$(VSN) -X main.VersionHash=$(VSNHASH)" undocker: ## builds binary for the current architecture - CGO_ENABLED=0 go build $(LDFLAGS) -o $@ + go build $(LDFLAGS) -o $@ .PHONY: test -test: - go test -race -cover ./... - -define undockertarget -UNDOCKERS += undocker-$(1)-$(2)-$(VSN) -undocker-$(1)-$(2)-$(VSN): $(GODEPS) - CGO_ENABLED=0 GOOS=$(1) GOARCH=$(2) go build $(LDFLAGS) -o $$@ -endef - -$(foreach goosarch,$(GOOSARCHS),\ - $(eval $(call undockertarget,$(word 1,$(subst /, ,$(goosarch))),$(word 2,$(subst /, ,$(goosarch)))))) - -.PHONY: all -all: $(UNDOCKERS) sha256sum-$(VSN).txt - -.PHONY: sha256sum-asc -sha256sum-asc: sha256sum-$(VSN).txt.asc +test: coverage.out .PHONY: lint lint: @@ -36,17 +19,11 @@ lint: .INTERMEDIATE: coverage.out coverage.out: $(GODEPS) - go test -coverprofile $@ ./... + go test -race -cover -coverprofile $@ ./... coverage.html: coverage.out go tool cover -html=$< -o $@ -sha256sum-$(VSN).txt: $(UNDOCKERS) - sha256sum $(UNDOCKERS) > $@ - -sha256sum-$(VSN).txt.asc: sha256sum-$(VSN).txt - gpg --clearsign $< - .PHONY: clean clean: - rm -f undocker-*-v* coverage.html sha256sum*.txt sha256sum*.txt.asc + rm -f undocker-*-v* coverage.html diff --git a/release b/release index 38659e8..e5c8f92 100755 --- a/release +++ b/release @@ -1,39 +1,25 @@ #!/bin/bash set -euo pipefail -err() { - >&2 echo "ERROR: $*" - exit 1 -} +_err(){ >&2 echo "ERROR: $*"; exit 1; } git status --porcelain | grep -q "" && - err "working tree is dirty, commit your changes first." - -# https://raimue.blog/2010/09/09/bash-for-loop-with-glob-patterns/ -shopt -s nullglob -for file in sha256sum-*; do - err "found $file from previous release, delete it first" -done -shopt -u nullglob + _err "working tree is dirty, commit your changes first." [[ "$1" =~ ^v([0-9]+)\.([0-9]+)(\.([0-9]+))?$ ]] || \ - err "arg1 accepts the following formats: v1.0 v1.0.0" + _err "arg1 accepts the following formats: v1.0 v1.0.0" git tag | grep -q "^$1$" && - err "tag $1 already exists" + _err "tag $1 already exists" + +# sanity test: do the tests pass? +make -B -j"$(nproc)" test lint last_tag=$(git tag | tail -1) -make -B -j"$(nproc)" VSN="$1" sha256sum-asc - { echo undocker "$1" echo echo Changelog since "$last_tag": git log --pretty=format:"- [%cn] %s" "$last_tag"..HEAD - echo - echo - echo sha256sums of released binaries: - cat sha256sum-*.txt - echo } | git tag -u motiejus@jakstys.lt -F - "$1"