diff --git a/.gitignore b/.gitignore index d3712c9948c..c326f705e93 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +*.exe /bin/chezmoi /bin/gofumports /bin/golangci-lint diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 25a33b07f1d..546d4773168 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -6,7 +6,6 @@ before: builds: - id: chezmoi-cgo-glibc - binary: chezmoi env: - CGO_ENABLED=1 goos: @@ -14,7 +13,6 @@ builds: goarch: - amd64 - id: chezmoi-cgo-musl - binary: chezmoi env: - CC=/usr/bin/musl-gcc - CGO_ENABLED=1 @@ -32,7 +30,6 @@ builds: - '-linkmode external' - '--extldflags "-static"' - id: chezmoi-nocgo - binary: chezmoi env: - CGO_ENABLED=0 goos: @@ -94,9 +91,11 @@ nfpms: dependencies: - git bindir: /usr/bin - files: - "completions/chezmoi-completion.bash": "/usr/share/bash-completion/completions/chezmoi" - "completions/chezmoi.fish": "/usr/share/fish/completions/chezmoi.fish" + contents: + - src: completions/chezmoi-completion.bash + dst: /usr/share/bash-completion/completions/chezmoi + - src: completions/chezmoi.fish + dst: /usr/share/fish/completions/chezmoi.fish overrides: deb: file_name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}" @@ -112,8 +111,9 @@ nfpms: 386: i686 arm: armhfp arm64: aarch64 - files: - "completions/chezmoi.zsh": "/usr/share/zsh/functions/_chezmoi" + contents: + - src: completions/chezmoi.zsh + dst: /usr/share/zsh/functions/_chezmoi - id: apks builds: - chezmoi-cgo-musl diff --git a/Makefile b/Makefile index 38511ca2d51..2f1cf30c9ae 100644 --- a/Makefile +++ b/Makefile @@ -1,31 +1,46 @@ GOLANGCI_LINT_VERSION=1.35.2 .PHONY: default -default: generate run test lint format +default: generate build run test lint format -.PHONT: generate -generate: - go generate +.PHONY: build +build: build-darwin build-linux build-windows -.PHONY: generate-install.sh -generate-install.sh: - go run ./internal/cmd/generate-install.sh > assets/scripts/install.sh +.PHONY: build-darwin +build-darwin: generate + GOOS=darwin GOARCH=amd64 go build -o /dev/null . + +.PHONY: build-linux +build-linux: generate + GOOS=linux GOARCH=amd64 go build -o /dev/null . + +.PHONY: build-windows +build-windows: generate + GOOS=windows GOARCH=amd64 go build -o /dev/null . .PHONY: run -run: +run: generate go run . --version +.PHONY: generate +generate: + go generate + .PHONY: test -test: +test: generate go test ./... +.PHONY: generate-install.sh +generate-install.sh: + go run ./internal/cmd/generate-install.sh > assets/scripts/install.sh + .PHONY: lint -lint: ensure-golangci-lint +lint: ensure-golangci-lint generate ./bin/golangci-lint run go run ./internal/cmd/lint-whitespace .PHONY: format -format: ensure-gofumports +format: ensure-gofumports generate find . -name \*.go | xargs ./bin/gofumports -local github.com/twpayne/chezmoi -w .PHONY: ensure-tools