-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy path.bgo.yaml
147 lines (131 loc) · 5.6 KB
/
.bgo.yaml
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
---
app:
bgo:
build:
# the predefined limitations
# for guiding which os and arch will be building in auto scope.
#
# If 'bgo.build.for' is empty slice, the whole available 'go tool dist list'
# will be used.
#
#for:
# - "linux/amd64"
# - "windows/amd64"
# - "darwin/amd64"
# - "darwin/arm64"
# the predefined limitations
os: [ linux ]
# the predefined limitations
#,386,arm64
arch: [ amd64 ]
ldflags: [ "-s", "-w" ]
# build scopes: auto, full, short
#
# bgo --auto will scan the .bgo.yml in workdir and all sub-folders and apply its
# bgo --full will populate all supported targets with 'go tool dist list'
# bgo --short will build just for current hosted CPU and Arch
#
# First project in first group is **active** project.
# Or, first project scanned is **active** if without .bgo.yml found.
#
# A **active** project will be built in working in 'short' scope.
scope: auto
output:
dir: ./bin
# split-to sample: "{{.GroupKey}}/{{.ProjectName}}"
#
# named-as sample: "{{.AppName}}-{{.Version}}-{{.OS}}-{{.ARCH}}"
# ## suffix-as: "{{if .OS == windows}}.exe{{else}}{{end}}"
# ## zip-suffix-as: "{{if .OS == windows}}.7z{{else}}.xz{{end}}"
# wild matches with '*' and '?'
# excludes patterns will be performed to project directories.
# but projects specified in .bgo.yml are always enabled.
excludes:
- "study*"
- "test*"
goproxy: # optional, string,
projects:
000-default-group:
leading-text:
items:
# first part of a project key is treated as sorting key.
003-generic:
dir: ./study/generic
gocmd: go1.18beta1
os: [ "darwin" ]
arch: [ "amd64" ]
version: # if git revision cannot be retrieved, or just a fixed version be set here
#disable: true
009-bgo-disabled: # <- form: sortingKey-projectName
dir: cli/bgo
disabled: true
001-bgo: # <- form: sortingKey-projectName
name: # <- app name
version: 1.0.0 # this field could be replaced with current git-revision
dir: .
gen: false
install: true
cgo: false
race: false
keep-workdir: false # true: don't switch workdir to 'dir'
use-workdir: # specify a special workdir
os: [ "linux","darwin" ]
arch: [ "amd64" ]
for: [ "windows/amd64" ]
tags: [ "test" ]
extends:
- pkg: "github.com/hedzr/cmdr/conf"
values:
AppName: "{{.AppName}}"
Version: "`git describe --tags --abbrev=16`" # "{{.Version}}"
Buildstamp: "{{.BuildTime}}" # or shell it
Githash: "`git rev-parse --short HEAD`"
# Githash: "{{.GitRevision}}" # or shell it: "`git describe --tags --abbrev=9`"
GoVersion: "{{.GoVersion}}" # or shell it
ServerID: "{{.RandomString}}" #
SerialString: "{{.RandomString}}" # since cmdr v1.10.23+
Serial: "{{.Serial}}" # since cmdr v1.10.23+
# NOTE that post-action and pre-action will be interpreted
# by /bin/bash or powershell.exe
# BUT, these following codes just works for bash shell.
post-action: |
echo "runtime: $OSTYPE / {{.Info.GOOS}} / {{.Info.GOARCH}}, setting: {{.OS}}/{{.ARCH}}"
if [[ "{{.Info.GOOS}}" == *{{.OS}}* && "{{.Info.GOARCH}}" == {{.ARCH}} ]]; then
cp -v {{.Output.Path}} $HOME/go/bin/{{.AppName}}
elif [[ {{.OS}} == linux ]]; then
[ -d $HOME/work/autocomp.work/fish.comp/bin ] && \
cp -v {{.Output.Path}} $HOME/work/autocomp.work/fish.comp/bin/{{.AppName}}
[ -d $HOME/go/bin/ ] && \
cp -v {{.Output.Path}} $HOME/go/bin/{{.AppName}}
ls -la $HOME/work/autocomp.work/fish.comp/bin/{{.AppName}}
elif [[ {{.OS}} == windows ]]; then
[ -d /Volumes/hz-pc/hz/bin ] && \
cp -v {{.Output.Path}} /Volumes/hz-pc/hz/bin/{{.AppName}}.exe
ls -la {{.Output.Path}} /Volumes/hz-pc/hz/bin/{{.AppName}}.exe
fi
echo "OS: $OSTYPE / {{.Info.GOOS}}, Arch: {{.Info.GOARCH}}"
ldflags: [ "-s", "-w" ] # default ldflags is to get the smaller build for releasing
asmflags: [ ]
gcflags: [ ]
gccgoflags: [ ]
# msan: false
#
# gocmd: $HOME/go/go1.18beta1/bin/go1.18beta1
# goroot: ""
#
# debug: false # true to produce a larger build with debug info
# disable-result: false # no ll (Shell list) building result
#
# disabled: false # disable this building target temporarily if necessary
#
# os: [ "linux","darwin","windows" ]
# arch: [ "amd64" ]
# for: [ "linux/riscv64" ]
#
# pre-action:
# pre-action-file:
# post-action:
# post-action-file:
002-jsonx:
dir: tools/jsonx
gen: