-
Notifications
You must be signed in to change notification settings - Fork 2
/
justfile
44 lines (36 loc) · 1.26 KB
/
justfile
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
go := env_var_or_default('GOCMD', 'go')
default: tidy test
tidy:
{{go}} mod tidy
gofumpt -l -w .
test:
{{go}} vet ./...
# golangci-lint run ./...
{{go}} test -race -coverprofile=cover.out -timeout=60s ./...
{{go}} tool cover -html=cover.out -o=cover.html
GOCMD={{go}} ./test
fuzz:
{{go}} test -fuzz FuzzParser
fuzz-save:
cp ~/.cache/go-build/fuzz/github.com/gopatchy/bkl/FuzzParser/* testdata/fuzz/FuzzParser/
rm ~/.cache/go-build/fuzz/github.com/gopatchy/bkl/FuzzParser/*
todo:
-git grep -e TODO --and --not -e ignoretodo
docker:
#!/bin/bash -e
VER=$(git describe --abbrev=0 --tags)
docker buildx build --target=dist --platform=linux/arm64,linux/amd64 --provenance=false --build-arg=git_tag=$VER --push --tag=ghcr.io/gopatchy/bkl:${VER#v} --tag=ghcr.io/gopatchy/bkl:latest .
pkg:
#!/bin/bash -e
VER=$(git describe --abbrev=0 --tags)
for PLATFORM in linux/arm64 linux/amd64 darwin/arm64 darwin/amd64; do
echo $PLATFORM
export GOOS=$(echo $PLATFORM | cut -d / -f 1)
export GOARCH=$(echo $PLATFORM | cut -d / -f 2)
DIR=$(mktemp --directory)
cp LICENSE $DIR
CGO_ENABLED=0 go build -tags bkl-$VER,bkl-src-pkg -trimpath -ldflags=-extldflags=-static -o $DIR ./...
cd $DIR
tar -czf {{justfile_directory()}}/pkg/bkl-$GOOS-$GOARCH-$VER.tar.gz *
cd ~-
done