Skip to content

Commit

Permalink
Update build process
Browse files Browse the repository at this point in the history
  • Loading branch information
twpayne committed Jan 17, 2021
1 parent 627dac8 commit dd49589
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 19 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
*.exe
/bin/chezmoi
/bin/gofumports
/bin/golangci-lint
Expand Down
16 changes: 8 additions & 8 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@ before:

builds:
- id: chezmoi-cgo-glibc
binary: chezmoi
env:
- CGO_ENABLED=1
goos:
- linux
goarch:
- amd64
- id: chezmoi-cgo-musl
binary: chezmoi
env:
- CC=/usr/bin/musl-gcc
- CGO_ENABLED=1
Expand All @@ -32,7 +30,6 @@ builds:
- '-linkmode external'
- '--extldflags "-static"'
- id: chezmoi-nocgo
binary: chezmoi
env:
- CGO_ENABLED=0
goos:
Expand Down Expand Up @@ -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 }}"
Expand All @@ -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
Expand Down
37 changes: 26 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit dd49589

Please sign in to comment.