-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjustfile
More file actions
81 lines (67 loc) · 2.32 KB
/
justfile
File metadata and controls
81 lines (67 loc) · 2.32 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# Install just: https://github.com/casey/just
app := "indelligent"
org := "github.com/SpeciesFileGroup/"
version := `git describe --tags 2>/dev/null || echo "v2.0.0-dev"`
date := `date -u '+%Y-%m-%d_%H:%M:%S%Z'`
no_c := "CGO_ENABLED=0"
flags_shared := "GOARCH=amd64"
flags_linux := "GOARCH=amd64 GOOS=linux"
flags_linux_arm := "GOARCH=arm64 GOOS=linux"
flags_mac := "GOARCH=amd64 GOOS=darwin"
flags_mac_arm := "GOARCH=arm64 GOOS=darwin"
flags_win := "GOARCH=amd64 GOOS=windows"
flags_ld := '-ldflags "-s -w -X ' + org + app + \
'.Build=' + date + ' -X ' + org + app + \
'.Version=' + version + '"'
flags_rel := '-trimpath -ldflags "-s -w -X ' + org + app + \
'.Build=' + date + '"'
default: install
test:
go test -shuffle=on -race -count=1 ./...
docs:
swag init -g io/web/server.go -o docs
ronn:
@which ronn > /dev/null || gem install ronn-ng
man: ronn
@ronn --roff man/{{app}}.1.ronn
@ronn --fragment --pipe man/{{app}}.1.ronn > io/web/templates/man_content.html
deps:
go mod download
build:
cd {{app}} && \
go clean && \
{{no_c}} go build {{flags_ld}} -o ../build/{{app}}
buildrel:
cd {{app}} && \
go clean && \
{{no_c}} go build {{flags_rel}} -o ../build/{{app}}
install:
cd {{app}} && \
go clean && \
{{no_c}} go install {{flags_ld}}
docker: build
docker build -t sfgrp/{{app}}:latest -t sfgrp/{{app}}:{{version}} .
cd {{app}} && go clean
dockerhub: docker
docker push sfgrp/{{app}}
docker push sfgrp/{{app}}:{{version}}
release:
#!/usr/bin/env bash
set -euo pipefail
cd {{app}}
go clean
{{flags_linux}} {{no_c}} go build {{flags_ld}}
tar zcf /tmp/{{app}}-{{version}}-linux-x86.tar.gz {{app}} -C .. man/{{app}}.1 INSTALL
go clean
{{flags_linux_arm}} {{no_c}} go build {{flags_ld}}
tar zcf /tmp/{{app}}-{{version}}-linux-arm.tar.gz {{app}} -C .. man/{{app}}.1 INSTALL
go clean
{{flags_mac}} {{no_c}} go build {{flags_ld}}
tar zcf /tmp/{{app}}-{{version}}-mac-x86.tar.gz {{app}} -C .. man/{{app}}.1 INSTALL
go clean
{{flags_mac_arm}} {{no_c}} go build {{flags_ld}}
tar zcf /tmp/{{app}}-{{version}}-mac-arm.tar.gz {{app}} -C .. man/{{app}}.1 INSTALL
go clean
{{flags_win}} {{no_c}} go build {{flags_ld}}
zip -9 /tmp/{{app}}-{{version}}-win-x86.zip {{app}}.exe
go clean