-
Notifications
You must be signed in to change notification settings - Fork 79
Expand file tree
/
Copy pathMakefile
More file actions
50 lines (39 loc) · 1.2 KB
/
Makefile
File metadata and controls
50 lines (39 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
.PHONY: build test integration lint lint-actions coverage dist test-release
PLATFORMS = linux darwin
ARCHITECTURES = amd64 arm64
VERSION := $(shell git describe --tags --always)
LDFLAGS := -ldflags "-s -w -X 'github.com/basecamp/once/internal/version.Version=$(VERSION)'"
TEST_RELEASE_TAG = v0.0.1-test
build:
CGO_ENABLED=0 go build -trimpath $(LDFLAGS) -o bin/ ./cmd/...
build-all:
@for os in $(PLATFORMS); do \
for arch in $(ARCHITECTURES); do \
echo "Building for $$os/$$arch..."; \
CGO_ENABLED=0 GOOS=$$os GOARCH=$$arch go build -trimpath $(LDFLAGS) -o bin/$$os-$$arch/ ./cmd/...; \
done; \
done
test:
go test ./internal/...
integration:
go test -v -count=1 ./integration/...
lint:
golangci-lint run
lint-actions:
actionlint
zizmor .
coverage:
go test -coverprofile=coverage.out ./internal/...
go tool cover -html=coverage.out
dist: build-all
mkdir -p dist
@for os in $(PLATFORMS); do \
for arch in $(ARCHITECTURES); do \
cp bin/$$os-$$arch/once dist/once-$$os-$$arch; \
done; \
done
cd dist && sha256sum once-* > checksums.txt
test-release:
-gh release delete $(TEST_RELEASE_TAG) --yes --cleanup-tag
git tag -f $(TEST_RELEASE_TAG)
git push origin $(TEST_RELEASE_TAG) --force