Skip to content

Commit

Permalink
Switch to goreleaser for builds and drop upx
Browse files Browse the repository at this point in the history
Have found that UPX is providing more issues than value. We'll no longer
use UPX to compress the binaries. Will begin switching from a somewhat
manual build and release process to goreleaser. The resulting binaries
will be archived and compressed for download but not themselves compressed.

issue #14
  • Loading branch information
abtreece committed Jun 3, 2021
1 parent afcf000 commit 943899f
Show file tree
Hide file tree
Showing 9 changed files with 69 additions and 68 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
bin/
dist/
49 changes: 49 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
env:
- GO111MODULE=on
before:
hooks:
- go mod tidy
builds:
- binary: confd
env:
- CGO_ENABLED=0
ldflags: -s -w -X main.GitSHA={{ .ShortCommit }}
goos:
- darwin
- linux
- windows
goarch:
- amd64
- arm
- arm64
goarm:
- 7
ignore:
- goos: windows
goarch: arm
archives:
- name_template: '{{.ProjectName}}-{{.Tag}}-{{.Os}}-{{.Arch}}{{if .Arm}}{{.Arm}}{{end}}'
replacements:
darwin: darwin
linux: linux
windows: windows
amd64: amd64
arm: arm
arm64: arm64
format: tar.gz
format_overrides:
- goos: windows
format: zip
files:
- none*
checksum:
name_template: 'checksums.txt'
algorithm: sha256
snapshot:
name_template: "{{ .Tag }}-dev"
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
golang 1.16.4
10 changes: 10 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
### v0.18.1

064faf8 - Advance Go to 1.16.4, drop UPX, Switch to goreleaser for builds
afcf000 - Advance Go to 1.15.12 and update Makefile (abtreece)
79bf98b - Bump github/super-linter from v3.15.3 to v3.15.5 (#11) (dependabot[bot])
6bf2dbc - Bump github/super-linter from v3.15.1 to v3.15.3 (dependabot[bot])
c3cec66 - Bump github/super-linter from v3 to v3.15.1 (dependabot[bot])
9842e18 - Move divergent fork note to top of README (Britt Treece)
4f8e4f1 - Add Dependabot configurations for gomod and gha (Britt Treece)

### v0.18.0

dbd6fba - Add CodeQL status badge to README (abtreece)
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.15.12-alpine
FROM golang:1.16.4-alpine

RUN apk add --no-cache make git
RUN mkdir -p /go/src/github.com/abtreece/confd && \
Expand Down
15 changes: 5 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,9 @@ integration:
mod:
@go mod tidy


snapshot:
@goreleaser --snapshot --skip-publish --rm-dist

release:
@docker build -q -t confd_builder -f Dockerfile .
@for platform in darwin linux windows; do \
if [ $$platform == windows ]; then extension=.exe; fi; \
docker run --rm -it -v ${PWD}:/app -e "GOOS=$$platform" -e "GOARCH=amd64" -e "CGO_ENABLED=0" confd_builder go build -ldflags="-s -w -X main.GitSHA=${GIT_SHA}" -o bin/confd-${VERSION}-$$platform-amd64$$extension; \
docker run --rm -it -v ${PWD}:/tmp hairyhenderson/upx:3.96 -q /tmp/bin/confd-${VERSION}-$$platform-amd64$$extension; \
done
@docker run --rm -it -v ${PWD}:/app -e "GOOS=linux" -e "GOARCH=arm64" -e "CGO_ENABLED=0" confd_builder go build -ldflags="-s -w -X main.GitSHA=${GIT_SHA}" -o bin/confd-${VERSION}-linux-arm64; \
docker run --rm -it -v ${PWD}:/tmp hairyhenderson/upx:3.94 -q /tmp/bin/confd-${VERSION}-linux-arm64;
@docker run --rm -it -v ${PWD}:/app -e "GOOS=linux" -e "GOARCH=arm" -e "CGO_ENABLED=0" confd_builder go build -ldflags="-s -w -X main.GitSHA=${GIT_SHA}" -o bin/confd-${VERSION}-linux-arm32; \
docker run --rm -it -v ${PWD}:/tmp hairyhenderson/upx:3.94 -q /tmp/bin/confd-${VERSION}-linux-arm32;
@goreleaser --skip-publish --rm-dist
3 changes: 1 addition & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/abtreece/confd

go 1.15
go 1.16

require (
github.com/BurntSushi/toml v0.3.1
Expand Down Expand Up @@ -46,7 +46,6 @@ require (
github.com/sirupsen/logrus v1.7.1
github.com/stretchr/testify v1.6.1 // indirect
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5 // indirect
go.etcd.io/bbolt v1.3.5 // indirect
go.etcd.io/etcd v3.3.25+incompatible
go.uber.org/multierr v1.6.0 // indirect
go.uber.org/zap v1.16.0 // indirect
Expand Down
54 changes: 0 additions & 54 deletions go.sum

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion version.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package main

const Version = "0.18.1-dev"
const Version = "0.18.1"

// We want to replace this variable at build time with "-ldflags -X main.GitSHA=xxx", where const is not supported.
var GitSHA = ""

0 comments on commit 943899f

Please sign in to comment.